@mmmbuto/nexuscrew 0.4.3 → 0.7.0

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.
@@ -0,0 +1,81 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function i(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(s){if(s.ep)return;s.ep=!0;const n=i(s);fetch(s.href,n)}})();function Kp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bd={exports:{}},go={},Ed={exports:{}},G={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var $s=Symbol.for("react.element"),Vp=Symbol.for("react.portal"),qp=Symbol.for("react.fragment"),Yp=Symbol.for("react.strict_mode"),Xp=Symbol.for("react.profiler"),Gp=Symbol.for("react.provider"),Qp=Symbol.for("react.context"),Jp=Symbol.for("react.forward_ref"),Zp=Symbol.for("react.suspense"),em=Symbol.for("react.memo"),tm=Symbol.for("react.lazy"),dc=Symbol.iterator;function im(e){return e===null||typeof e!="object"?null:(e=dc&&e[dc]||e["@@iterator"],typeof e=="function"?e:null)}var Dd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ld=Object.assign,Rd={};function Tr(e,t,i){this.props=e,this.context=t,this.refs=Rd,this.updater=i||Dd}Tr.prototype.isReactComponent={};Tr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Tr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Pd(){}Pd.prototype=Tr.prototype;function sh(e,t,i){this.props=e,this.context=t,this.refs=Rd,this.updater=i||Dd}var nh=sh.prototype=new Pd;nh.constructor=sh;Ld(nh,Tr.prototype);nh.isPureReactComponent=!0;var fc=Array.isArray,Md=Object.prototype.hasOwnProperty,oh={current:null},Bd={key:!0,ref:!0,__self:!0,__source:!0};function Td(e,t,i){var r,s={},n=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(n=""+t.key),t)Md.call(t,r)&&!Bd.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=i;else if(1<l){for(var h=Array(l),a=0;a<l;a++)h[a]=arguments[a+2];s.children=h}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:$s,type:e,key:n,ref:o,props:s,_owner:oh.current}}function rm(e,t){return{$$typeof:$s,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function lh(e){return typeof e=="object"&&e!==null&&e.$$typeof===$s}function sm(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return t[i]})}var _c=/\/+/g;function Ho(e,t){return typeof e=="object"&&e!==null&&e.key!=null?sm(""+e.key):t.toString(36)}function wn(e,t,i,r,s){var n=typeof e;(n==="undefined"||n==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(n){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case $s:case Vp:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Ho(o,0):r,fc(s)?(i="",e!=null&&(i=e.replace(_c,"$&/")+"/"),wn(s,t,i,"",function(a){return a})):s!=null&&(lh(s)&&(s=rm(s,i+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(_c,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",fc(e))for(var l=0;l<e.length;l++){n=e[l];var h=r+Ho(n,l);o+=wn(n,t,i,h,s)}else if(h=im(e),typeof h=="function")for(e=h.call(e),l=0;!(n=e.next()).done;)n=n.value,h=r+Ho(n,l++),o+=wn(n,t,i,h,s);else if(n==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Gs(e,t,i){if(e==null)return e;var r=[],s=0;return wn(e,r,"","",function(n){return t.call(i,n,s++)}),r}function nm(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(i){(e._status===0||e._status===-1)&&(e._status=1,e._result=i)},function(i){(e._status===0||e._status===-1)&&(e._status=2,e._result=i)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Xe={current:null},Cn={transition:null},om={ReactCurrentDispatcher:Xe,ReactCurrentBatchConfig:Cn,ReactCurrentOwner:oh};function Nd(){throw Error("act(...) is not supported in production builds of React.")}G.Children={map:Gs,forEach:function(e,t,i){Gs(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return Gs(e,function(){t++}),t},toArray:function(e){return Gs(e,function(t){return t})||[]},only:function(e){if(!lh(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};G.Component=Tr;G.Fragment=qp;G.Profiler=Xp;G.PureComponent=sh;G.StrictMode=Yp;G.Suspense=Zp;G.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=om;G.act=Nd;G.cloneElement=function(e,t,i){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Ld({},e.props),s=e.key,n=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(n=t.ref,o=oh.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(h in t)Md.call(t,h)&&!Bd.hasOwnProperty(h)&&(r[h]=t[h]===void 0&&l!==void 0?l[h]:t[h])}var h=arguments.length-2;if(h===1)r.children=i;else if(1<h){l=Array(h);for(var a=0;a<h;a++)l[a]=arguments[a+2];r.children=l}return{$$typeof:$s,type:e.type,key:s,ref:n,props:r,_owner:o}};G.createContext=function(e){return e={$$typeof:Qp,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Gp,_context:e},e.Consumer=e};G.createElement=Td;G.createFactory=function(e){var t=Td.bind(null,e);return t.type=e,t};G.createRef=function(){return{current:null}};G.forwardRef=function(e){return{$$typeof:Jp,render:e}};G.isValidElement=lh;G.lazy=function(e){return{$$typeof:tm,_payload:{_status:-1,_result:e},_init:nm}};G.memo=function(e,t){return{$$typeof:em,type:e,compare:t===void 0?null:t}};G.startTransition=function(e){var t=Cn.transition;Cn.transition={};try{e()}finally{Cn.transition=t}};G.unstable_act=Nd;G.useCallback=function(e,t){return Xe.current.useCallback(e,t)};G.useContext=function(e){return Xe.current.useContext(e)};G.useDebugValue=function(){};G.useDeferredValue=function(e){return Xe.current.useDeferredValue(e)};G.useEffect=function(e,t){return Xe.current.useEffect(e,t)};G.useId=function(){return Xe.current.useId()};G.useImperativeHandle=function(e,t,i){return Xe.current.useImperativeHandle(e,t,i)};G.useInsertionEffect=function(e,t){return Xe.current.useInsertionEffect(e,t)};G.useLayoutEffect=function(e,t){return Xe.current.useLayoutEffect(e,t)};G.useMemo=function(e,t){return Xe.current.useMemo(e,t)};G.useReducer=function(e,t,i){return Xe.current.useReducer(e,t,i)};G.useRef=function(e){return Xe.current.useRef(e)};G.useState=function(e){return Xe.current.useState(e)};G.useSyncExternalStore=function(e,t,i){return Xe.current.useSyncExternalStore(e,t,i)};G.useTransition=function(){return Xe.current.useTransition()};G.version="18.3.1";Ed.exports=G;var O=Ed.exports;const lm=Kp(O);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var am=O,hm=Symbol.for("react.element"),cm=Symbol.for("react.fragment"),um=Object.prototype.hasOwnProperty,dm=am.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,fm={key:!0,ref:!0,__self:!0,__source:!0};function Od(e,t,i){var r,s={},n=null,o=null;i!==void 0&&(n=""+i),t.key!==void 0&&(n=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)um.call(t,r)&&!fm.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:hm,type:e,key:n,ref:o,props:s,_owner:dm.current}}go.Fragment=cm;go.jsx=Od;go.jsxs=Od;bd.exports=go;var g=bd.exports,El={},Ad={exports:{}},ut={},Id={exports:{}},zd={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(x,z){var j=x.length;x.push(z);e:for(;0<j;){var R=j-1>>>1,H=x[R];if(0<s(H,z))x[R]=z,x[j]=H,j=R;else break e}}function i(x){return x.length===0?null:x[0]}function r(x){if(x.length===0)return null;var z=x[0],j=x.pop();if(j!==z){x[0]=j;e:for(var R=0,H=x.length,J=H>>>1;R<J;){var Z=2*(R+1)-1,Fe=x[Z],Se=Z+1,ft=x[Se];if(0>s(Fe,j))Se<H&&0>s(ft,Fe)?(x[R]=ft,x[Se]=j,R=Se):(x[R]=Fe,x[Z]=j,R=Z);else if(Se<H&&0>s(ft,j))x[R]=ft,x[Se]=j,R=Se;else break e}}return z}function s(x,z){var j=x.sortIndex-z.sortIndex;return j!==0?j:x.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var n=performance;e.unstable_now=function(){return n.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var h=[],a=[],d=1,c=null,f=3,u=!1,m=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(x){for(var z=i(a);z!==null;){if(z.callback===null)r(a);else if(z.startTime<=x)r(a),z.sortIndex=z.expirationTime,t(h,z);else break;z=i(a)}}function y(x){if(S=!1,v(x),!m)if(i(h)!==null)m=!0,N(C);else{var z=i(a);z!==null&&K(y,z.startTime-x)}}function C(x,z){m=!1,S&&(S=!1,p(M),M=-1),u=!0;var j=f;try{for(v(z),c=i(h);c!==null&&(!(c.expirationTime>z)||x&&!U());){var R=c.callback;if(typeof R=="function"){c.callback=null,f=c.priorityLevel;var H=R(c.expirationTime<=z);z=e.unstable_now(),typeof H=="function"?c.callback=H:c===i(h)&&r(h),v(z)}else r(h);c=i(h)}if(c!==null)var J=!0;else{var Z=i(a);Z!==null&&K(y,Z.startTime-z),J=!1}return J}finally{c=null,f=j,u=!1}}var k=!1,L=null,M=-1,V=5,W=-1;function U(){return!(e.unstable_now()-W<V)}function A(){if(L!==null){var x=e.unstable_now();W=x;var z=!0;try{z=L(!0,x)}finally{z?E():(k=!1,L=null)}}else k=!1}var E;if(typeof _=="function")E=function(){_(A)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,b=P.port2;P.port1.onmessage=A,E=function(){b.postMessage(null)}}else E=function(){w(A,0)};function N(x){L=x,k||(k=!0,E())}function K(x,z){M=w(function(){x(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(x){x.callback=null},e.unstable_continueExecution=function(){m||u||(m=!0,N(C))},e.unstable_forceFrameRate=function(x){0>x||125<x?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<x?Math.floor(1e3/x):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return i(h)},e.unstable_next=function(x){switch(f){case 1:case 2:case 3:var z=3;break;default:z=f}var j=f;f=z;try{return x()}finally{f=j}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(x,z){switch(x){case 1:case 2:case 3:case 4:case 5:break;default:x=3}var j=f;f=x;try{return z()}finally{f=j}},e.unstable_scheduleCallback=function(x,z,j){var R=e.unstable_now();switch(typeof j=="object"&&j!==null?(j=j.delay,j=typeof j=="number"&&0<j?R+j:R):j=R,x){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=j+H,x={id:d++,callback:z,priorityLevel:x,startTime:j,expirationTime:H,sortIndex:-1},j>R?(x.sortIndex=j,t(a,x),i(h)===null&&x===i(a)&&(S?(p(M),M=-1):S=!0,K(y,j-R))):(x.sortIndex=H,t(h,x),m||u||(m=!0,N(C))),x},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(x){var z=f;return function(){var j=f;f=z;try{return x.apply(this,arguments)}finally{f=j}}}})(zd);Id.exports=zd;var _m=Id.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var pm=O,ct=_m;function B(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var $d=new Set,gs={};function er(e,t){br(e,t),br(e+"Capture",t)}function br(e,t){for(gs[e]=t,e=0;e<t.length;e++)$d.add(t[e])}var Zt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Dl=Object.prototype.hasOwnProperty,mm=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,pc={},mc={};function vm(e){return Dl.call(mc,e)?!0:Dl.call(pc,e)?!1:mm.test(e)?mc[e]=!0:(pc[e]=!0,!1)}function gm(e,t,i,r){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Sm(e,t,i,r){if(t===null||typeof t>"u"||gm(e,t,i,r))return!0;if(r)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ge(e,t,i,r,s,n,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var $e={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){$e[e]=new Ge(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];$e[t]=new Ge(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){$e[e]=new Ge(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){$e[e]=new Ge(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){$e[e]=new Ge(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){$e[e]=new Ge(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){$e[e]=new Ge(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){$e[e]=new Ge(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){$e[e]=new Ge(e,5,!1,e.toLowerCase(),null,!1,!1)});var ah=/[\-:]([a-z])/g;function hh(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ah,hh);$e[t]=new Ge(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ah,hh);$e[t]=new Ge(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ah,hh);$e[t]=new Ge(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){$e[e]=new Ge(e,1,!1,e.toLowerCase(),null,!1,!1)});$e.xlinkHref=new Ge("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){$e[e]=new Ge(e,1,!1,e.toLowerCase(),null,!0,!0)});function ch(e,t,i,r){var s=$e.hasOwnProperty(t)?$e[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Sm(t,i,s,r)&&(i=null),r||s===null?vm(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):s.mustUseProperty?e[s.propertyName]=i===null?s.type===3?!1:"":i:(t=s.attributeName,r=s.attributeNamespace,i===null?e.removeAttribute(t):(s=s.type,i=s===3||s===4&&i===!0?"":""+i,r?e.setAttributeNS(r,t,i):e.setAttribute(t,i))))}var ri=pm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Qs=Symbol.for("react.element"),or=Symbol.for("react.portal"),lr=Symbol.for("react.fragment"),uh=Symbol.for("react.strict_mode"),Ll=Symbol.for("react.profiler"),Fd=Symbol.for("react.provider"),Hd=Symbol.for("react.context"),dh=Symbol.for("react.forward_ref"),Rl=Symbol.for("react.suspense"),Pl=Symbol.for("react.suspense_list"),fh=Symbol.for("react.memo"),di=Symbol.for("react.lazy"),Wd=Symbol.for("react.offscreen"),vc=Symbol.iterator;function $r(e){return e===null||typeof e!="object"?null:(e=vc&&e[vc]||e["@@iterator"],typeof e=="function"?e:null)}var fe=Object.assign,Wo;function Zr(e){if(Wo===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Wo=t&&t[1]||""}return`
34
+ `+Wo+e}var jo=!1;function Uo(e,t){if(!e||jo)return"";jo=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(a){var r=a}Reflect.construct(e,[],t)}else{try{t.call()}catch(a){r=a}e.call(t.prototype)}else{try{throw Error()}catch(a){r=a}e()}}catch(a){if(a&&r&&typeof a.stack=="string"){for(var s=a.stack.split(`
35
+ `),n=r.stack.split(`
36
+ `),o=s.length-1,l=n.length-1;1<=o&&0<=l&&s[o]!==n[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==n[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==n[l]){var h=`
37
+ `+s[o].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),h}while(1<=o&&0<=l);break}}}finally{jo=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?Zr(e):""}function ym(e){switch(e.tag){case 5:return Zr(e.type);case 16:return Zr("Lazy");case 13:return Zr("Suspense");case 19:return Zr("SuspenseList");case 0:case 2:case 15:return e=Uo(e.type,!1),e;case 11:return e=Uo(e.type.render,!1),e;case 1:return e=Uo(e.type,!0),e;default:return""}}function Ml(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case lr:return"Fragment";case or:return"Portal";case Ll:return"Profiler";case uh:return"StrictMode";case Rl:return"Suspense";case Pl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Hd:return(e.displayName||"Context")+".Consumer";case Fd:return(e._context.displayName||"Context")+".Provider";case dh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case fh:return t=e.displayName||null,t!==null?t:Ml(e.type)||"Memo";case di:t=e._payload,e=e._init;try{return Ml(e(t))}catch{}}return null}function wm(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ml(t);case 8:return t===uh?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ri(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function jd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Cm(e){var t=jd(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var s=i.get,n=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Js(e){e._valueTracker||(e._valueTracker=Cm(e))}function Ud(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),r="";return e&&(r=jd(e)?e.checked?"true":"false":e.value),e=r,e!==i?(t.setValue(e),!0):!1}function Fn(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Bl(e,t){var i=t.checked;return fe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function gc(e,t){var i=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;i=Ri(t.value!=null?t.value:i),e._wrapperState={initialChecked:r,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Kd(e,t){t=t.checked,t!=null&&ch(e,"checked",t,!1)}function Tl(e,t){Kd(e,t);var i=Ri(t.value),r=t.type;if(i!=null)r==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Nl(e,t.type,i):t.hasOwnProperty("defaultValue")&&Nl(e,t.type,Ri(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Sc(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function Nl(e,t,i){(t!=="number"||Fn(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var es=Array.isArray;function Sr(e,t,i,r){if(e=e.options,t){t={};for(var s=0;s<i.length;s++)t["$"+i[s]]=!0;for(i=0;i<e.length;i++)s=t.hasOwnProperty("$"+e[i].value),e[i].selected!==s&&(e[i].selected=s),s&&r&&(e[i].defaultSelected=!0)}else{for(i=""+Ri(i),t=null,s=0;s<e.length;s++){if(e[s].value===i){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Ol(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(B(91));return fe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function yc(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(B(92));if(es(i)){if(1<i.length)throw Error(B(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:Ri(i)}}function Vd(e,t){var i=Ri(t.value),r=Ri(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),r!=null&&(e.defaultValue=""+r)}function wc(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function qd(e){switch(e){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 Al(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?qd(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Zs,Yd=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,i,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,i,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Zs=Zs||document.createElement("div"),Zs.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Zs.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ss(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var as={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},xm=["Webkit","ms","Moz","O"];Object.keys(as).forEach(function(e){xm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),as[t]=as[e]})});function Xd(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||as.hasOwnProperty(e)&&as[e]?(""+t).trim():t+"px"}function Gd(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var r=i.indexOf("--")===0,s=Xd(i,t[i],r);i==="float"&&(i="cssFloat"),r?e.setProperty(i,s):e[i]=s}}var km=fe({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 Il(e,t){if(t){if(km[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(B(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(B(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(B(61))}if(t.style!=null&&typeof t.style!="object")throw Error(B(62))}}function zl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 $l=null;function _h(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fl=null,yr=null,wr=null;function Cc(e){if(e=Ws(e)){if(typeof Fl!="function")throw Error(B(280));var t=e.stateNode;t&&(t=xo(t),Fl(e.stateNode,e.type,t))}}function Qd(e){yr?wr?wr.push(e):wr=[e]:yr=e}function Jd(){if(yr){var e=yr,t=wr;if(wr=yr=null,Cc(e),t)for(e=0;e<t.length;e++)Cc(t[e])}}function Zd(e,t){return e(t)}function ef(){}var Ko=!1;function tf(e,t,i){if(Ko)return e(t,i);Ko=!0;try{return Zd(e,t,i)}finally{Ko=!1,(yr!==null||wr!==null)&&(ef(),Jd())}}function ys(e,t){var i=e.stateNode;if(i===null)return null;var r=xo(i);if(r===null)return null;i=r[t];e:switch(t){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)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(B(231,t,typeof i));return i}var Hl=!1;if(Zt)try{var Fr={};Object.defineProperty(Fr,"passive",{get:function(){Hl=!0}}),window.addEventListener("test",Fr,Fr),window.removeEventListener("test",Fr,Fr)}catch{Hl=!1}function bm(e,t,i,r,s,n,o,l,h){var a=Array.prototype.slice.call(arguments,3);try{t.apply(i,a)}catch(d){this.onError(d)}}var hs=!1,Hn=null,Wn=!1,Wl=null,Em={onError:function(e){hs=!0,Hn=e}};function Dm(e,t,i,r,s,n,o,l,h){hs=!1,Hn=null,bm.apply(Em,arguments)}function Lm(e,t,i,r,s,n,o,l,h){if(Dm.apply(this,arguments),hs){if(hs){var a=Hn;hs=!1,Hn=null}else throw Error(B(198));Wn||(Wn=!0,Wl=a)}}function tr(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function rf(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function xc(e){if(tr(e)!==e)throw Error(B(188))}function Rm(e){var t=e.alternate;if(!t){if(t=tr(e),t===null)throw Error(B(188));return t!==e?null:e}for(var i=e,r=t;;){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 xc(s),e;if(n===r)return xc(s),t;n=n.sibling}throw Error(B(188))}if(i.return!==r.return)i=s,r=n;else{for(var o=!1,l=s.child;l;){if(l===i){o=!0,i=s,r=n;break}if(l===r){o=!0,r=s,i=n;break}l=l.sibling}if(!o){for(l=n.child;l;){if(l===i){o=!0,i=n,r=s;break}if(l===r){o=!0,r=n,i=s;break}l=l.sibling}if(!o)throw Error(B(189))}}if(i.alternate!==r)throw Error(B(190))}if(i.tag!==3)throw Error(B(188));return i.stateNode.current===i?e:t}function sf(e){return e=Rm(e),e!==null?nf(e):null}function nf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=nf(e);if(t!==null)return t;e=e.sibling}return null}var of=ct.unstable_scheduleCallback,kc=ct.unstable_cancelCallback,Pm=ct.unstable_shouldYield,Mm=ct.unstable_requestPaint,ge=ct.unstable_now,Bm=ct.unstable_getCurrentPriorityLevel,ph=ct.unstable_ImmediatePriority,lf=ct.unstable_UserBlockingPriority,jn=ct.unstable_NormalPriority,Tm=ct.unstable_LowPriority,af=ct.unstable_IdlePriority,So=null,Ht=null;function Nm(e){if(Ht&&typeof Ht.onCommitFiberRoot=="function")try{Ht.onCommitFiberRoot(So,e,void 0,(e.current.flags&128)===128)}catch{}}var Mt=Math.clz32?Math.clz32:Im,Om=Math.log,Am=Math.LN2;function Im(e){return e>>>=0,e===0?32:31-(Om(e)/Am|0)|0}var en=64,tn=4194304;function ts(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Un(e,t){var i=e.pendingLanes;if(i===0)return 0;var r=0,s=e.suspendedLanes,n=e.pingedLanes,o=i&268435455;if(o!==0){var l=o&~s;l!==0?r=ts(l):(n&=o,n!==0&&(r=ts(n)))}else o=i&~s,o!==0?r=ts(o):n!==0&&(r=ts(n));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,n=t&-t,s>=n||s===16&&(n&4194240)!==0))return t;if(r&4&&(r|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)i=31-Mt(t),s=1<<i,r|=e[i],t&=~s;return r}function zm(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 $m(e,t){for(var i=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,n=e.pendingLanes;0<n;){var o=31-Mt(n),l=1<<o,h=s[o];h===-1?(!(l&i)||l&r)&&(s[o]=zm(l,t)):h<=t&&(e.expiredLanes|=l),n&=~l}}function jl(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function hf(){var e=en;return en<<=1,!(en&4194240)&&(en=64),e}function Vo(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Fs(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Mt(t),e[t]=i}function Fm(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<i;){var s=31-Mt(i),n=1<<s;t[s]=0,r[s]=-1,e[s]=-1,i&=~n}}function mh(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var r=31-Mt(i),s=1<<r;s&t|e[r]&t&&(e[r]|=t),i&=~s}}var te=0;function cf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var uf,vh,df,ff,_f,Ul=!1,rn=[],yi=null,wi=null,Ci=null,ws=new Map,Cs=new Map,pi=[],Hm="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 bc(e,t){switch(e){case"focusin":case"focusout":yi=null;break;case"dragenter":case"dragleave":wi=null;break;case"mouseover":case"mouseout":Ci=null;break;case"pointerover":case"pointerout":ws.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cs.delete(t.pointerId)}}function Hr(e,t,i,r,s,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:i,eventSystemFlags:r,nativeEvent:n,targetContainers:[s]},t!==null&&(t=Ws(t),t!==null&&vh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function Wm(e,t,i,r,s){switch(t){case"focusin":return yi=Hr(yi,e,t,i,r,s),!0;case"dragenter":return wi=Hr(wi,e,t,i,r,s),!0;case"mouseover":return Ci=Hr(Ci,e,t,i,r,s),!0;case"pointerover":var n=s.pointerId;return ws.set(n,Hr(ws.get(n)||null,e,t,i,r,s)),!0;case"gotpointercapture":return n=s.pointerId,Cs.set(n,Hr(Cs.get(n)||null,e,t,i,r,s)),!0}return!1}function pf(e){var t=Fi(e.target);if(t!==null){var i=tr(t);if(i!==null){if(t=i.tag,t===13){if(t=rf(i),t!==null){e.blockedOn=t,_f(e.priority,function(){df(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function xn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Kl(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var r=new i.constructor(i.type,i);$l=r,i.target.dispatchEvent(r),$l=null}else return t=Ws(i),t!==null&&vh(t),e.blockedOn=i,!1;t.shift()}return!0}function Ec(e,t,i){xn(e)&&i.delete(t)}function jm(){Ul=!1,yi!==null&&xn(yi)&&(yi=null),wi!==null&&xn(wi)&&(wi=null),Ci!==null&&xn(Ci)&&(Ci=null),ws.forEach(Ec),Cs.forEach(Ec)}function Wr(e,t){e.blockedOn===t&&(e.blockedOn=null,Ul||(Ul=!0,ct.unstable_scheduleCallback(ct.unstable_NormalPriority,jm)))}function xs(e){function t(s){return Wr(s,e)}if(0<rn.length){Wr(rn[0],e);for(var i=1;i<rn.length;i++){var r=rn[i];r.blockedOn===e&&(r.blockedOn=null)}}for(yi!==null&&Wr(yi,e),wi!==null&&Wr(wi,e),Ci!==null&&Wr(Ci,e),ws.forEach(t),Cs.forEach(t),i=0;i<pi.length;i++)r=pi[i],r.blockedOn===e&&(r.blockedOn=null);for(;0<pi.length&&(i=pi[0],i.blockedOn===null);)pf(i),i.blockedOn===null&&pi.shift()}var Cr=ri.ReactCurrentBatchConfig,Kn=!0;function Um(e,t,i,r){var s=te,n=Cr.transition;Cr.transition=null;try{te=1,gh(e,t,i,r)}finally{te=s,Cr.transition=n}}function Km(e,t,i,r){var s=te,n=Cr.transition;Cr.transition=null;try{te=4,gh(e,t,i,r)}finally{te=s,Cr.transition=n}}function gh(e,t,i,r){if(Kn){var s=Kl(e,t,i,r);if(s===null)il(e,t,r,Vn,i),bc(e,r);else if(Wm(s,e,t,i,r))r.stopPropagation();else if(bc(e,r),t&4&&-1<Hm.indexOf(e)){for(;s!==null;){var n=Ws(s);if(n!==null&&uf(n),n=Kl(e,t,i,r),n===null&&il(e,t,r,Vn,i),n===s)break;s=n}s!==null&&r.stopPropagation()}else il(e,t,r,null,i)}}var Vn=null;function Kl(e,t,i,r){if(Vn=null,e=_h(r),e=Fi(e),e!==null)if(t=tr(e),t===null)e=null;else if(i=t.tag,i===13){if(e=rf(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Vn=e,null}function mf(e){switch(e){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(Bm()){case ph:return 1;case lf:return 4;case jn:case Tm:return 16;case af:return 536870912;default:return 16}default:return 16}}var vi=null,Sh=null,kn=null;function vf(){if(kn)return kn;var e,t=Sh,i=t.length,r,s="value"in vi?vi.value:vi.textContent,n=s.length;for(e=0;e<i&&t[e]===s[e];e++);var o=i-e;for(r=1;r<=o&&t[i-r]===s[n-r];r++);return kn=s.slice(e,1<r?1-r:void 0)}function bn(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function sn(){return!0}function Dc(){return!1}function dt(e){function t(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 l in e)e.hasOwnProperty(l)&&(i=e[l],this[l]=i?i(n):n[l]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?sn:Dc,this.isPropagationStopped=Dc,this}return fe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=sn)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=sn)},persist:function(){},isPersistent:sn}),t}var Nr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yh=dt(Nr),Hs=fe({},Nr,{view:0,detail:0}),Vm=dt(Hs),qo,Yo,jr,yo=fe({},Hs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wh,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==jr&&(jr&&e.type==="mousemove"?(qo=e.screenX-jr.screenX,Yo=e.screenY-jr.screenY):Yo=qo=0,jr=e),qo)},movementY:function(e){return"movementY"in e?e.movementY:Yo}}),Lc=dt(yo),qm=fe({},yo,{dataTransfer:0}),Ym=dt(qm),Xm=fe({},Hs,{relatedTarget:0}),Xo=dt(Xm),Gm=fe({},Nr,{animationName:0,elapsedTime:0,pseudoElement:0}),Qm=dt(Gm),Jm=fe({},Nr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Zm=dt(Jm),ev=fe({},Nr,{data:0}),Rc=dt(ev),tv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},iv={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"},rv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=rv[e])?!!t[e]:!1}function wh(){return sv}var nv=fe({},Hs,{key:function(e){if(e.key){var t=tv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=bn(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?iv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wh,charCode:function(e){return e.type==="keypress"?bn(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bn(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ov=dt(nv),lv=fe({},yo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pc=dt(lv),av=fe({},Hs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wh}),hv=dt(av),cv=fe({},Nr,{propertyName:0,elapsedTime:0,pseudoElement:0}),uv=dt(cv),dv=fe({},yo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),fv=dt(dv),_v=[9,13,27,32],Ch=Zt&&"CompositionEvent"in window,cs=null;Zt&&"documentMode"in document&&(cs=document.documentMode);var pv=Zt&&"TextEvent"in window&&!cs,gf=Zt&&(!Ch||cs&&8<cs&&11>=cs),Mc=" ",Bc=!1;function Sf(e,t){switch(e){case"keyup":return _v.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ar=!1;function mv(e,t){switch(e){case"compositionend":return yf(t);case"keypress":return t.which!==32?null:(Bc=!0,Mc);case"textInput":return e=t.data,e===Mc&&Bc?null:e;default:return null}}function vv(e,t){if(ar)return e==="compositionend"||!Ch&&Sf(e,t)?(e=vf(),kn=Sh=vi=null,ar=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return gf&&t.locale!=="ko"?null:t.data;default:return null}}var gv={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 Tc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!gv[e.type]:t==="textarea"}function wf(e,t,i,r){Qd(r),t=qn(t,"onChange"),0<t.length&&(i=new yh("onChange","change",null,i,r),e.push({event:i,listeners:t}))}var us=null,ks=null;function Sv(e){Bf(e,0)}function wo(e){var t=ur(e);if(Ud(t))return e}function yv(e,t){if(e==="change")return t}var Cf=!1;if(Zt){var Go;if(Zt){var Qo="oninput"in document;if(!Qo){var Nc=document.createElement("div");Nc.setAttribute("oninput","return;"),Qo=typeof Nc.oninput=="function"}Go=Qo}else Go=!1;Cf=Go&&(!document.documentMode||9<document.documentMode)}function Oc(){us&&(us.detachEvent("onpropertychange",xf),ks=us=null)}function xf(e){if(e.propertyName==="value"&&wo(ks)){var t=[];wf(t,ks,e,_h(e)),tf(Sv,t)}}function wv(e,t,i){e==="focusin"?(Oc(),us=t,ks=i,us.attachEvent("onpropertychange",xf)):e==="focusout"&&Oc()}function Cv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return wo(ks)}function xv(e,t){if(e==="click")return wo(t)}function kv(e,t){if(e==="input"||e==="change")return wo(t)}function bv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tt=typeof Object.is=="function"?Object.is:bv;function bs(e,t){if(Tt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(r=0;r<i.length;r++){var s=i[r];if(!Dl.call(t,s)||!Tt(e[s],t[s]))return!1}return!0}function Ac(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ic(e,t){var i=Ac(e);e=0;for(var r;i;){if(i.nodeType===3){if(r=e+i.textContent.length,e<=t&&r>=t)return{node:i,offset:t-e};e=r}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Ac(i)}}function kf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bf(){for(var e=window,t=Fn();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Fn(e.document)}return t}function xh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Ev(e){var t=bf(),i=e.focusedElem,r=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&kf(i.ownerDocument.documentElement,i)){if(r!==null&&xh(i)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if(e=(t=i.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=i.textContent.length,n=Math.min(r.start,s);r=r.end===void 0?n:Math.min(r.end,s),!e.extend&&n>r&&(s=r,r=n,n=s),s=Ic(i,n);var o=Ic(i,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),n>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=i;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<t.length;i++)e=t[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Dv=Zt&&"documentMode"in document&&11>=document.documentMode,hr=null,Vl=null,ds=null,ql=!1;function zc(e,t,i){var r=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;ql||hr==null||hr!==Fn(r)||(r=hr,"selectionStart"in r&&xh(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}),ds&&bs(ds,r)||(ds=r,r=qn(Vl,"onSelect"),0<r.length&&(t=new yh("onSelect","select",null,t,i),e.push({event:t,listeners:r}),t.target=hr)))}function nn(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var cr={animationend:nn("Animation","AnimationEnd"),animationiteration:nn("Animation","AnimationIteration"),animationstart:nn("Animation","AnimationStart"),transitionend:nn("Transition","TransitionEnd")},Jo={},Ef={};Zt&&(Ef=document.createElement("div").style,"AnimationEvent"in window||(delete cr.animationend.animation,delete cr.animationiteration.animation,delete cr.animationstart.animation),"TransitionEvent"in window||delete cr.transitionend.transition);function Co(e){if(Jo[e])return Jo[e];if(!cr[e])return e;var t=cr[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Ef)return Jo[e]=t[i];return e}var Df=Co("animationend"),Lf=Co("animationiteration"),Rf=Co("animationstart"),Pf=Co("transitionend"),Mf=new Map,$c="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 Mi(e,t){Mf.set(e,t),er(t,[e])}for(var Zo=0;Zo<$c.length;Zo++){var el=$c[Zo],Lv=el.toLowerCase(),Rv=el[0].toUpperCase()+el.slice(1);Mi(Lv,"on"+Rv)}Mi(Df,"onAnimationEnd");Mi(Lf,"onAnimationIteration");Mi(Rf,"onAnimationStart");Mi("dblclick","onDoubleClick");Mi("focusin","onFocus");Mi("focusout","onBlur");Mi(Pf,"onTransitionEnd");br("onMouseEnter",["mouseout","mouseover"]);br("onMouseLeave",["mouseout","mouseover"]);br("onPointerEnter",["pointerout","pointerover"]);br("onPointerLeave",["pointerout","pointerover"]);er("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));er("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));er("onBeforeInput",["compositionend","keypress","textInput","paste"]);er("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));er("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));er("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var is="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(" "),Pv=new Set("cancel close invalid load scroll toggle".split(" ").concat(is));function Fc(e,t,i){var r=e.type||"unknown-event";e.currentTarget=i,Lm(r,t,void 0,e),e.currentTarget=null}function Bf(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var r=e[i],s=r.event;r=r.listeners;e:{var n=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],h=l.instance,a=l.currentTarget;if(l=l.listener,h!==n&&s.isPropagationStopped())break e;Fc(s,l,a),n=h}else for(o=0;o<r.length;o++){if(l=r[o],h=l.instance,a=l.currentTarget,l=l.listener,h!==n&&s.isPropagationStopped())break e;Fc(s,l,a),n=h}}}if(Wn)throw e=Wl,Wn=!1,Wl=null,e}function se(e,t){var i=t[Jl];i===void 0&&(i=t[Jl]=new Set);var r=e+"__bubble";i.has(r)||(Tf(t,e,2,!1),i.add(r))}function tl(e,t,i){var r=0;t&&(r|=4),Tf(i,e,r,t)}var on="_reactListening"+Math.random().toString(36).slice(2);function Es(e){if(!e[on]){e[on]=!0,$d.forEach(function(i){i!=="selectionchange"&&(Pv.has(i)||tl(i,!1,e),tl(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[on]||(t[on]=!0,tl("selectionchange",!1,t))}}function Tf(e,t,i,r){switch(mf(t)){case 1:var s=Um;break;case 4:s=Km;break;default:s=gh}i=s.bind(null,t,i,e),s=void 0,!Hl||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,i,{capture:!0,passive:s}):e.addEventListener(t,i,!0):s!==void 0?e.addEventListener(t,i,{passive:s}):e.addEventListener(t,i,!1)}function il(e,t,i,r,s){var n=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.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(;l!==null;){if(o=Fi(l),o===null)return;if(h=o.tag,h===5||h===6){r=n=o;continue e}l=l.parentNode}}r=r.return}tf(function(){var a=n,d=_h(i),c=[];e:{var f=Mf.get(e);if(f!==void 0){var u=yh,m=e;switch(e){case"keypress":if(bn(i)===0)break e;case"keydown":case"keyup":u=ov;break;case"focusin":m="focus",u=Xo;break;case"focusout":m="blur",u=Xo;break;case"beforeblur":case"afterblur":u=Xo;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":u=Lc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":u=Ym;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":u=hv;break;case Df:case Lf:case Rf:u=Qm;break;case Pf:u=uv;break;case"scroll":u=Vm;break;case"wheel":u=fv;break;case"copy":case"cut":case"paste":u=Zm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":u=Pc}var S=(t&4)!==0,w=!S&&e==="scroll",p=S?f!==null?f+"Capture":null:f;S=[];for(var _=a,v;_!==null;){v=_;var y=v.stateNode;if(v.tag===5&&y!==null&&(v=y,p!==null&&(y=ys(_,p),y!=null&&S.push(Ds(_,y,v)))),w)break;_=_.return}0<S.length&&(f=new u(f,m,null,i,d),c.push({event:f,listeners:S}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",u=e==="mouseout"||e==="pointerout",f&&i!==$l&&(m=i.relatedTarget||i.fromElement)&&(Fi(m)||m[ei]))break e;if((u||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,u?(m=i.relatedTarget||i.toElement,u=a,m=m?Fi(m):null,m!==null&&(w=tr(m),m!==w||m.tag!==5&&m.tag!==6)&&(m=null)):(u=null,m=a),u!==m)){if(S=Lc,y="onMouseLeave",p="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(S=Pc,y="onPointerLeave",p="onPointerEnter",_="pointer"),w=u==null?f:ur(u),v=m==null?f:ur(m),f=new S(y,_+"leave",u,i,d),f.target=w,f.relatedTarget=v,y=null,Fi(d)===a&&(S=new S(p,_+"enter",m,i,d),S.target=v,S.relatedTarget=w,y=S),w=y,u&&m)t:{for(S=u,p=m,_=0,v=S;v;v=rr(v))_++;for(v=0,y=p;y;y=rr(y))v++;for(;0<_-v;)S=rr(S),_--;for(;0<v-_;)p=rr(p),v--;for(;_--;){if(S===p||p!==null&&S===p.alternate)break t;S=rr(S),p=rr(p)}S=null}else S=null;u!==null&&Hc(c,f,u,S,!1),m!==null&&w!==null&&Hc(c,w,m,S,!0)}}e:{if(f=a?ur(a):window,u=f.nodeName&&f.nodeName.toLowerCase(),u==="select"||u==="input"&&f.type==="file")var C=yv;else if(Tc(f))if(Cf)C=kv;else{C=Cv;var k=wv}else(u=f.nodeName)&&u.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=xv);if(C&&(C=C(e,a))){wf(c,C,i,d);break e}k&&k(e,f,a),e==="focusout"&&(k=f._wrapperState)&&k.controlled&&f.type==="number"&&Nl(f,"number",f.value)}switch(k=a?ur(a):window,e){case"focusin":(Tc(k)||k.contentEditable==="true")&&(hr=k,Vl=a,ds=null);break;case"focusout":ds=Vl=hr=null;break;case"mousedown":ql=!0;break;case"contextmenu":case"mouseup":case"dragend":ql=!1,zc(c,i,d);break;case"selectionchange":if(Dv)break;case"keydown":case"keyup":zc(c,i,d)}var L;if(Ch)e:{switch(e){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else ar?Sf(e,i)&&(M="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(M="onCompositionStart");M&&(gf&&i.locale!=="ko"&&(ar||M!=="onCompositionStart"?M==="onCompositionEnd"&&ar&&(L=vf()):(vi=d,Sh="value"in vi?vi.value:vi.textContent,ar=!0)),k=qn(a,M),0<k.length&&(M=new Rc(M,e,null,i,d),c.push({event:M,listeners:k}),L?M.data=L:(L=yf(i),L!==null&&(M.data=L)))),(L=pv?mv(e,i):vv(e,i))&&(a=qn(a,"onBeforeInput"),0<a.length&&(d=new Rc("onBeforeInput","beforeinput",null,i,d),c.push({event:d,listeners:a}),d.data=L))}Bf(c,t)})}function Ds(e,t,i){return{instance:e,listener:t,currentTarget:i}}function qn(e,t){for(var i=t+"Capture",r=[];e!==null;){var s=e,n=s.stateNode;s.tag===5&&n!==null&&(s=n,n=ys(e,i),n!=null&&r.unshift(Ds(e,n,s)),n=ys(e,t),n!=null&&r.push(Ds(e,n,s))),e=e.return}return r}function rr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Hc(e,t,i,r,s){for(var n=t._reactName,o=[];i!==null&&i!==r;){var l=i,h=l.alternate,a=l.stateNode;if(h!==null&&h===r)break;l.tag===5&&a!==null&&(l=a,s?(h=ys(i,n),h!=null&&o.unshift(Ds(i,h,l))):s||(h=ys(i,n),h!=null&&o.push(Ds(i,h,l)))),i=i.return}o.length!==0&&e.push({event:t,listeners:o})}var Mv=/\r\n?/g,Bv=/\u0000|\uFFFD/g;function Wc(e){return(typeof e=="string"?e:""+e).replace(Mv,`
38
+ `).replace(Bv,"")}function ln(e,t,i){if(t=Wc(t),Wc(e)!==t&&i)throw Error(B(425))}function Yn(){}var Yl=null,Xl=null;function Gl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ql=typeof setTimeout=="function"?setTimeout:void 0,Tv=typeof clearTimeout=="function"?clearTimeout:void 0,jc=typeof Promise=="function"?Promise:void 0,Nv=typeof queueMicrotask=="function"?queueMicrotask:typeof jc<"u"?function(e){return jc.resolve(null).then(e).catch(Ov)}:Ql;function Ov(e){setTimeout(function(){throw e})}function rl(e,t){var i=t,r=0;do{var s=i.nextSibling;if(e.removeChild(i),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(r===0){e.removeChild(s),xs(t);return}r--}else i!=="$"&&i!=="$?"&&i!=="$!"||r++;i=s}while(i);xs(t)}function xi(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Uc(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(t===0)return e;t--}else i==="/$"&&t++}e=e.previousSibling}return null}var Or=Math.random().toString(36).slice(2),$t="__reactFiber$"+Or,Ls="__reactProps$"+Or,ei="__reactContainer$"+Or,Jl="__reactEvents$"+Or,Av="__reactListeners$"+Or,Iv="__reactHandles$"+Or;function Fi(e){var t=e[$t];if(t)return t;for(var i=e.parentNode;i;){if(t=i[ei]||i[$t]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Uc(e);e!==null;){if(i=e[$t])return i;e=Uc(e)}return t}e=i,i=e.parentNode}return null}function Ws(e){return e=e[$t]||e[ei],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ur(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(B(33))}function xo(e){return e[Ls]||null}var Zl=[],dr=-1;function Bi(e){return{current:e}}function oe(e){0>dr||(e.current=Zl[dr],Zl[dr]=null,dr--)}function re(e,t){dr++,Zl[dr]=e.current,e.current=t}var Pi={},Ke=Bi(Pi),it=Bi(!1),qi=Pi;function Er(e,t){var i=e.type.contextTypes;if(!i)return Pi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},n;for(n in i)s[n]=t[n];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function rt(e){return e=e.childContextTypes,e!=null}function Xn(){oe(it),oe(Ke)}function Kc(e,t,i){if(Ke.current!==Pi)throw Error(B(168));re(Ke,t),re(it,i)}function Nf(e,t,i){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return i;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(B(108,wm(e)||"Unknown",s));return fe({},i,r)}function Gn(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Pi,qi=Ke.current,re(Ke,e),re(it,it.current),!0}function Vc(e,t,i){var r=e.stateNode;if(!r)throw Error(B(169));i?(e=Nf(e,t,qi),r.__reactInternalMemoizedMergedChildContext=e,oe(it),oe(Ke),re(Ke,e)):oe(it),re(it,i)}var qt=null,ko=!1,sl=!1;function Of(e){qt===null?qt=[e]:qt.push(e)}function zv(e){ko=!0,Of(e)}function Ti(){if(!sl&&qt!==null){sl=!0;var e=0,t=te;try{var i=qt;for(te=1;e<i.length;e++){var r=i[e];do r=r(!0);while(r!==null)}qt=null,ko=!1}catch(s){throw qt!==null&&(qt=qt.slice(e+1)),of(ph,Ti),s}finally{te=t,sl=!1}}return null}var fr=[],_r=0,Qn=null,Jn=0,vt=[],gt=0,Yi=null,Xt=1,Gt="";function Ai(e,t){fr[_r++]=Jn,fr[_r++]=Qn,Qn=e,Jn=t}function Af(e,t,i){vt[gt++]=Xt,vt[gt++]=Gt,vt[gt++]=Yi,Yi=e;var r=Xt;e=Gt;var s=32-Mt(r)-1;r&=~(1<<s),i+=1;var n=32-Mt(t)+s;if(30<n){var o=s-s%5;n=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Xt=1<<32-Mt(t)+s|i<<s|r,Gt=n+e}else Xt=1<<n|i<<s|r,Gt=e}function kh(e){e.return!==null&&(Ai(e,1),Af(e,1,0))}function bh(e){for(;e===Qn;)Qn=fr[--_r],fr[_r]=null,Jn=fr[--_r],fr[_r]=null;for(;e===Yi;)Yi=vt[--gt],vt[gt]=null,Gt=vt[--gt],vt[gt]=null,Xt=vt[--gt],vt[gt]=null}var ht=null,at=null,le=!1,Rt=null;function If(e,t){var i=St(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,t=e.deletions,t===null?(e.deletions=[i],e.flags|=16):t.push(i)}function qc(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,ht=e,at=xi(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ht=e,at=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(i=Yi!==null?{id:Xt,overflow:Gt}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},i=St(18,null,null,0),i.stateNode=t,i.return=e,e.child=i,ht=e,at=null,!0):!1;default:return!1}}function ea(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ta(e){if(le){var t=at;if(t){var i=t;if(!qc(e,t)){if(ea(e))throw Error(B(418));t=xi(i.nextSibling);var r=ht;t&&qc(e,t)?If(r,i):(e.flags=e.flags&-4097|2,le=!1,ht=e)}}else{if(ea(e))throw Error(B(418));e.flags=e.flags&-4097|2,le=!1,ht=e}}}function Yc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ht=e}function an(e){if(e!==ht)return!1;if(!le)return Yc(e),le=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Gl(e.type,e.memoizedProps)),t&&(t=at)){if(ea(e))throw zf(),Error(B(418));for(;t;)If(e,t),t=xi(t.nextSibling)}if(Yc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(B(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(t===0){at=xi(e.nextSibling);break e}t--}else i!=="$"&&i!=="$!"&&i!=="$?"||t++}e=e.nextSibling}at=null}}else at=ht?xi(e.stateNode.nextSibling):null;return!0}function zf(){for(var e=at;e;)e=xi(e.nextSibling)}function Dr(){at=ht=null,le=!1}function Eh(e){Rt===null?Rt=[e]:Rt.push(e)}var $v=ri.ReactCurrentBatchConfig;function Ur(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(B(309));var r=i.stateNode}if(!r)throw Error(B(147,e));var s=r,n=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===n?t.ref:(t=function(o){var l=s.refs;o===null?delete l[n]:l[n]=o},t._stringRef=n,t)}if(typeof e!="string")throw Error(B(284));if(!i._owner)throw Error(B(290,e))}return e}function hn(e,t){throw e=Object.prototype.toString.call(t),Error(B(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Xc(e){var t=e._init;return t(e._payload)}function $f(e){function t(p,_){if(e){var v=p.deletions;v===null?(p.deletions=[_],p.flags|=16):v.push(_)}}function i(p,_){if(!e)return null;for(;_!==null;)t(p,_),_=_.sibling;return null}function r(p,_){for(p=new Map;_!==null;)_.key!==null?p.set(_.key,_):p.set(_.index,_),_=_.sibling;return p}function s(p,_){return p=Di(p,_),p.index=0,p.sibling=null,p}function n(p,_,v){return p.index=v,e?(v=p.alternate,v!==null?(v=v.index,v<_?(p.flags|=2,_):v):(p.flags|=2,_)):(p.flags|=1048576,_)}function o(p){return e&&p.alternate===null&&(p.flags|=2),p}function l(p,_,v,y){return _===null||_.tag!==6?(_=ul(v,p.mode,y),_.return=p,_):(_=s(_,v),_.return=p,_)}function h(p,_,v,y){var C=v.type;return C===lr?d(p,_,v.props.children,y,v.key):_!==null&&(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===di&&Xc(C)===_.type)?(y=s(_,v.props),y.ref=Ur(p,_,v),y.return=p,y):(y=Bn(v.type,v.key,v.props,null,p.mode,y),y.ref=Ur(p,_,v),y.return=p,y)}function a(p,_,v,y){return _===null||_.tag!==4||_.stateNode.containerInfo!==v.containerInfo||_.stateNode.implementation!==v.implementation?(_=dl(v,p.mode,y),_.return=p,_):(_=s(_,v.children||[]),_.return=p,_)}function d(p,_,v,y,C){return _===null||_.tag!==7?(_=Ki(v,p.mode,y,C),_.return=p,_):(_=s(_,v),_.return=p,_)}function c(p,_,v){if(typeof _=="string"&&_!==""||typeof _=="number")return _=ul(""+_,p.mode,v),_.return=p,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Qs:return v=Bn(_.type,_.key,_.props,null,p.mode,v),v.ref=Ur(p,null,_),v.return=p,v;case or:return _=dl(_,p.mode,v),_.return=p,_;case di:var y=_._init;return c(p,y(_._payload),v)}if(es(_)||$r(_))return _=Ki(_,p.mode,v,null),_.return=p,_;hn(p,_)}return null}function f(p,_,v,y){var C=_!==null?_.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return C!==null?null:l(p,_,""+v,y);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Qs:return v.key===C?h(p,_,v,y):null;case or:return v.key===C?a(p,_,v,y):null;case di:return C=v._init,f(p,_,C(v._payload),y)}if(es(v)||$r(v))return C!==null?null:d(p,_,v,y,null);hn(p,v)}return null}function u(p,_,v,y,C){if(typeof y=="string"&&y!==""||typeof y=="number")return p=p.get(v)||null,l(_,p,""+y,C);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Qs:return p=p.get(y.key===null?v:y.key)||null,h(_,p,y,C);case or:return p=p.get(y.key===null?v:y.key)||null,a(_,p,y,C);case di:var k=y._init;return u(p,_,v,k(y._payload),C)}if(es(y)||$r(y))return p=p.get(v)||null,d(_,p,y,C,null);hn(_,y)}return null}function m(p,_,v,y){for(var C=null,k=null,L=_,M=_=0,V=null;L!==null&&M<v.length;M++){L.index>M?(V=L,L=null):V=L.sibling;var W=f(p,L,v[M],y);if(W===null){L===null&&(L=V);break}e&&L&&W.alternate===null&&t(p,L),_=n(W,_,M),k===null?C=W:k.sibling=W,k=W,L=V}if(M===v.length)return i(p,L),le&&Ai(p,M),C;if(L===null){for(;M<v.length;M++)L=c(p,v[M],y),L!==null&&(_=n(L,_,M),k===null?C=L:k.sibling=L,k=L);return le&&Ai(p,M),C}for(L=r(p,L);M<v.length;M++)V=u(L,p,M,v[M],y),V!==null&&(e&&V.alternate!==null&&L.delete(V.key===null?M:V.key),_=n(V,_,M),k===null?C=V:k.sibling=V,k=V);return e&&L.forEach(function(U){return t(p,U)}),le&&Ai(p,M),C}function S(p,_,v,y){var C=$r(v);if(typeof C!="function")throw Error(B(150));if(v=C.call(v),v==null)throw Error(B(151));for(var k=C=null,L=_,M=_=0,V=null,W=v.next();L!==null&&!W.done;M++,W=v.next()){L.index>M?(V=L,L=null):V=L.sibling;var U=f(p,L,W.value,y);if(U===null){L===null&&(L=V);break}e&&L&&U.alternate===null&&t(p,L),_=n(U,_,M),k===null?C=U:k.sibling=U,k=U,L=V}if(W.done)return i(p,L),le&&Ai(p,M),C;if(L===null){for(;!W.done;M++,W=v.next())W=c(p,W.value,y),W!==null&&(_=n(W,_,M),k===null?C=W:k.sibling=W,k=W);return le&&Ai(p,M),C}for(L=r(p,L);!W.done;M++,W=v.next())W=u(L,p,M,W.value,y),W!==null&&(e&&W.alternate!==null&&L.delete(W.key===null?M:W.key),_=n(W,_,M),k===null?C=W:k.sibling=W,k=W);return e&&L.forEach(function(A){return t(p,A)}),le&&Ai(p,M),C}function w(p,_,v,y){if(typeof v=="object"&&v!==null&&v.type===lr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Qs:e:{for(var C=v.key,k=_;k!==null;){if(k.key===C){if(C=v.type,C===lr){if(k.tag===7){i(p,k.sibling),_=s(k,v.props.children),_.return=p,p=_;break e}}else if(k.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===di&&Xc(C)===k.type){i(p,k.sibling),_=s(k,v.props),_.ref=Ur(p,k,v),_.return=p,p=_;break e}i(p,k);break}else t(p,k);k=k.sibling}v.type===lr?(_=Ki(v.props.children,p.mode,y,v.key),_.return=p,p=_):(y=Bn(v.type,v.key,v.props,null,p.mode,y),y.ref=Ur(p,_,v),y.return=p,p=y)}return o(p);case or:e:{for(k=v.key;_!==null;){if(_.key===k)if(_.tag===4&&_.stateNode.containerInfo===v.containerInfo&&_.stateNode.implementation===v.implementation){i(p,_.sibling),_=s(_,v.children||[]),_.return=p,p=_;break e}else{i(p,_);break}else t(p,_);_=_.sibling}_=dl(v,p.mode,y),_.return=p,p=_}return o(p);case di:return k=v._init,w(p,_,k(v._payload),y)}if(es(v))return m(p,_,v,y);if($r(v))return S(p,_,v,y);hn(p,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,_!==null&&_.tag===6?(i(p,_.sibling),_=s(_,v),_.return=p,p=_):(i(p,_),_=ul(v,p.mode,y),_.return=p,p=_),o(p)):i(p,_)}return w}var Lr=$f(!0),Ff=$f(!1),Zn=Bi(null),eo=null,pr=null,Dh=null;function Lh(){Dh=pr=eo=null}function Rh(e){var t=Zn.current;oe(Zn),e._currentValue=t}function ia(e,t,i){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===i)break;e=e.return}}function xr(e,t){eo=e,Dh=pr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(tt=!0),e.firstContext=null)}function xt(e){var t=e._currentValue;if(Dh!==e)if(e={context:e,memoizedValue:t,next:null},pr===null){if(eo===null)throw Error(B(308));pr=e,eo.dependencies={lanes:0,firstContext:e}}else pr=pr.next=e;return t}var Hi=null;function Ph(e){Hi===null?Hi=[e]:Hi.push(e)}function Hf(e,t,i,r){var s=t.interleaved;return s===null?(i.next=i,Ph(t)):(i.next=s.next,s.next=i),t.interleaved=i,ti(e,r)}function ti(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var fi=!1;function Mh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Wf(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Jt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ki(e,t,i){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Q&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,ti(e,i)}return s=r.interleaved,s===null?(t.next=t,Ph(r)):(t.next=s.next,s.next=t),r.interleaved=t,ti(e,i)}function En(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,i|=r,t.lanes=i,mh(e,i)}}function Gc(e,t){var i=e.updateQueue,r=e.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=t:n=n.next=t}else s=n=t;i={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:r.shared,effects:r.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function to(e,t,i,r){var s=e.updateQueue;fi=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var h=l,a=h.next;h.next=null,o===null?n=a:o.next=a,o=h;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=a:l.next=a,d.lastBaseUpdate=h))}if(n!==null){var c=s.baseState;o=0,d=a=h=null,l=n;do{var f=l.lane,u=l.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:u,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,S=l;switch(f=t,u=i,S.tag){case 1:if(m=S.payload,typeof m=="function"){c=m.call(u,c,f);break e}c=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=S.payload,f=typeof m=="function"?m.call(u,c,f):m,f==null)break e;c=fe({},c,f);break e;case 2:fi=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else u={eventTime:u,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(a=d=u,h=c):d=d.next=u,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(h=c),s.baseState=h,s.firstBaseUpdate=a,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else n===null&&(s.shared.lanes=0);Gi|=o,e.lanes=o,e.memoizedState=c}}function Qc(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=i,typeof s!="function")throw Error(B(191,s));s.call(r)}}}var js={},Wt=Bi(js),Rs=Bi(js),Ps=Bi(js);function Wi(e){if(e===js)throw Error(B(174));return e}function Bh(e,t){switch(re(Ps,t),re(Rs,e),re(Wt,js),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Al(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Al(t,e)}oe(Wt),re(Wt,t)}function Rr(){oe(Wt),oe(Rs),oe(Ps)}function jf(e){Wi(Ps.current);var t=Wi(Wt.current),i=Al(t,e.type);t!==i&&(re(Rs,e),re(Wt,i))}function Th(e){Rs.current===e&&(oe(Wt),oe(Rs))}var ue=Bi(0);function io(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var nl=[];function Nh(){for(var e=0;e<nl.length;e++)nl[e]._workInProgressVersionPrimary=null;nl.length=0}var Dn=ri.ReactCurrentDispatcher,ol=ri.ReactCurrentBatchConfig,Xi=0,de=null,be=null,Re=null,ro=!1,fs=!1,Ms=0,Fv=0;function He(){throw Error(B(321))}function Oh(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Tt(e[i],t[i]))return!1;return!0}function Ah(e,t,i,r,s,n){if(Xi=n,de=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Dn.current=e===null||e.memoizedState===null?Uv:Kv,e=i(r,s),fs){n=0;do{if(fs=!1,Ms=0,25<=n)throw Error(B(301));n+=1,Re=be=null,t.updateQueue=null,Dn.current=Vv,e=i(r,s)}while(fs)}if(Dn.current=so,t=be!==null&&be.next!==null,Xi=0,Re=be=de=null,ro=!1,t)throw Error(B(300));return e}function Ih(){var e=Ms!==0;return Ms=0,e}function zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Re===null?de.memoizedState=Re=e:Re=Re.next=e,Re}function kt(){if(be===null){var e=de.alternate;e=e!==null?e.memoizedState:null}else e=be.next;var t=Re===null?de.memoizedState:Re.next;if(t!==null)Re=t,be=e;else{if(e===null)throw Error(B(310));be=e,e={memoizedState:be.memoizedState,baseState:be.baseState,baseQueue:be.baseQueue,queue:be.queue,next:null},Re===null?de.memoizedState=Re=e:Re=Re.next=e}return Re}function Bs(e,t){return typeof t=="function"?t(e):t}function ll(e){var t=kt(),i=t.queue;if(i===null)throw Error(B(311));i.lastRenderedReducer=e;var r=be,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 l=o=null,h=null,a=n;do{var d=a.lane;if((Xi&d)===d)h!==null&&(h=h.next={lane:0,action:a.action,hasEagerState:a.hasEagerState,eagerState:a.eagerState,next:null}),r=a.hasEagerState?a.eagerState:e(r,a.action);else{var c={lane:d,action:a.action,hasEagerState:a.hasEagerState,eagerState:a.eagerState,next:null};h===null?(l=h=c,o=r):h=h.next=c,de.lanes|=d,Gi|=d}a=a.next}while(a!==null&&a!==n);h===null?o=r:h.next=l,Tt(r,t.memoizedState)||(tt=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=h,i.lastRenderedState=r}if(e=i.interleaved,e!==null){s=e;do n=s.lane,de.lanes|=n,Gi|=n,s=s.next;while(s!==e)}else s===null&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function al(e){var t=kt(),i=t.queue;if(i===null)throw Error(B(311));i.lastRenderedReducer=e;var r=i.dispatch,s=i.pending,n=t.memoizedState;if(s!==null){i.pending=null;var o=s=s.next;do n=e(n,o.action),o=o.next;while(o!==s);Tt(n,t.memoizedState)||(tt=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),i.lastRenderedState=n}return[n,r]}function Uf(){}function Kf(e,t){var i=de,r=kt(),s=t(),n=!Tt(r.memoizedState,s);if(n&&(r.memoizedState=s,tt=!0),r=r.queue,zh(Yf.bind(null,i,r,e),[e]),r.getSnapshot!==t||n||Re!==null&&Re.memoizedState.tag&1){if(i.flags|=2048,Ts(9,qf.bind(null,i,r,s,t),void 0,null),Te===null)throw Error(B(349));Xi&30||Vf(i,t,s)}return s}function Vf(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=de.updateQueue,t===null?(t={lastEffect:null,stores:null},de.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function qf(e,t,i,r){t.value=i,t.getSnapshot=r,Xf(t)&&Gf(e)}function Yf(e,t,i){return i(function(){Xf(t)&&Gf(e)})}function Xf(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Tt(e,i)}catch{return!0}}function Gf(e){var t=ti(e,1);t!==null&&Bt(t,e,1,-1)}function Jc(e){var t=zt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:e},t.queue=e,e=e.dispatch=jv.bind(null,de,e),[t.memoizedState,e]}function Ts(e,t,i,r){return e={tag:e,create:t,destroy:i,deps:r,next:null},t=de.updateQueue,t===null?(t={lastEffect:null,stores:null},de.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(r=i.next,i.next=e,e.next=r,t.lastEffect=e)),e}function Qf(){return kt().memoizedState}function Ln(e,t,i,r){var s=zt();de.flags|=e,s.memoizedState=Ts(1|t,i,void 0,r===void 0?null:r)}function bo(e,t,i,r){var s=kt();r=r===void 0?null:r;var n=void 0;if(be!==null){var o=be.memoizedState;if(n=o.destroy,r!==null&&Oh(r,o.deps)){s.memoizedState=Ts(t,i,n,r);return}}de.flags|=e,s.memoizedState=Ts(1|t,i,n,r)}function Zc(e,t){return Ln(8390656,8,e,t)}function zh(e,t){return bo(2048,8,e,t)}function Jf(e,t){return bo(4,2,e,t)}function Zf(e,t){return bo(4,4,e,t)}function e_(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function t_(e,t,i){return i=i!=null?i.concat([e]):null,bo(4,4,e_.bind(null,t,e),i)}function $h(){}function i_(e,t){var i=kt();t=t===void 0?null:t;var r=i.memoizedState;return r!==null&&t!==null&&Oh(t,r[1])?r[0]:(i.memoizedState=[e,t],e)}function r_(e,t){var i=kt();t=t===void 0?null:t;var r=i.memoizedState;return r!==null&&t!==null&&Oh(t,r[1])?r[0]:(e=e(),i.memoizedState=[e,t],e)}function s_(e,t,i){return Xi&21?(Tt(i,t)||(i=hf(),de.lanes|=i,Gi|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,tt=!0),e.memoizedState=i)}function Hv(e,t){var i=te;te=i!==0&&4>i?i:4,e(!0);var r=ol.transition;ol.transition={};try{e(!1),t()}finally{te=i,ol.transition=r}}function n_(){return kt().memoizedState}function Wv(e,t,i){var r=Ei(e);if(i={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null},o_(e))l_(t,i);else if(i=Hf(e,t,i,r),i!==null){var s=Ye();Bt(i,e,r,s),a_(i,t,r)}}function jv(e,t,i){var r=Ei(e),s={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null};if(o_(e))l_(t,s);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var o=t.lastRenderedState,l=n(o,i);if(s.hasEagerState=!0,s.eagerState=l,Tt(l,o)){var h=t.interleaved;h===null?(s.next=s,Ph(t)):(s.next=h.next,h.next=s),t.interleaved=s;return}}catch{}finally{}i=Hf(e,t,s,r),i!==null&&(s=Ye(),Bt(i,e,r,s),a_(i,t,r))}}function o_(e){var t=e.alternate;return e===de||t!==null&&t===de}function l_(e,t){fs=ro=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function a_(e,t,i){if(i&4194240){var r=t.lanes;r&=e.pendingLanes,i|=r,t.lanes=i,mh(e,i)}}var so={readContext:xt,useCallback:He,useContext:He,useEffect:He,useImperativeHandle:He,useInsertionEffect:He,useLayoutEffect:He,useMemo:He,useReducer:He,useRef:He,useState:He,useDebugValue:He,useDeferredValue:He,useTransition:He,useMutableSource:He,useSyncExternalStore:He,useId:He,unstable_isNewReconciler:!1},Uv={readContext:xt,useCallback:function(e,t){return zt().memoizedState=[e,t===void 0?null:t],e},useContext:xt,useEffect:Zc,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Ln(4194308,4,e_.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Ln(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ln(4,2,e,t)},useMemo:function(e,t){var i=zt();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var r=zt();return t=i!==void 0?i(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Wv.bind(null,de,e),[r.memoizedState,e]},useRef:function(e){var t=zt();return e={current:e},t.memoizedState=e},useState:Jc,useDebugValue:$h,useDeferredValue:function(e){return zt().memoizedState=e},useTransition:function(){var e=Jc(!1),t=e[0];return e=Hv.bind(null,e[1]),zt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var r=de,s=zt();if(le){if(i===void 0)throw Error(B(407));i=i()}else{if(i=t(),Te===null)throw Error(B(349));Xi&30||Vf(r,t,i)}s.memoizedState=i;var n={value:i,getSnapshot:t};return s.queue=n,Zc(Yf.bind(null,r,n,e),[e]),r.flags|=2048,Ts(9,qf.bind(null,r,n,i,t),void 0,null),i},useId:function(){var e=zt(),t=Te.identifierPrefix;if(le){var i=Gt,r=Xt;i=(r&~(1<<32-Mt(r)-1)).toString(32)+i,t=":"+t+"R"+i,i=Ms++,0<i&&(t+="H"+i.toString(32)),t+=":"}else i=Fv++,t=":"+t+"r"+i.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Kv={readContext:xt,useCallback:i_,useContext:xt,useEffect:zh,useImperativeHandle:t_,useInsertionEffect:Jf,useLayoutEffect:Zf,useMemo:r_,useReducer:ll,useRef:Qf,useState:function(){return ll(Bs)},useDebugValue:$h,useDeferredValue:function(e){var t=kt();return s_(t,be.memoizedState,e)},useTransition:function(){var e=ll(Bs)[0],t=kt().memoizedState;return[e,t]},useMutableSource:Uf,useSyncExternalStore:Kf,useId:n_,unstable_isNewReconciler:!1},Vv={readContext:xt,useCallback:i_,useContext:xt,useEffect:zh,useImperativeHandle:t_,useInsertionEffect:Jf,useLayoutEffect:Zf,useMemo:r_,useReducer:al,useRef:Qf,useState:function(){return al(Bs)},useDebugValue:$h,useDeferredValue:function(e){var t=kt();return be===null?t.memoizedState=e:s_(t,be.memoizedState,e)},useTransition:function(){var e=al(Bs)[0],t=kt().memoizedState;return[e,t]},useMutableSource:Uf,useSyncExternalStore:Kf,useId:n_,unstable_isNewReconciler:!1};function Dt(e,t){if(e&&e.defaultProps){t=fe({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i]);return t}return t}function ra(e,t,i,r){t=e.memoizedState,i=i(r,t),i=i==null?t:fe({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Eo={isMounted:function(e){return(e=e._reactInternals)?tr(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternals;var r=Ye(),s=Ei(e),n=Jt(r,s);n.payload=t,i!=null&&(n.callback=i),t=ki(e,n,s),t!==null&&(Bt(t,e,s,r),En(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var r=Ye(),s=Ei(e),n=Jt(r,s);n.tag=1,n.payload=t,i!=null&&(n.callback=i),t=ki(e,n,s),t!==null&&(Bt(t,e,s,r),En(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Ye(),r=Ei(e),s=Jt(i,r);s.tag=2,t!=null&&(s.callback=t),t=ki(e,s,r),t!==null&&(Bt(t,e,r,i),En(t,e,r))}};function eu(e,t,i,r,s,n,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,n,o):t.prototype&&t.prototype.isPureReactComponent?!bs(i,r)||!bs(s,n):!0}function h_(e,t,i){var r=!1,s=Pi,n=t.contextType;return typeof n=="object"&&n!==null?n=xt(n):(s=rt(t)?qi:Ke.current,r=t.contextTypes,n=(r=r!=null)?Er(e,s):Pi),t=new t(i,n),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Eo,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=n),t}function tu(e,t,i,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,r),t.state!==e&&Eo.enqueueReplaceState(t,t.state,null)}function sa(e,t,i,r){var s=e.stateNode;s.props=i,s.state=e.memoizedState,s.refs={},Mh(e);var n=t.contextType;typeof n=="object"&&n!==null?s.context=xt(n):(n=rt(t)?qi:Ke.current,s.context=Er(e,n)),s.state=e.memoizedState,n=t.getDerivedStateFromProps,typeof n=="function"&&(ra(e,t,n,i),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Eo.enqueueReplaceState(s,s.state,null),to(e,i,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Pr(e,t){try{var i="",r=t;do i+=ym(r),r=r.return;while(r);var s=i}catch(n){s=`
39
+ Error generating stack: `+n.message+`
40
+ `+n.stack}return{value:e,source:t,stack:s,digest:null}}function hl(e,t,i){return{value:e,source:null,stack:i??null,digest:t??null}}function na(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var qv=typeof WeakMap=="function"?WeakMap:Map;function c_(e,t,i){i=Jt(-1,i),i.tag=3,i.payload={element:null};var r=t.value;return i.callback=function(){oo||(oo=!0,pa=r),na(e,t)},i}function u_(e,t,i){i=Jt(-1,i),i.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;i.payload=function(){return r(s)},i.callback=function(){na(e,t)}}var n=e.stateNode;return n!==null&&typeof n.componentDidCatch=="function"&&(i.callback=function(){na(e,t),typeof r!="function"&&(bi===null?bi=new Set([this]):bi.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),i}function iu(e,t,i){var r=e.pingCache;if(r===null){r=e.pingCache=new qv;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(i)||(s.add(i),e=lg.bind(null,e,t,i),t.then(e,e))}function ru(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function su(e,t,i,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(t=Jt(-1,1),t.tag=2,ki(i,t,1))),i.lanes|=1),e)}var Yv=ri.ReactCurrentOwner,tt=!1;function qe(e,t,i,r){t.child=e===null?Ff(t,null,i,r):Lr(t,e.child,i,r)}function nu(e,t,i,r,s){i=i.render;var n=t.ref;return xr(t,s),r=Ah(e,t,i,r,n,s),i=Ih(),e!==null&&!tt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ii(e,t,s)):(le&&i&&kh(t),t.flags|=1,qe(e,t,r,s),t.child)}function ou(e,t,i,r,s){if(e===null){var n=i.type;return typeof n=="function"&&!qh(n)&&n.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=n,d_(e,t,n,r,s)):(e=Bn(i.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!(e.lanes&s)){var o=n.memoizedProps;if(i=i.compare,i=i!==null?i:bs,i(o,r)&&e.ref===t.ref)return ii(e,t,s)}return t.flags|=1,e=Di(n,r),e.ref=t.ref,e.return=t,t.child=e}function d_(e,t,i,r,s){if(e!==null){var n=e.memoizedProps;if(bs(n,r)&&e.ref===t.ref)if(tt=!1,t.pendingProps=r=n,(e.lanes&s)!==0)e.flags&131072&&(tt=!0);else return t.lanes=e.lanes,ii(e,t,s)}return oa(e,t,i,r,s)}function f_(e,t,i){var r=t.pendingProps,s=r.children,n=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},re(vr,lt),lt|=i;else{if(!(i&1073741824))return e=n!==null?n.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,re(vr,lt),lt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=n!==null?n.baseLanes:i,re(vr,lt),lt|=r}else n!==null?(r=n.baseLanes|i,t.memoizedState=null):r=i,re(vr,lt),lt|=r;return qe(e,t,s,i),t.child}function __(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function oa(e,t,i,r,s){var n=rt(i)?qi:Ke.current;return n=Er(t,n),xr(t,s),i=Ah(e,t,i,r,n,s),r=Ih(),e!==null&&!tt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ii(e,t,s)):(le&&r&&kh(t),t.flags|=1,qe(e,t,i,s),t.child)}function lu(e,t,i,r,s){if(rt(i)){var n=!0;Gn(t)}else n=!1;if(xr(t,s),t.stateNode===null)Rn(e,t),h_(t,i,r),sa(t,i,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var h=o.context,a=i.contextType;typeof a=="object"&&a!==null?a=xt(a):(a=rt(i)?qi:Ke.current,a=Er(t,a));var d=i.getDerivedStateFromProps,c=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";c||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||h!==a)&&tu(t,o,r,a),fi=!1;var f=t.memoizedState;o.state=f,to(t,r,o,s),h=t.memoizedState,l!==r||f!==h||it.current||fi?(typeof d=="function"&&(ra(t,i,d,r),h=t.memoizedState),(l=fi||eu(t,i,l,r,f,h,a))?(c||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"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=h),o.props=r,o.state=h,o.context=a,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Wf(e,t),l=t.memoizedProps,a=t.type===t.elementType?l:Dt(t.type,l),o.props=a,c=t.pendingProps,f=o.context,h=i.contextType,typeof h=="object"&&h!==null?h=xt(h):(h=rt(i)?qi:Ke.current,h=Er(t,h));var u=i.getDerivedStateFromProps;(d=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==c||f!==h)&&tu(t,o,r,h),fi=!1,f=t.memoizedState,o.state=f,to(t,r,o,s);var m=t.memoizedState;l!==c||f!==m||it.current||fi?(typeof u=="function"&&(ra(t,i,u,r),m=t.memoizedState),(a=fi||eu(t,i,a,r,f,m,h)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,h),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,h)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=h,r=a):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return la(e,t,i,r,n,s)}function la(e,t,i,r,s,n){__(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&Vc(t,i,!1),ii(e,t,n);r=t.stateNode,Yv.current=t;var l=o&&typeof i.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Lr(t,e.child,null,n),t.child=Lr(t,null,l,n)):qe(e,t,l,n),t.memoizedState=r.state,s&&Vc(t,i,!0),t.child}function p_(e){var t=e.stateNode;t.pendingContext?Kc(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Kc(e,t.context,!1),Bh(e,t.containerInfo)}function au(e,t,i,r,s){return Dr(),Eh(s),t.flags|=256,qe(e,t,i,r),t.child}var aa={dehydrated:null,treeContext:null,retryLane:0};function ha(e){return{baseLanes:e,cachePool:null,transitions:null}}function m_(e,t,i){var r=t.pendingProps,s=ue.current,n=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(n=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),re(ue,s&1),e===null)return ta(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,n?(r=t.mode,n=t.child,o={mode:"hidden",children:o},!(r&1)&&n!==null?(n.childLanes=0,n.pendingProps=o):n=Ro(o,r,0,null),e=Ki(e,r,i,null),n.return=t,e.return=t,n.sibling=e,t.child=n,t.child.memoizedState=ha(i),t.memoizedState=aa,e):Fh(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Xv(e,t,o,r,l,s,i);if(n){n=r.fallback,o=t.mode,s=e.child,l=s.sibling;var h={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=h,t.deletions=null):(r=Di(s,h),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?n=Di(l,n):(n=Ki(n,o,i,null),n.flags|=2),n.return=t,r.return=t,r.sibling=n,t.child=r,r=n,n=t.child,o=e.child.memoizedState,o=o===null?ha(i):{baseLanes:o.baseLanes|i,cachePool:null,transitions:o.transitions},n.memoizedState=o,n.childLanes=e.childLanes&~i,t.memoizedState=aa,r}return n=e.child,e=n.sibling,r=Di(n,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=i),r.return=t,r.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=r,t.memoizedState=null,r}function Fh(e,t){return t=Ro({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function cn(e,t,i,r){return r!==null&&Eh(r),Lr(t,e.child,null,i),e=Fh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xv(e,t,i,r,s,n,o){if(i)return t.flags&256?(t.flags&=-257,r=hl(Error(B(422))),cn(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(n=r.fallback,s=t.mode,r=Ro({mode:"visible",children:r.children},s,0,null),n=Ki(n,s,o,null),n.flags|=2,r.return=t,n.return=t,r.sibling=n,t.child=r,t.mode&1&&Lr(t,e.child,null,o),t.child.memoizedState=ha(o),t.memoizedState=aa,n);if(!(t.mode&1))return cn(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,n=Error(B(419)),r=hl(n,r,void 0),cn(e,t,o,r)}if(l=(o&e.childLanes)!==0,tt||l){if(r=Te,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,ti(e,s),Bt(r,e,s,-1))}return Vh(),r=hl(Error(B(421))),cn(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=ag.bind(null,e),s._reactRetry=t,null):(e=n.treeContext,at=xi(s.nextSibling),ht=t,le=!0,Rt=null,e!==null&&(vt[gt++]=Xt,vt[gt++]=Gt,vt[gt++]=Yi,Xt=e.id,Gt=e.overflow,Yi=t),t=Fh(t,r.children),t.flags|=4096,t)}function hu(e,t,i){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ia(e.return,t,i)}function cl(e,t,i,r,s){var n=e.memoizedState;n===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:i,tailMode:s}:(n.isBackwards=t,n.rendering=null,n.renderingStartTime=0,n.last=r,n.tail=i,n.tailMode=s)}function v_(e,t,i){var r=t.pendingProps,s=r.revealOrder,n=r.tail;if(qe(e,t,r.children,i),r=ue.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&hu(e,i,t);else if(e.tag===19)hu(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(re(ue,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(i=t.child,s=null;i!==null;)e=i.alternate,e!==null&&io(e)===null&&(s=i),i=i.sibling;i=s,i===null?(s=t.child,t.child=null):(s=i.sibling,i.sibling=null),cl(t,!1,s,i,n);break;case"backwards":for(i=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&io(e)===null){t.child=s;break}e=s.sibling,s.sibling=i,i=s,s=e}cl(t,!0,i,null,n);break;case"together":cl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Rn(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ii(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Gi|=t.lanes,!(i&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(B(153));if(t.child!==null){for(e=t.child,i=Di(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Di(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function Gv(e,t,i){switch(t.tag){case 3:p_(t),Dr();break;case 5:jf(t);break;case 1:rt(t.type)&&Gn(t);break;case 4:Bh(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;re(Zn,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(re(ue,ue.current&1),t.flags|=128,null):i&t.child.childLanes?m_(e,t,i):(re(ue,ue.current&1),e=ii(e,t,i),e!==null?e.sibling:null);re(ue,ue.current&1);break;case 19:if(r=(i&t.childLanes)!==0,e.flags&128){if(r)return v_(e,t,i);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),re(ue,ue.current),r)break;return null;case 22:case 23:return t.lanes=0,f_(e,t,i)}return ii(e,t,i)}var g_,ca,S_,y_;g_=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};ca=function(){};S_=function(e,t,i,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Wi(Wt.current);var n=null;switch(i){case"input":s=Bl(e,s),r=Bl(e,r),n=[];break;case"select":s=fe({},s,{value:void 0}),r=fe({},r,{value:void 0}),n=[];break;case"textarea":s=Ol(e,s),r=Ol(e,r),n=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Yn)}Il(i,r);var o;i=null;for(a in s)if(!r.hasOwnProperty(a)&&s.hasOwnProperty(a)&&s[a]!=null)if(a==="style"){var l=s[a];for(o in l)l.hasOwnProperty(o)&&(i||(i={}),i[o]="")}else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(gs.hasOwnProperty(a)?n||(n=[]):(n=n||[]).push(a,null));for(a in r){var h=r[a];if(l=s!=null?s[a]:void 0,r.hasOwnProperty(a)&&h!==l&&(h!=null||l!=null))if(a==="style")if(l){for(o in l)!l.hasOwnProperty(o)||h&&h.hasOwnProperty(o)||(i||(i={}),i[o]="");for(o in h)h.hasOwnProperty(o)&&l[o]!==h[o]&&(i||(i={}),i[o]=h[o])}else i||(n||(n=[]),n.push(a,i)),i=h;else a==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,l=l?l.__html:void 0,h!=null&&l!==h&&(n=n||[]).push(a,h)):a==="children"?typeof h!="string"&&typeof h!="number"||(n=n||[]).push(a,""+h):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(gs.hasOwnProperty(a)?(h!=null&&a==="onScroll"&&se("scroll",e),n||l===h||(n=[])):(n=n||[]).push(a,h))}i&&(n=n||[]).push("style",i);var a=n;(t.updateQueue=a)&&(t.flags|=4)}};y_=function(e,t,i,r){i!==r&&(t.flags|=4)};function Kr(e,t){if(!le)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,r=0;if(t)for(var s=e.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=i,t}function Qv(e,t,i){var r=t.pendingProps;switch(bh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return rt(t.type)&&Xn(),We(t),null;case 3:return r=t.stateNode,Rr(),oe(it),oe(Ke),Nh(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(an(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Rt!==null&&(ga(Rt),Rt=null))),ca(e,t),We(t),null;case 5:Th(t);var s=Wi(Ps.current);if(i=t.type,e!==null&&t.stateNode!=null)S_(e,t,i,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(B(166));return We(t),null}if(e=Wi(Wt.current),an(t)){r=t.stateNode,i=t.type;var n=t.memoizedProps;switch(r[$t]=t,r[Ls]=n,e=(t.mode&1)!==0,i){case"dialog":se("cancel",r),se("close",r);break;case"iframe":case"object":case"embed":se("load",r);break;case"video":case"audio":for(s=0;s<is.length;s++)se(is[s],r);break;case"source":se("error",r);break;case"img":case"image":case"link":se("error",r),se("load",r);break;case"details":se("toggle",r);break;case"input":gc(r,n),se("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!n.multiple},se("invalid",r);break;case"textarea":yc(r,n),se("invalid",r)}Il(i,n),s=null;for(var o in n)if(n.hasOwnProperty(o)){var l=n[o];o==="children"?typeof l=="string"?r.textContent!==l&&(n.suppressHydrationWarning!==!0&&ln(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(n.suppressHydrationWarning!==!0&&ln(r.textContent,l,e),s=["children",""+l]):gs.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&se("scroll",r)}switch(i){case"input":Js(r),Sc(r,n,!0);break;case"textarea":Js(r),wc(r);break;case"select":case"option":break;default:typeof n.onClick=="function"&&(r.onclick=Yn)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=qd(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(i,{is:r.is}):(e=o.createElement(i),i==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,i),e[$t]=t,e[Ls]=r,g_(e,t,!1,!1),t.stateNode=e;e:{switch(o=zl(i,r),i){case"dialog":se("cancel",e),se("close",e),s=r;break;case"iframe":case"object":case"embed":se("load",e),s=r;break;case"video":case"audio":for(s=0;s<is.length;s++)se(is[s],e);s=r;break;case"source":se("error",e),s=r;break;case"img":case"image":case"link":se("error",e),se("load",e),s=r;break;case"details":se("toggle",e),s=r;break;case"input":gc(e,r),s=Bl(e,r),se("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=fe({},r,{value:void 0}),se("invalid",e);break;case"textarea":yc(e,r),s=Ol(e,r),se("invalid",e);break;default:s=r}Il(i,s),l=s;for(n in l)if(l.hasOwnProperty(n)){var h=l[n];n==="style"?Gd(e,h):n==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,h!=null&&Yd(e,h)):n==="children"?typeof h=="string"?(i!=="textarea"||h!=="")&&Ss(e,h):typeof h=="number"&&Ss(e,""+h):n!=="suppressContentEditableWarning"&&n!=="suppressHydrationWarning"&&n!=="autoFocus"&&(gs.hasOwnProperty(n)?h!=null&&n==="onScroll"&&se("scroll",e):h!=null&&ch(e,n,h,o))}switch(i){case"input":Js(e),Sc(e,r,!1);break;case"textarea":Js(e),wc(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ri(r.value));break;case"select":e.multiple=!!r.multiple,n=r.value,n!=null?Sr(e,!!r.multiple,n,!1):r.defaultValue!=null&&Sr(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Yn)}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&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return We(t),null;case 6:if(e&&t.stateNode!=null)y_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(B(166));if(i=Wi(Ps.current),Wi(Wt.current),an(t)){if(r=t.stateNode,i=t.memoizedProps,r[$t]=t,(n=r.nodeValue!==i)&&(e=ht,e!==null))switch(e.tag){case 3:ln(r.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ln(r.nodeValue,i,(e.mode&1)!==0)}n&&(t.flags|=4)}else r=(i.nodeType===9?i:i.ownerDocument).createTextNode(r),r[$t]=t,t.stateNode=r}return We(t),null;case 13:if(oe(ue),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(le&&at!==null&&t.mode&1&&!(t.flags&128))zf(),Dr(),t.flags|=98560,n=!1;else if(n=an(t),r!==null&&r.dehydrated!==null){if(e===null){if(!n)throw Error(B(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(B(317));n[$t]=t}else Dr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;We(t),n=!1}else Rt!==null&&(ga(Rt),Rt=null),n=!0;if(!n)return t.flags&65536?t:null}return t.flags&128?(t.lanes=i,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||ue.current&1?Ee===0&&(Ee=3):Vh())),t.updateQueue!==null&&(t.flags|=4),We(t),null);case 4:return Rr(),ca(e,t),e===null&&Es(t.stateNode.containerInfo),We(t),null;case 10:return Rh(t.type._context),We(t),null;case 17:return rt(t.type)&&Xn(),We(t),null;case 19:if(oe(ue),n=t.memoizedState,n===null)return We(t),null;if(r=(t.flags&128)!==0,o=n.rendering,o===null)if(r)Kr(n,!1);else{if(Ee!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Kr(n,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=i,i=t.child;i!==null;)n=i,e=r,n.flags&=14680066,o=n.alternate,o===null?(n.childLanes=0,n.lanes=e,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,e=o.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return re(ue,ue.current&1|2),t.child}e=e.sibling}n.tail!==null&&ge()>Mr&&(t.flags|=128,r=!0,Kr(n,!1),t.lanes=4194304)}else{if(!r)if(e=io(o),e!==null){if(t.flags|=128,r=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),Kr(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!le)return We(t),null}else 2*ge()-n.renderingStartTime>Mr&&i!==1073741824&&(t.flags|=128,r=!0,Kr(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(i=n.last,i!==null?i.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(t=n.tail,n.rendering=t,n.tail=t.sibling,n.renderingStartTime=ge(),t.sibling=null,i=ue.current,re(ue,r?i&1|2:i&1),t):(We(t),null);case 22:case 23:return Kh(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?lt&1073741824&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),null;case 24:return null;case 25:return null}throw Error(B(156,t.tag))}function Jv(e,t){switch(bh(t),t.tag){case 1:return rt(t.type)&&Xn(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Rr(),oe(it),oe(Ke),Nh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Th(t),null;case 13:if(oe(ue),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(B(340));Dr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return oe(ue),null;case 4:return Rr(),null;case 10:return Rh(t.type._context),null;case 22:case 23:return Kh(),null;case 24:return null;default:return null}}var un=!1,Ue=!1,Zv=typeof WeakSet=="function"?WeakSet:Set,$=null;function mr(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(r){pe(e,t,r)}else i.current=null}function ua(e,t,i){try{i()}catch(r){pe(e,t,r)}}var cu=!1;function eg(e,t){if(Yl=Kn,e=bf(),xh(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.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,l=-1,h=-1,a=0,d=0,c=e,f=null;t:for(;;){for(var u;c!==i||s!==0&&c.nodeType!==3||(l=o+s),c!==n||r!==0&&c.nodeType!==3||(h=o+r),c.nodeType===3&&(o+=c.nodeValue.length),(u=c.firstChild)!==null;)f=c,c=u;for(;;){if(c===e)break t;if(f===i&&++a===s&&(l=o),f===n&&++d===r&&(h=o),(u=c.nextSibling)!==null)break;c=f,f=c.parentNode}c=u}i=l===-1||h===-1?null:{start:l,end:h}}else i=null}i=i||{start:0,end:0}}else i=null;for(Xl={focusedElem:e,selectionRange:i},Kn=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var S=m.memoizedProps,w=m.memoizedState,p=t.stateNode,_=p.getSnapshotBeforeUpdate(t.elementType===t.type?S:Dt(t.type,S),w);p.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(B(163))}}catch(y){pe(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return m=cu,cu=!1,m}function _s(e,t,i){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var n=s.destroy;s.destroy=void 0,n!==void 0&&ua(t,i,n)}s=s.next}while(s!==r)}}function Do(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var r=i.create;i.destroy=r()}i=i.next}while(i!==t)}}function da(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function w_(e){var t=e.alternate;t!==null&&(e.alternate=null,w_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[$t],delete t[Ls],delete t[Jl],delete t[Av],delete t[Iv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function C_(e){return e.tag===5||e.tag===3||e.tag===4}function uu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||C_(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function fa(e,t,i){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Yn));else if(r!==4&&(e=e.child,e!==null))for(fa(e,t,i),e=e.sibling;e!==null;)fa(e,t,i),e=e.sibling}function _a(e,t,i){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(_a(e,t,i),e=e.sibling;e!==null;)_a(e,t,i),e=e.sibling}var Oe=null,Lt=!1;function ai(e,t,i){for(i=i.child;i!==null;)x_(e,t,i),i=i.sibling}function x_(e,t,i){if(Ht&&typeof Ht.onCommitFiberUnmount=="function")try{Ht.onCommitFiberUnmount(So,i)}catch{}switch(i.tag){case 5:Ue||mr(i,t);case 6:var r=Oe,s=Lt;Oe=null,ai(e,t,i),Oe=r,Lt=s,Oe!==null&&(Lt?(e=Oe,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):Oe.removeChild(i.stateNode));break;case 18:Oe!==null&&(Lt?(e=Oe,i=i.stateNode,e.nodeType===8?rl(e.parentNode,i):e.nodeType===1&&rl(e,i),xs(e)):rl(Oe,i.stateNode));break;case 4:r=Oe,s=Lt,Oe=i.stateNode.containerInfo,Lt=!0,ai(e,t,i),Oe=r,Lt=s;break;case 0:case 11:case 14:case 15:if(!Ue&&(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)&&ua(i,t,o),s=s.next}while(s!==r)}ai(e,t,i);break;case 1:if(!Ue&&(mr(i,t),r=i.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=i.memoizedProps,r.state=i.memoizedState,r.componentWillUnmount()}catch(l){pe(i,t,l)}ai(e,t,i);break;case 21:ai(e,t,i);break;case 22:i.mode&1?(Ue=(r=Ue)||i.memoizedState!==null,ai(e,t,i),Ue=r):ai(e,t,i);break;default:ai(e,t,i)}}function du(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new Zv),t.forEach(function(r){var s=hg.bind(null,e,r);i.has(r)||(i.add(r),r.then(s,s))})}}function bt(e,t){var i=t.deletions;if(i!==null)for(var r=0;r<i.length;r++){var s=i[r];try{var n=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Oe=l.stateNode,Lt=!1;break e;case 3:Oe=l.stateNode.containerInfo,Lt=!0;break e;case 4:Oe=l.stateNode.containerInfo,Lt=!0;break e}l=l.return}if(Oe===null)throw Error(B(160));x_(n,o,s),Oe=null,Lt=!1;var h=s.alternate;h!==null&&(h.return=null),s.return=null}catch(a){pe(s,t,a)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)k_(t,e),t=t.sibling}function k_(e,t){var i=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(bt(t,e),Nt(e),r&4){try{_s(3,e,e.return),Do(3,e)}catch(S){pe(e,e.return,S)}try{_s(5,e,e.return)}catch(S){pe(e,e.return,S)}}break;case 1:bt(t,e),Nt(e),r&512&&i!==null&&mr(i,i.return);break;case 5:if(bt(t,e),Nt(e),r&512&&i!==null&&mr(i,i.return),e.flags&32){var s=e.stateNode;try{Ss(s,"")}catch(S){pe(e,e.return,S)}}if(r&4&&(s=e.stateNode,s!=null)){var n=e.memoizedProps,o=i!==null?i.memoizedProps:n,l=e.type,h=e.updateQueue;if(e.updateQueue=null,h!==null)try{l==="input"&&n.type==="radio"&&n.name!=null&&Kd(s,n),zl(l,o);var a=zl(l,n);for(o=0;o<h.length;o+=2){var d=h[o],c=h[o+1];d==="style"?Gd(s,c):d==="dangerouslySetInnerHTML"?Yd(s,c):d==="children"?Ss(s,c):ch(s,d,c,a)}switch(l){case"input":Tl(s,n);break;case"textarea":Vd(s,n);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!n.multiple;var u=n.value;u!=null?Sr(s,!!n.multiple,u,!1):f!==!!n.multiple&&(n.defaultValue!=null?Sr(s,!!n.multiple,n.defaultValue,!0):Sr(s,!!n.multiple,n.multiple?[]:"",!1))}s[Ls]=n}catch(S){pe(e,e.return,S)}}break;case 6:if(bt(t,e),Nt(e),r&4){if(e.stateNode===null)throw Error(B(162));s=e.stateNode,n=e.memoizedProps;try{s.nodeValue=n}catch(S){pe(e,e.return,S)}}break;case 3:if(bt(t,e),Nt(e),r&4&&i!==null&&i.memoizedState.isDehydrated)try{xs(t.containerInfo)}catch(S){pe(e,e.return,S)}break;case 4:bt(t,e),Nt(e);break;case 13:bt(t,e),Nt(e),s=e.child,s.flags&8192&&(n=s.memoizedState!==null,s.stateNode.isHidden=n,!n||s.alternate!==null&&s.alternate.memoizedState!==null||(jh=ge())),r&4&&du(e);break;case 22:if(d=i!==null&&i.memoizedState!==null,e.mode&1?(Ue=(a=Ue)||d,bt(t,e),Ue=a):bt(t,e),Nt(e),r&8192){if(a=e.memoizedState!==null,(e.stateNode.isHidden=a)&&!d&&e.mode&1)for($=e,d=e.child;d!==null;){for(c=$=d;$!==null;){switch(f=$,u=f.child,f.tag){case 0:case 11:case 14:case 15:_s(4,f,f.return);break;case 1:mr(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){r=f,i=f.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(S){pe(r,i,S)}}break;case 5:mr(f,f.return);break;case 22:if(f.memoizedState!==null){_u(c);continue}}u!==null?(u.return=f,$=u):_u(c)}d=d.sibling}e:for(d=null,c=e;;){if(c.tag===5){if(d===null){d=c;try{s=c.stateNode,a?(n=s.style,typeof n.setProperty=="function"?n.setProperty("display","none","important"):n.display="none"):(l=c.stateNode,h=c.memoizedProps.style,o=h!=null&&h.hasOwnProperty("display")?h.display:null,l.style.display=Xd("display",o))}catch(S){pe(e,e.return,S)}}}else if(c.tag===6){if(d===null)try{c.stateNode.nodeValue=a?"":c.memoizedProps}catch(S){pe(e,e.return,S)}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===e)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===e)break e;for(;c.sibling===null;){if(c.return===null||c.return===e)break e;d===c&&(d=null),c=c.return}d===c&&(d=null),c.sibling.return=c.return,c=c.sibling}}break;case 19:bt(t,e),Nt(e),r&4&&du(e);break;case 21:break;default:bt(t,e),Nt(e)}}function Nt(e){var t=e.flags;if(t&2){try{e:{for(var i=e.return;i!==null;){if(C_(i)){var r=i;break e}i=i.return}throw Error(B(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Ss(s,""),r.flags&=-33);var n=uu(e);_a(e,n,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=uu(e);fa(e,l,o);break;default:throw Error(B(161))}}catch(h){pe(e,e.return,h)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function tg(e,t,i){$=e,b_(e)}function b_(e,t,i){for(var r=(e.mode&1)!==0;$!==null;){var s=$,n=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||un;if(!o){var l=s.alternate,h=l!==null&&l.memoizedState!==null||Ue;l=un;var a=Ue;if(un=o,(Ue=h)&&!a)for($=s;$!==null;)o=$,h=o.child,o.tag===22&&o.memoizedState!==null?pu(s):h!==null?(h.return=o,$=h):pu(s);for(;n!==null;)$=n,b_(n),n=n.sibling;$=s,un=l,Ue=a}fu(e)}else s.subtreeFlags&8772&&n!==null?(n.return=s,$=n):fu(e)}}function fu(e){for(;$!==null;){var t=$;if(t.flags&8772){var i=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ue||Do(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ue)if(i===null)r.componentDidMount();else{var s=t.elementType===t.type?i.memoizedProps:Dt(t.type,i.memoizedProps);r.componentDidUpdate(s,i.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var n=t.updateQueue;n!==null&&Qc(t,n,r);break;case 3:var o=t.updateQueue;if(o!==null){if(i=null,t.child!==null)switch(t.child.tag){case 5:i=t.child.stateNode;break;case 1:i=t.child.stateNode}Qc(t,o,i)}break;case 5:var l=t.stateNode;if(i===null&&t.flags&4){i=l;var h=t.memoizedProps;switch(t.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(t.memoizedState===null){var a=t.alternate;if(a!==null){var d=a.memoizedState;if(d!==null){var c=d.dehydrated;c!==null&&xs(c)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(B(163))}Ue||t.flags&512&&da(t)}catch(f){pe(t,t.return,f)}}if(t===e){$=null;break}if(i=t.sibling,i!==null){i.return=t.return,$=i;break}$=t.return}}function _u(e){for(;$!==null;){var t=$;if(t===e){$=null;break}var i=t.sibling;if(i!==null){i.return=t.return,$=i;break}$=t.return}}function pu(e){for(;$!==null;){var t=$;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{Do(4,t)}catch(h){pe(t,i,h)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(h){pe(t,s,h)}}var n=t.return;try{da(t)}catch(h){pe(t,n,h)}break;case 5:var o=t.return;try{da(t)}catch(h){pe(t,o,h)}}}catch(h){pe(t,t.return,h)}if(t===e){$=null;break}var l=t.sibling;if(l!==null){l.return=t.return,$=l;break}$=t.return}}var ig=Math.ceil,no=ri.ReactCurrentDispatcher,Hh=ri.ReactCurrentOwner,wt=ri.ReactCurrentBatchConfig,Q=0,Te=null,Ce=null,ze=0,lt=0,vr=Bi(0),Ee=0,Ns=null,Gi=0,Lo=0,Wh=0,ps=null,et=null,jh=0,Mr=1/0,Vt=null,oo=!1,pa=null,bi=null,dn=!1,gi=null,lo=0,ms=0,ma=null,Pn=-1,Mn=0;function Ye(){return Q&6?ge():Pn!==-1?Pn:Pn=ge()}function Ei(e){return e.mode&1?Q&2&&ze!==0?ze&-ze:$v.transition!==null?(Mn===0&&(Mn=hf()),Mn):(e=te,e!==0||(e=window.event,e=e===void 0?16:mf(e.type)),e):1}function Bt(e,t,i,r){if(50<ms)throw ms=0,ma=null,Error(B(185));Fs(e,i,r),(!(Q&2)||e!==Te)&&(e===Te&&(!(Q&2)&&(Lo|=i),Ee===4&&mi(e,ze)),st(e,r),i===1&&Q===0&&!(t.mode&1)&&(Mr=ge()+500,ko&&Ti()))}function st(e,t){var i=e.callbackNode;$m(e,t);var r=Un(e,e===Te?ze:0);if(r===0)i!==null&&kc(i),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(i!=null&&kc(i),t===1)e.tag===0?zv(mu.bind(null,e)):Of(mu.bind(null,e)),Nv(function(){!(Q&6)&&Ti()}),i=null;else{switch(cf(r)){case 1:i=ph;break;case 4:i=lf;break;case 16:i=jn;break;case 536870912:i=af;break;default:i=jn}i=T_(i,E_.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function E_(e,t){if(Pn=-1,Mn=0,Q&6)throw Error(B(327));var i=e.callbackNode;if(kr()&&e.callbackNode!==i)return null;var r=Un(e,e===Te?ze:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ao(e,r);else{t=r;var s=Q;Q|=2;var n=L_();(Te!==e||ze!==t)&&(Vt=null,Mr=ge()+500,Ui(e,t));do try{ng();break}catch(l){D_(e,l)}while(!0);Lh(),no.current=n,Q=s,Ce!==null?t=0:(Te=null,ze=0,t=Ee)}if(t!==0){if(t===2&&(s=jl(e),s!==0&&(r=s,t=va(e,s))),t===1)throw i=Ns,Ui(e,0),mi(e,r),st(e,ge()),i;if(t===6)mi(e,r);else{if(s=e.current.alternate,!(r&30)&&!rg(s)&&(t=ao(e,r),t===2&&(n=jl(e),n!==0&&(r=n,t=va(e,n))),t===1))throw i=Ns,Ui(e,0),mi(e,r),st(e,ge()),i;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(B(345));case 2:Ii(e,et,Vt);break;case 3:if(mi(e,r),(r&130023424)===r&&(t=jh+500-ge(),10<t)){if(Un(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Ye(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Ql(Ii.bind(null,e,et,Vt),t);break}Ii(e,et,Vt);break;case 4:if(mi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-Mt(r);n=1<<o,o=t[o],o>s&&(s=o),r&=~n}if(r=s,r=ge()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ig(r/1960))-r,10<r){e.timeoutHandle=Ql(Ii.bind(null,e,et,Vt),r);break}Ii(e,et,Vt);break;case 5:Ii(e,et,Vt);break;default:throw Error(B(329))}}}return st(e,ge()),e.callbackNode===i?E_.bind(null,e):null}function va(e,t){var i=ps;return e.current.memoizedState.isDehydrated&&(Ui(e,t).flags|=256),e=ao(e,t),e!==2&&(t=et,et=i,t!==null&&ga(t)),e}function ga(e){et===null?et=e:et.push.apply(et,e)}function rg(e){for(var t=e;;){if(t.flags&16384){var i=t.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(!Tt(n(),s))return!1}catch{return!1}}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function mi(e,t){for(t&=~Wh,t&=~Lo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-Mt(t),r=1<<i;e[i]=-1,t&=~r}}function mu(e){if(Q&6)throw Error(B(327));kr();var t=Un(e,0);if(!(t&1))return st(e,ge()),null;var i=ao(e,t);if(e.tag!==0&&i===2){var r=jl(e);r!==0&&(t=r,i=va(e,r))}if(i===1)throw i=Ns,Ui(e,0),mi(e,t),st(e,ge()),i;if(i===6)throw Error(B(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ii(e,et,Vt),st(e,ge()),null}function Uh(e,t){var i=Q;Q|=1;try{return e(t)}finally{Q=i,Q===0&&(Mr=ge()+500,ko&&Ti())}}function Qi(e){gi!==null&&gi.tag===0&&!(Q&6)&&kr();var t=Q;Q|=1;var i=wt.transition,r=te;try{if(wt.transition=null,te=1,e)return e()}finally{te=r,wt.transition=i,Q=t,!(Q&6)&&Ti()}}function Kh(){lt=vr.current,oe(vr)}function Ui(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,Tv(i)),Ce!==null)for(i=Ce.return;i!==null;){var r=i;switch(bh(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xn();break;case 3:Rr(),oe(it),oe(Ke),Nh();break;case 5:Th(r);break;case 4:Rr();break;case 13:oe(ue);break;case 19:oe(ue);break;case 10:Rh(r.type._context);break;case 22:case 23:Kh()}i=i.return}if(Te=e,Ce=e=Di(e.current,null),ze=lt=t,Ee=0,Ns=null,Wh=Lo=Gi=0,et=ps=null,Hi!==null){for(t=0;t<Hi.length;t++)if(i=Hi[t],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}Hi=null}return e}function D_(e,t){do{var i=Ce;try{if(Lh(),Dn.current=so,ro){for(var r=de.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}ro=!1}if(Xi=0,Re=be=de=null,fs=!1,Ms=0,Hh.current=null,i===null||i.return===null){Ee=1,Ns=t,Ce=null;break}e:{var n=e,o=i.return,l=i,h=t;if(t=ze,l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){var a=h,d=l,c=d.tag;if(!(d.mode&1)&&(c===0||c===11||c===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var u=ru(o);if(u!==null){u.flags&=-257,su(u,o,l,n,t),u.mode&1&&iu(n,a,t),t=u,h=a;var m=t.updateQueue;if(m===null){var S=new Set;S.add(h),t.updateQueue=S}else m.add(h);break e}else{if(!(t&1)){iu(n,a,t),Vh();break e}h=Error(B(426))}}else if(le&&l.mode&1){var w=ru(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),su(w,o,l,n,t),Eh(Pr(h,l));break e}}n=h=Pr(h,l),Ee!==4&&(Ee=2),ps===null?ps=[n]:ps.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,t&=-t,n.lanes|=t;var p=c_(n,h,t);Gc(n,p);break e;case 1:l=h;var _=n.type,v=n.stateNode;if(!(n.flags&128)&&(typeof _.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(bi===null||!bi.has(v)))){n.flags|=65536,t&=-t,n.lanes|=t;var y=u_(n,l,t);Gc(n,y);break e}}n=n.return}while(n!==null)}P_(i)}catch(C){t=C,Ce===i&&i!==null&&(Ce=i=i.return);continue}break}while(!0)}function L_(){var e=no.current;return no.current=so,e===null?so:e}function Vh(){(Ee===0||Ee===3||Ee===2)&&(Ee=4),Te===null||!(Gi&268435455)&&!(Lo&268435455)||mi(Te,ze)}function ao(e,t){var i=Q;Q|=2;var r=L_();(Te!==e||ze!==t)&&(Vt=null,Ui(e,t));do try{sg();break}catch(s){D_(e,s)}while(!0);if(Lh(),Q=i,no.current=r,Ce!==null)throw Error(B(261));return Te=null,ze=0,Ee}function sg(){for(;Ce!==null;)R_(Ce)}function ng(){for(;Ce!==null&&!Pm();)R_(Ce)}function R_(e){var t=B_(e.alternate,e,lt);e.memoizedProps=e.pendingProps,t===null?P_(e):Ce=t,Hh.current=null}function P_(e){var t=e;do{var i=t.alternate;if(e=t.return,t.flags&32768){if(i=Jv(i,t),i!==null){i.flags&=32767,Ce=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ee=6,Ce=null;return}}else if(i=Qv(i,t,lt),i!==null){Ce=i;return}if(t=t.sibling,t!==null){Ce=t;return}Ce=t=e}while(t!==null);Ee===0&&(Ee=5)}function Ii(e,t,i){var r=te,s=wt.transition;try{wt.transition=null,te=1,og(e,t,i,r)}finally{wt.transition=s,te=r}return null}function og(e,t,i,r){do kr();while(gi!==null);if(Q&6)throw Error(B(327));i=e.finishedWork;var s=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(B(177));e.callbackNode=null,e.callbackPriority=0;var n=i.lanes|i.childLanes;if(Fm(e,n),e===Te&&(Ce=Te=null,ze=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||dn||(dn=!0,T_(jn,function(){return kr(),null})),n=(i.flags&15990)!==0,i.subtreeFlags&15990||n){n=wt.transition,wt.transition=null;var o=te;te=1;var l=Q;Q|=4,Hh.current=null,eg(e,i),k_(i,e),Ev(Xl),Kn=!!Yl,Xl=Yl=null,e.current=i,tg(i),Mm(),Q=l,te=o,wt.transition=n}else e.current=i;if(dn&&(dn=!1,gi=e,lo=s),n=e.pendingLanes,n===0&&(bi=null),Nm(i.stateNode),st(e,ge()),t!==null)for(r=e.onRecoverableError,i=0;i<t.length;i++)s=t[i],r(s.value,{componentStack:s.stack,digest:s.digest});if(oo)throw oo=!1,e=pa,pa=null,e;return lo&1&&e.tag!==0&&kr(),n=e.pendingLanes,n&1?e===ma?ms++:(ms=0,ma=e):ms=0,Ti(),null}function kr(){if(gi!==null){var e=cf(lo),t=wt.transition,i=te;try{if(wt.transition=null,te=16>e?16:e,gi===null)var r=!1;else{if(e=gi,gi=null,lo=0,Q&6)throw Error(B(331));var s=Q;for(Q|=4,$=e.current;$!==null;){var n=$,o=n.child;if($.flags&16){var l=n.deletions;if(l!==null){for(var h=0;h<l.length;h++){var a=l[h];for($=a;$!==null;){var d=$;switch(d.tag){case 0:case 11:case 15:_s(8,d,n)}var c=d.child;if(c!==null)c.return=d,$=c;else for(;$!==null;){d=$;var f=d.sibling,u=d.return;if(w_(d),d===a){$=null;break}if(f!==null){f.return=u,$=f;break}$=u}}}var m=n.alternate;if(m!==null){var S=m.child;if(S!==null){m.child=null;do{var w=S.sibling;S.sibling=null,S=w}while(S!==null)}}$=n}}if(n.subtreeFlags&2064&&o!==null)o.return=n,$=o;else e:for(;$!==null;){if(n=$,n.flags&2048)switch(n.tag){case 0:case 11:case 15:_s(9,n,n.return)}var p=n.sibling;if(p!==null){p.return=n.return,$=p;break e}$=n.return}}var _=e.current;for($=_;$!==null;){o=$;var v=o.child;if(o.subtreeFlags&2064&&v!==null)v.return=o,$=v;else e:for(o=_;$!==null;){if(l=$,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Do(9,l)}}catch(C){pe(l,l.return,C)}if(l===o){$=null;break e}var y=l.sibling;if(y!==null){y.return=l.return,$=y;break e}$=l.return}}if(Q=s,Ti(),Ht&&typeof Ht.onPostCommitFiberRoot=="function")try{Ht.onPostCommitFiberRoot(So,e)}catch{}r=!0}return r}finally{te=i,wt.transition=t}}return!1}function vu(e,t,i){t=Pr(i,t),t=c_(e,t,1),e=ki(e,t,1),t=Ye(),e!==null&&(Fs(e,1,t),st(e,t))}function pe(e,t,i){if(e.tag===3)vu(e,e,i);else for(;t!==null;){if(t.tag===3){vu(t,e,i);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(bi===null||!bi.has(r))){e=Pr(i,e),e=u_(t,e,1),t=ki(t,e,1),e=Ye(),t!==null&&(Fs(t,1,e),st(t,e));break}}t=t.return}}function lg(e,t,i){var r=e.pingCache;r!==null&&r.delete(t),t=Ye(),e.pingedLanes|=e.suspendedLanes&i,Te===e&&(ze&i)===i&&(Ee===4||Ee===3&&(ze&130023424)===ze&&500>ge()-jh?Ui(e,0):Wh|=i),st(e,t)}function M_(e,t){t===0&&(e.mode&1?(t=tn,tn<<=1,!(tn&130023424)&&(tn=4194304)):t=1);var i=Ye();e=ti(e,t),e!==null&&(Fs(e,t,i),st(e,i))}function ag(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),M_(e,i)}function hg(e,t){var i=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(i=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(B(314))}r!==null&&r.delete(t),M_(e,i)}var B_;B_=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||it.current)tt=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return tt=!1,Gv(e,t,i);tt=!!(e.flags&131072)}else tt=!1,le&&t.flags&1048576&&Af(t,Jn,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Rn(e,t),e=t.pendingProps;var s=Er(t,Ke.current);xr(t,i),s=Ah(null,t,r,e,s,i);var n=Ih();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,rt(r)?(n=!0,Gn(t)):n=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Mh(t),s.updater=Eo,t.stateNode=s,s._reactInternals=t,sa(t,r,e,i),t=la(null,t,r,!0,n,i)):(t.tag=0,le&&n&&kh(t),qe(null,t,s,i),t=t.child),t;case 16:r=t.elementType;e:{switch(Rn(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=ug(r),e=Dt(r,e),s){case 0:t=oa(null,t,r,e,i);break e;case 1:t=lu(null,t,r,e,i);break e;case 11:t=nu(null,t,r,e,i);break e;case 14:t=ou(null,t,r,Dt(r.type,e),i);break e}throw Error(B(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Dt(r,s),oa(e,t,r,s,i);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Dt(r,s),lu(e,t,r,s,i);case 3:e:{if(p_(t),e===null)throw Error(B(387));r=t.pendingProps,n=t.memoizedState,s=n.element,Wf(e,t),to(t,r,null,i);var o=t.memoizedState;if(r=o.element,n.isDehydrated)if(n={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){s=Pr(Error(B(423)),t),t=au(e,t,r,i,s);break e}else if(r!==s){s=Pr(Error(B(424)),t),t=au(e,t,r,i,s);break e}else for(at=xi(t.stateNode.containerInfo.firstChild),ht=t,le=!0,Rt=null,i=Ff(t,null,r,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Dr(),r===s){t=ii(e,t,i);break e}qe(e,t,r,i)}t=t.child}return t;case 5:return jf(t),e===null&&ta(t),r=t.type,s=t.pendingProps,n=e!==null?e.memoizedProps:null,o=s.children,Gl(r,s)?o=null:n!==null&&Gl(r,n)&&(t.flags|=32),__(e,t),qe(e,t,o,i),t.child;case 6:return e===null&&ta(t),null;case 13:return m_(e,t,i);case 4:return Bh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Lr(t,null,r,i):qe(e,t,r,i),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Dt(r,s),nu(e,t,r,s,i);case 7:return qe(e,t,t.pendingProps,i),t.child;case 8:return qe(e,t,t.pendingProps.children,i),t.child;case 12:return qe(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,n=t.memoizedProps,o=s.value,re(Zn,r._currentValue),r._currentValue=o,n!==null)if(Tt(n.value,o)){if(n.children===s.children&&!it.current){t=ii(e,t,i);break e}}else for(n=t.child,n!==null&&(n.return=t);n!==null;){var l=n.dependencies;if(l!==null){o=n.child;for(var h=l.firstContext;h!==null;){if(h.context===r){if(n.tag===1){h=Jt(-1,i&-i),h.tag=2;var a=n.updateQueue;if(a!==null){a=a.shared;var d=a.pending;d===null?h.next=h:(h.next=d.next,d.next=h),a.pending=h}}n.lanes|=i,h=n.alternate,h!==null&&(h.lanes|=i),ia(n.return,i,t),l.lanes|=i;break}h=h.next}}else if(n.tag===10)o=n.type===t.type?null:n.child;else if(n.tag===18){if(o=n.return,o===null)throw Error(B(341));o.lanes|=i,l=o.alternate,l!==null&&(l.lanes|=i),ia(o,i,t),o=n.sibling}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===t){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}qe(e,t,s.children,i),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,xr(t,i),s=xt(s),r=r(s),t.flags|=1,qe(e,t,r,i),t.child;case 14:return r=t.type,s=Dt(r,t.pendingProps),s=Dt(r.type,s),ou(e,t,r,s,i);case 15:return d_(e,t,t.type,t.pendingProps,i);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Dt(r,s),Rn(e,t),t.tag=1,rt(r)?(e=!0,Gn(t)):e=!1,xr(t,i),h_(t,r,s),sa(t,r,s,i),la(null,t,r,!0,e,i);case 19:return v_(e,t,i);case 22:return f_(e,t,i)}throw Error(B(156,t.tag))};function T_(e,t){return of(e,t)}function cg(e,t,i,r){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 St(e,t,i,r){return new cg(e,t,i,r)}function qh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ug(e){if(typeof e=="function")return qh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===dh)return 11;if(e===fh)return 14}return 2}function Di(e,t){var i=e.alternate;return i===null?(i=St(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Bn(e,t,i,r,s,n){var o=2;if(r=e,typeof e=="function")qh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case lr:return Ki(i.children,s,n,t);case uh:o=8,s|=8;break;case Ll:return e=St(12,i,t,s|2),e.elementType=Ll,e.lanes=n,e;case Rl:return e=St(13,i,t,s),e.elementType=Rl,e.lanes=n,e;case Pl:return e=St(19,i,t,s),e.elementType=Pl,e.lanes=n,e;case Wd:return Ro(i,s,n,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Fd:o=10;break e;case Hd:o=9;break e;case dh:o=11;break e;case fh:o=14;break e;case di:o=16,r=null;break e}throw Error(B(130,e==null?e:typeof e,""))}return t=St(o,i,t,s),t.elementType=e,t.type=r,t.lanes=n,t}function Ki(e,t,i,r){return e=St(7,e,r,t),e.lanes=i,e}function Ro(e,t,i,r){return e=St(22,e,r,t),e.elementType=Wd,e.lanes=i,e.stateNode={isHidden:!1},e}function ul(e,t,i){return e=St(6,e,null,t),e.lanes=i,e}function dl(e,t,i){return t=St(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dg(e,t,i,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vo(0),this.expirationTimes=Vo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vo(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Yh(e,t,i,r,s,n,o,l,h){return e=new dg(e,t,i,l,h),t===1?(t=1,n===!0&&(t|=8)):t=0,n=St(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:r,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Mh(n),e}function fg(e,t,i){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:or,key:r==null?null:""+r,children:e,containerInfo:t,implementation:i}}function N_(e){if(!e)return Pi;e=e._reactInternals;e:{if(tr(e)!==e||e.tag!==1)throw Error(B(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(rt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(B(171))}if(e.tag===1){var i=e.type;if(rt(i))return Nf(e,i,t)}return t}function O_(e,t,i,r,s,n,o,l,h){return e=Yh(i,r,!0,e,s,n,o,l,h),e.context=N_(null),i=e.current,r=Ye(),s=Ei(i),n=Jt(r,s),n.callback=t??null,ki(i,n,s),e.current.lanes=s,Fs(e,s,r),st(e,r),e}function Po(e,t,i,r){var s=t.current,n=Ye(),o=Ei(s);return i=N_(i),t.context===null?t.context=i:t.pendingContext=i,t=Jt(n,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ki(s,t,o),e!==null&&(Bt(e,s,o,n),En(e,s,o)),o}function ho(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function gu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Xh(e,t){gu(e,t),(e=e.alternate)&&gu(e,t)}function _g(){return null}var A_=typeof reportError=="function"?reportError:function(e){console.error(e)};function Gh(e){this._internalRoot=e}Mo.prototype.render=Gh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(B(409));Po(e,t,null,null)};Mo.prototype.unmount=Gh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Qi(function(){Po(null,e,null,null)}),t[ei]=null}};function Mo(e){this._internalRoot=e}Mo.prototype.unstable_scheduleHydration=function(e){if(e){var t=ff();e={blockedOn:null,target:e,priority:t};for(var i=0;i<pi.length&&t!==0&&t<pi[i].priority;i++);pi.splice(i,0,e),i===0&&pf(e)}};function Qh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Bo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Su(){}function pg(e,t,i,r,s){if(s){if(typeof r=="function"){var n=r;r=function(){var a=ho(o);n.call(a)}}var o=O_(t,r,e,0,null,!1,!1,"",Su);return e._reactRootContainer=o,e[ei]=o.current,Es(e.nodeType===8?e.parentNode:e),Qi(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var a=ho(h);l.call(a)}}var h=Yh(e,0,!1,null,null,!1,!1,"",Su);return e._reactRootContainer=h,e[ei]=h.current,Es(e.nodeType===8?e.parentNode:e),Qi(function(){Po(t,h,i,r)}),h}function To(e,t,i,r,s){var n=i._reactRootContainer;if(n){var o=n;if(typeof s=="function"){var l=s;s=function(){var h=ho(o);l.call(h)}}Po(t,o,e,s)}else o=pg(i,t,e,s,r);return ho(o)}uf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=ts(t.pendingLanes);i!==0&&(mh(t,i|1),st(t,ge()),!(Q&6)&&(Mr=ge()+500,Ti()))}break;case 13:Qi(function(){var r=ti(e,1);if(r!==null){var s=Ye();Bt(r,e,1,s)}}),Xh(e,1)}};vh=function(e){if(e.tag===13){var t=ti(e,134217728);if(t!==null){var i=Ye();Bt(t,e,134217728,i)}Xh(e,134217728)}};df=function(e){if(e.tag===13){var t=Ei(e),i=ti(e,t);if(i!==null){var r=Ye();Bt(i,e,t,r)}Xh(e,t)}};ff=function(){return te};_f=function(e,t){var i=te;try{return te=e,t()}finally{te=i}};Fl=function(e,t,i){switch(t){case"input":if(Tl(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var r=i[t];if(r!==e&&r.form===e.form){var s=xo(r);if(!s)throw Error(B(90));Ud(r),Tl(r,s)}}}break;case"textarea":Vd(e,i);break;case"select":t=i.value,t!=null&&Sr(e,!!i.multiple,t,!1)}};Zd=Uh;ef=Qi;var mg={usingClientEntryPoint:!1,Events:[Ws,ur,xo,Qd,Jd,Uh]},Vr={findFiberByHostInstance:Fi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},vg={bundleType:Vr.bundleType,version:Vr.version,rendererPackageName:Vr.rendererPackageName,rendererConfig:Vr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ri.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=sf(e),e===null?null:e.stateNode},findFiberByHostInstance:Vr.findFiberByHostInstance||_g,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 fn=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fn.isDisabled&&fn.supportsFiber)try{So=fn.inject(vg),Ht=fn}catch{}}ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mg;ut.createPortal=function(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Qh(t))throw Error(B(200));return fg(e,t,null,i)};ut.createRoot=function(e,t){if(!Qh(e))throw Error(B(299));var i=!1,r="",s=A_;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Yh(e,1,!1,null,null,i,!1,r,s),e[ei]=t.current,Es(e.nodeType===8?e.parentNode:e),new Gh(t)};ut.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(B(188)):(e=Object.keys(e).join(","),Error(B(268,e)));return e=sf(t),e=e===null?null:e.stateNode,e};ut.flushSync=function(e){return Qi(e)};ut.hydrate=function(e,t,i){if(!Bo(t))throw Error(B(200));return To(null,e,t,!0,i)};ut.hydrateRoot=function(e,t,i){if(!Qh(e))throw Error(B(405));var r=i!=null&&i.hydratedSources||null,s=!1,n="",o=A_;if(i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(n=i.identifierPrefix),i.onRecoverableError!==void 0&&(o=i.onRecoverableError)),t=O_(t,null,e,1,i??null,s,!1,n,o),e[ei]=t.current,Es(e),r)for(e=0;e<r.length;e++)i=r[e],s=i._getVersion,s=s(i._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[i,s]:t.mutableSourceEagerHydrationData.push(i,s);return new Mo(t)};ut.render=function(e,t,i){if(!Bo(t))throw Error(B(200));return To(null,e,t,!1,i)};ut.unmountComponentAtNode=function(e){if(!Bo(e))throw Error(B(40));return e._reactRootContainer?(Qi(function(){To(null,null,e,!1,function(){e._reactRootContainer=null,e[ei]=null})}),!0):!1};ut.unstable_batchedUpdates=Uh;ut.unstable_renderSubtreeIntoContainer=function(e,t,i,r){if(!Bo(i))throw Error(B(200));if(e==null||e._reactInternals===void 0)throw Error(B(38));return To(e,t,i,!1,r)};ut.version="18.3.1-next-f1338f8080-20240426";function I_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(I_)}catch(e){console.error(e)}}I_(),Ad.exports=ut;var gg=Ad.exports,yu=gg;El.createRoot=yu.createRoot,El.hydrateRoot=yu.hydrateRoot;function yt(e,t,i={}){return fetch(e,{...i,headers:{...i.headers||{},Authorization:`Bearer ${t}`}})}const z_=e=>`nc_seen_${e}`;async function Us(e,t,i={}){const r=await yt(e,t,{method:i.method||"GET",headers:{"content-type":"application/json"},body:i.body?JSON.stringify(i.body):void 0}),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`HTTP ${r.status}`);return s}const Jh=e=>Us("/api/fleet/status",e),$_=(e,t)=>Us("/api/fleet/up",e,{method:"POST",body:t}),F_=(e,t)=>Us("/api/fleet/down",e,{method:"POST",body:t}),H_=(e,t)=>Us("/api/sessions",e,{method:"POST",body:t}),W_=(e,t)=>Us(`/api/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),Sg={folder:g.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h3.6a2 2 0 0 1 1.4.6L12.4 6H18a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z"}),keyboard:g.jsxs(g.Fragment,{children:[g.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),g.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:g.jsxs(g.Fragment,{children:[g.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),g.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),g.jsx("path",{d:"M12 18v3"})]}),enter:g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),g.jsx("polyline",{points:"9 9 5 13 9 17"})]}),trash:g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M4 7h16"}),g.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),g.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),g.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:g.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),g.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M12 16V5"}),g.jsx("polyline",{points:"8 9 12 5 16 9"}),g.jsx("path",{d:"M5 20h14"})]}),chevronLeft:g.jsx("polyline",{points:"14 6 8 12 14 18"}),zoomIn:g.jsxs(g.Fragment,{children:[g.jsx("circle",{cx:"11",cy:"11",r:"7"}),g.jsx("path",{d:"M21 21l-4.35-4.35"}),g.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:g.jsxs(g.Fragment,{children:[g.jsx("circle",{cx:"11",cy:"11",r:"7"}),g.jsx("path",{d:"M21 21l-4.35-4.35"}),g.jsx("path",{d:"M8 11h6"})]})};function Pt({name:e,size:t=20}){return g.jsx("svg",{className:"nc-icon",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:Sg[e]||null})}const Zh=["it","en","es"];function yg(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return Zh.includes(t)?t:"en"}catch{return"en"}}const Tn=yg(),j_="nc_lang",Sa="nc-lang";function U_(){return typeof localStorage<"u"?localStorage:null}const _n={it:{sessions:"sessioni","new-session":"nuova sessione",new:"nuova",fleet:"Flotta","fleet-tmux":"flotta tmux","other-sessions":"Altre sessioni",files:"file",refresh:"aggiorna","filter-placeholder":"filtra sessioni…","loading-fleet":"carico la flotta…","no-sessions":"nessuna sessione tmux viva — la flotta parte al boot (systemd)","no-match":'nessuna sessione contiene "{q}"',"copy-url":"clicca per copiare l'URL","ssh-only":"solo tunnel SSH/VPN","new-files-outbox":"nuovi file in outbox",terminate:"termina","terminate-confirm":'Terminare la sessione "{name}"?',"cell-on":"tmux vivo","cell-off":"spenta","cell-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","state-on":"accesa","state-off":"spenta",engine:"Engine","boot-persist":"avvia al boot","remove-boot":"togli anche dal boot","no-remote-control":"⚠ engine non native: niente remote-control",cancel:"annulla",name:"nome","name-invalid":"nome non valido: a-zA-Z0-9._- max 64, senza '-' iniziale",cwd:"cwd",preset:"preset",create:"crea","auth-prompt":"Incolla il token (stampato dal server):","remember-device":"ricorda su questo device","zoom-out":"testo più piccolo","zoom-in":"testo più grande",composer:"composer",windows:"{n} finestre","empty-files":"vuota",upload:"carica","no-sessions-short":"nessuna sessione","composer-placeholder":"scrivi o detta…",voice:"voice",send:"invia",close:"chiudi","lang-label":"lingua"},en:{sessions:"sessions","new-session":"new session",new:"new",fleet:"Fleet","fleet-tmux":"tmux fleet","other-sessions":"Other sessions",files:"files",refresh:"refresh","filter-placeholder":"filter sessions…","loading-fleet":"loading fleet…","no-sessions":"no live tmux sessions — the fleet starts at boot (systemd)","no-match":'no session matches "{q}"',"copy-url":"click to copy URL","ssh-only":"SSH/VPN tunnel only","new-files-outbox":"new files in outbox",terminate:"terminate","terminate-confirm":'Terminate session "{name}"?',"cell-on":"tmux alive","cell-off":"off","cell-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","state-on":"running","state-off":"stopped",engine:"Engine","boot-persist":"start at boot","remove-boot":"also remove from boot","no-remote-control":"⚠ non-native engine: no remote-control",cancel:"cancel",name:"name","name-invalid":"invalid name: a-zA-Z0-9._- max 64, no leading '-'",cwd:"cwd",preset:"preset",create:"create","auth-prompt":"Paste the token (printed by the server):","remember-device":"remember on this device","zoom-out":"smaller text","zoom-in":"bigger text",composer:"composer",windows:"{n} windows","empty-files":"empty",upload:"upload","no-sessions-short":"no sessions","composer-placeholder":"type or dictate…",voice:"voice",send:"send",close:"close","lang-label":"language"},es:{sessions:"sesiones","new-session":"nueva sesión",new:"nueva",fleet:"Flota","fleet-tmux":"flota tmux","other-sessions":"Otras sesiones",files:"archivos",refresh:"actualizar","filter-placeholder":"filtrar sesiones…","loading-fleet":"cargando flota…","no-sessions":"sin sesiones tmux vivas — la flota arranca en el boot (systemd)","no-match":"ninguna sesión coincide con «{q}»","copy-url":"clic para copiar la URL","ssh-only":"solo túnel SSH/VPN","new-files-outbox":"archivos nuevos en outbox",terminate:"terminar","terminate-confirm":"¿Terminar la sesión «{name}»?","cell-on":"tmux activo","cell-off":"apagada","cell-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","state-on":"encendida","state-off":"apagada",engine:"Motor","boot-persist":"iniciar en el boot","remove-boot":"quitar también del boot","no-remote-control":"⚠ motor no native: sin remote-control",cancel:"cancelar",name:"nombre","name-invalid":"nombre inválido: a-zA-Z0-9._- máx 64, sin '-' inicial",cwd:"cwd",preset:"preset",create:"crear","auth-prompt":"Pega el token (impreso por el servidor):","remember-device":"recordar en este dispositivo","zoom-out":"texto más pequeño","zoom-in":"texto más grande",composer:"composer",windows:"{n} ventanas","empty-files":"vacía",upload:"subir","no-sessions-short":"sin sesiones","composer-placeholder":"escribe o dicta…",voice:"voz",send:"enviar",close:"cerrar","lang-label":"idioma"}};function ya(){const e=U_(),t=e?e.getItem(j_):null;return Zh.includes(t)?t:Tn}function wg(e){const t=U_();if(t)try{t.setItem(j_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(Sa))}function F(e){const t=ya(),i=_n[t]||_n[Tn];return Object.prototype.hasOwnProperty.call(i,e)?i[e]:Object.prototype.hasOwnProperty.call(_n[Tn],e)?_n[Tn][e]:e}function Cg(e){return typeof window>"u"?()=>{}:(window.addEventListener(Sa,e),()=>window.removeEventListener(Sa,e))}const K_=Zh;function Ni(){return[O.useSyncExternalStore(Cg,ya,ya),wg]}const xg=["native","glm","glm-a","glm-p","ollama","ollama-cloud","codex-vl"];function V_({cell:e,onConfirm:t,onClose:i}){Ni();const r=!!(e&&e.active),[s,n]=O.useState((e==null?void 0:e.engine)||"glm"),[o,l]=O.useState((e==null?void 0:e.boot)??!0),[h,a]=O.useState(!1),[d,c]=O.useState(null);async function f(u){u.preventDefault(),a(!0),c(null);try{r?await t({action:"down",boot:o}):await t({action:"up",engine:s,boot:o}),i()}catch(m){c(String(m&&m.message||m)),a(!1)}}return g.jsx("div",{className:"nc-sheet-overlay",onClick:i,children:g.jsxs("form",{className:"nc-sheet",onClick:u=>u.stopPropagation(),onSubmit:f,children:[g.jsxs("div",{className:"nc-sheet-head",children:[g.jsx("b",{children:e==null?void 0:e.cell}),g.jsx("span",{className:"nc-sheet-state",children:F(r?"state-on":"state-off")})]}),r?g.jsxs("label",{className:"nc-check",children:[g.jsx("input",{type:"checkbox",checked:o,onChange:u=>l(u.target.checked)}),F("remove-boot")]}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"nc-sheet-label",children:F("engine")}),g.jsx("div",{className:"nc-engines",children:xg.map(u=>g.jsxs("label",{className:`nc-engine${s===u?" sel":""}`,children:[g.jsx("input",{type:"radio",name:"ps-engine",checked:s===u,onChange:()=>n(u)}),u]},u))}),g.jsxs("label",{className:"nc-check",children:[g.jsx("input",{type:"checkbox",checked:o,onChange:u=>l(u.target.checked)}),F("boot-persist")]}),s!=="native"&&g.jsx("div",{className:"nc-note",children:F("no-remote-control")})]}),d&&g.jsx("div",{className:"nc-err",children:d}),g.jsxs("div",{className:"nc-sheet-actions",children:[g.jsx("button",{type:"button",className:"nc-btn ghost",onClick:i,disabled:h,children:F("cancel")}),g.jsx("button",{type:"submit",className:"nc-btn primary",disabled:h,children:F(r?"power-off":"power-on")})]})]})})}const kg=/^[\w.-]{1,64}$/;function q_({presets:e=["shell"],onCreate:t,onClose:i}){Ni();const[r,s]=O.useState(""),[n,o]=O.useState("~"),[l,h]=O.useState(e[0]||"shell"),[a,d]=O.useState(!1),[c,f]=O.useState(null),u=kg.test(r)&&!r.startsWith("-");async function m(S){if(S.preventDefault(),!!u){d(!0),f(null);try{await t({name:r,cwd:n==="~"?"":n,preset:l}),i()}catch(w){f(String(w&&w.message||w)),d(!1)}}}return g.jsx("div",{className:"nc-sheet-overlay",onClick:i,children:g.jsxs("form",{className:"nc-sheet",onClick:S=>S.stopPropagation(),onSubmit:m,children:[g.jsx("div",{className:"nc-sheet-head",children:g.jsx("b",{children:F("new-session")})}),g.jsxs("label",{className:"nc-field",children:[F("name"),g.jsx("input",{value:r,onChange:S=>s(S.target.value),autoFocus:!0,placeholder:"worker-1"})]}),r&&!u&&g.jsx("div",{className:"nc-err",children:F("name-invalid")}),g.jsxs("label",{className:"nc-field",children:[F("cwd"),g.jsx("input",{value:n,onChange:S=>o(S.target.value),placeholder:"~"})]}),g.jsxs("label",{className:"nc-field",children:[F("preset"),g.jsx("select",{value:l,onChange:S=>h(S.target.value),children:e.map(S=>g.jsx("option",{value:S,children:S},S))})]}),c&&g.jsx("div",{className:"nc-err",children:c}),g.jsxs("div",{className:"nc-sheet-actions",children:[g.jsx("button",{type:"button",className:"nc-btn ghost",onClick:i,disabled:a,children:F("cancel")}),g.jsx("button",{type:"submit",className:"nc-btn primary",disabled:a||!u,children:F("create")})]})]})})}function wu(e,t){return t?0:e.attached?1:2}function Cu(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function bg({onPick:e,token:t}){const[i,r]=Ni(),[s,n]=O.useState(null),[o,l]=O.useState(null),[h,a]=O.useState(""),[d,c]=O.useState(""),[f,u]=O.useState({bind:"127.0.0.1",port:""}),[m,S]=O.useState([]),[w,p]=O.useState(!1),[_,v]=O.useState(["shell","claude","codex-vl","pi"]),[y,C]=O.useState(null),[k,L]=O.useState(!1);async function M(){try{const H=await(await yt("/api/sessions",t)).json();H.error?(l(H.error),n([])):(l(null),n(H.sessions||[]))}catch(R){l(String(R)),n([])}try{const R=await Jh(t);p(!!R.available),S(R.available?R.cells||[]:[])}catch{p(!1),S([])}}O.useEffect(()=>{M(),yt("/api/config",t).then(H=>H.json()).then(H=>{c(H.version||""),u({bind:H.bind||"127.0.0.1",port:H.port||""}),Array.isArray(H.presets)&&H.presets.length&&v(H.presets)}).catch(()=>{});const R=setInterval(M,4e3);return()=>clearInterval(R)},[]);async function V(){if(!f.port)return;const R=`http://${f.bind}:${f.port}/#token=${t}`;try{await navigator.clipboard.writeText(R)}catch{}}async function W(R){if(!y)return;const{cell:H}=y;R.action==="up"?await $_(t,{cell:H,engine:R.engine,boot:!!R.boot}):await F_(t,{cell:H,boot:!!R.boot}),M()}async function U(R){try{await W_(t,R)}catch{return}M()}async function A(R){await H_(t,R),L(!1),M()}const E=O.useMemo(()=>{const R=new Map;for(const H of s||[])R.set(H.name,H);return R},[s]),P=O.useMemo(()=>new Set(m.map(R=>R.tmuxSession)),[m]),b=O.useMemo(()=>{const R=(s||[]).map(J=>{const Z=Number(localStorage.getItem(z_(J.name))||0),Fe=!!(J.outbox&&J.outbox.count>0&&J.outbox.latest>Z);return{...J,fresh:Fe}}),H=h.trim().toLowerCase();return R.filter(J=>!H||J.name.toLowerCase().includes(H)).sort((J,Z)=>wu(J,J.fresh)-wu(Z,Z.fresh)||J.name.localeCompare(Z.name))},[s,h]),N=b.filter(R=>!P.has(R.name)),K=O.useMemo(()=>[...m].sort((R,H)=>Number(H.active)-Number(R.active)||R.cell.localeCompare(H.cell)),[m]),x=s?s.length:0,z=(s||[]).filter(R=>R.attached).length,j=f.port?`${f.bind}:${f.port}`:f.bind;return g.jsxs("div",{className:"nc-home",children:[g.jsxs("header",{className:"nc-home-head",children:[g.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",g.jsx("span",{className:"nc-cursor"})]}),g.jsxs("div",{className:"nc-home-sub",children:[F("fleet-tmux")," · ",x," ",F("sessions"),z>0&&` · ${z} attached`]}),g.jsx("button",{className:"nc-refresh",onClick:M,title:F("refresh"),children:g.jsx(Pt,{name:"refresh",size:18})})]}),x>8&&g.jsx("input",{className:"nc-filter",type:"search",placeholder:F("filter-placeholder"),value:h,onChange:R=>a(R.target.value)}),o&&g.jsx("div",{className:"nc-err",children:o}),w&&m.length>0&&g.jsxs("section",{className:"nc-group",children:[g.jsx("div",{className:"nc-group-title",children:F("fleet")}),K.map(R=>{const H=E.get(R.tmuxSession)||{},J=R.degraded?"warn":R.tmux?"on":"",Z=[`${R.engine}${R.key?`·${R.key}`:""}`,H.preview].filter(Boolean).join(" · ");return g.jsxs("div",{className:"nc-mcard",children:[g.jsxs("button",{className:"nc-mcard-main",onClick:()=>R.tmux&&e(R.tmuxSession),title:R.degraded?F("cell-degraded"):R.tmux?F("cell-on"):F("cell-off"),children:[g.jsx("span",{className:`dot ${J}`}),g.jsxs("span",{className:"nc-mcard-text",children:[g.jsx("b",{children:R.cell}),g.jsx("small",{children:Z})]})]}),H.activity?g.jsx("span",{className:"nc-rel",children:Cu(H.activity)}):null,H.outbox&&H.outbox.count>0&&g.jsx("span",{className:"nc-badge",title:F("new-files-outbox"),children:H.outbox.count}),g.jsx("button",{className:"nc-power",onClick:()=>C(R),title:R.active?F("power-off"):F("power-on"),children:"⏻"})]},R.cell)})]}),g.jsxs("section",{className:"nc-group",children:[w&&g.jsx("div",{className:"nc-group-title",children:F("other-sessions")}),N.map(R=>g.jsxs("div",{className:"nc-mcard",children:[g.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(R.name),children:[g.jsx("span",{className:R.attached?"dot on":"dot"}),g.jsxs("span",{className:"nc-mcard-text",children:[g.jsx("b",{children:R.name}),g.jsx("small",{children:R.preview?R.preview:R.cmd?R.cmd:F("windows").replace("{n}",String(R.windows||0))})]})]}),R.activity?g.jsx("span",{className:"nc-rel",children:Cu(R.activity)}):null,R.fresh&&g.jsx("span",{className:"nc-badge",title:F("new-files-outbox"),children:R.outbox.count}),g.jsx("button",{className:"nc-menu",title:F("terminate"),onClick:()=>{window.confirm(F("terminate-confirm").replace("{name}",R.name))&&U(R.name)},children:"⋯"})]},R.name)),s===null&&g.jsx("div",{className:"nc-empty",children:F("loading-fleet")}),s!==null&&N.length===0&&b.length===0&&!o&&g.jsx("div",{className:"nc-empty",children:h?F("no-match").replace("{q}",h):F("no-sessions")})]}),g.jsxs("footer",{className:"nc-home-foot",onClick:V,title:F("copy-url"),children:[d&&g.jsxs("span",{children:["v",d]}),g.jsxs("span",{children:[j," · ",F("ssh-only")]}),g.jsx("span",{className:"nc-lang",onClick:R=>R.stopPropagation(),children:K_.map((R,H)=>g.jsxs("span",{children:[H>0&&" · ",g.jsx("button",{className:`nc-lang-btn${i===R?" on":""}`,onClick:()=>r(R),title:R,children:R.toUpperCase()})]},R))})]}),g.jsx("button",{className:"nc-fab",onClick:()=>L(!0),title:F("new-session"),"aria-label":F("new-session"),children:"+"}),y&&g.jsx(V_,{cell:y,onConfirm:W,onClose:()=>C(null)}),k&&g.jsx(q_,{presets:_,onCreate:A,onClose:()=>L(!1)})]})}/**
41
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
42
+ * @license MIT
43
+ *
44
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
45
+ * @license MIT
46
+ *
47
+ * Originally forked from (with the author's permission):
48
+ * Fabrice Bellard's javascript vt100 for jslinux:
49
+ * http://bellard.org/jslinux/
50
+ * Copyright (c) 2011 Fabrice Bellard
51
+ */var Y_=Object.defineProperty,Eg=Object.getOwnPropertyDescriptor,Dg=(e,t)=>{for(var i in t)Y_(e,i,{get:t[i],enumerable:!0})},me=(e,t,i,r)=>{for(var s=r>1?void 0:r?Eg(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=(r?o(t,i,s):o(s))||s);return r&&s&&Y_(t,i,s),s},I=(e,t)=>(i,r)=>t(i,r,e),xu="Terminal input",wa={get:()=>xu,set:e=>xu=e},ku="Too much output to announce, navigate to rows manually to read",Ca={get:()=>ku,set:e=>ku=e};function Lg(e){return e.replace(/\r?\n/g,"\r")}function Rg(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Pg(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Mg(e,t,i,r){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");X_(s,t,i,r)}}function X_(e,t,i,r){e=Lg(e),e=Rg(e,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function G_(e,t,i){let r=i.getBoundingClientRect(),s=e.clientX-r.left-10,n=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function bu(e,t,i,r,s){G_(e,t,i),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function _i(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function No(e,t=0,i=e.length){let r="";for(let s=t;s<i;++s){let n=e[s];n>65535?(n-=65536,r+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):r+=String.fromCharCode(n)}return r}var Bg=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let r=0,s=0;if(this._interim){let n=e.charCodeAt(s++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let n=s;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,r;let l=e.charCodeAt(n);56320<=l&&l<=57343?t[r++]=(o-55296)*1024+l-56320+65536:(t[r++]=o,t[r++]=l);continue}o!==65279&&(t[r++]=o)}return r}},Tg=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let r=0,s,n,o,l,h=0,a=0;if(this.interim[0]){let f=!1,u=this.interim[0];u&=(u&224)===192?31:(u&240)===224?15:7;let m=0,S;for(;(S=this.interim[++m]&63)&&m<4;)u<<=6,u|=S;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,p=w-m;for(;a<p;){if(a>=i)return 0;if(S=e[a++],(S&192)!==128){a--,f=!0;break}else this.interim[m++]=S,u<<=6,u|=S&63}f||(w===2?u<128?a--:t[r++]=u:w===3?u<2048||u>=55296&&u<=57343||u===65279||(t[r++]=u):u<65536||u>1114111||(t[r++]=u)),this.interim.fill(0)}let d=i-4,c=a;for(;c<i;){for(;c<d&&!((s=e[c])&128)&&!((n=e[c+1])&128)&&!((o=e[c+2])&128)&&!((l=e[c+3])&128);)t[r++]=s,t[r++]=n,t[r++]=o,t[r++]=l,c+=4;if(s=e[c++],s<128)t[r++]=s;else if((s&224)===192){if(c>=i)return this.interim[0]=s,r;if(n=e[c++],(n&192)!==128){c--;continue}if(h=(s&31)<<6|n&63,h<128){c--;continue}t[r++]=h}else if((s&240)===224){if(c>=i)return this.interim[0]=s,r;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=e[c++],(o&192)!==128){c--;continue}if(h=(s&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[r++]=h}else if((s&248)===240){if(c>=i)return this.interim[0]=s,r;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=e[c++],(o&192)!==128){c--;continue}if(c>=i)return this.interim[0]=s,this.interim[1]=n,this.interim[2]=o,r;if(l=e[c++],(l&192)!==128){c--;continue}if(h=(s&7)<<18|(n&63)<<12|(o&63)<<6|l&63,h<65536||h>1114111)continue;t[r++]=h}}return r}},Q_="",Si=" ",Ks=class J_{constructor(){this.fg=0,this.bg=0,this.extended=new co}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new J_;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},co=class Z_{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Z_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ct=class ep extends Ks{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new co,this.combinedData=""}static fromCharData(t){let i=new ep;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?_i(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Eu="di$target",xa="di$dependencies",fl=new Map;function Ng(e){return e[xa]||[]}function Ne(e){if(fl.has(e))return fl.get(e);let t=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Og(t,i,s)};return t._id=e,fl.set(e,t),t}function Og(e,t,i){t[Eu]===t?t[xa].push({id:e,index:i}):(t[xa]=[{id:e,index:i}],t[Eu]=t)}var Qe=Ne("BufferService"),tp=Ne("CoreMouseService"),ir=Ne("CoreService"),Ag=Ne("CharsetService"),ec=Ne("InstantiationService"),ip=Ne("LogService"),Je=Ne("OptionsService"),rp=Ne("OscLinkService"),Ig=Ne("UnicodeService"),Vs=Ne("DecorationService"),ka=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var d;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,n=new Ct,o=i.getTrimmedLength(),l=-1,h=-1,a=!1;for(let c=0;c<o;c++)if(!(h===-1&&!i.hasContent(c))){if(i.loadCell(c,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=c,l=n.extended.urlId;continue}else a=n.extended.urlId!==l;else h!==-1&&(a=!0);if(a||h!==-1&&c===o-1){let f=(d=this._oscLinkService.getLinkData(l))==null?void 0:d.uri;if(f){let u={start:{x:h+1,y:e},end:{x:c+(!a&&c===o-1?1:0),y:e}},m=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let S=new URL(f);["http:","https:"].includes(S.protocol)||(m=!0)}catch{m=!0}m||r.push({text:f,range:u,activate:(S,w)=>s?s.activate(S,w,u):zg(S,w),hover:(S,w)=>{var p;return(p=s==null?void 0:s.hover)==null?void 0:p.call(s,S,w,u)},leave:(S,w)=>{var p;return(p=s==null?void 0:s.leave)==null?void 0:p.call(s,S,w,u)}})}a=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=c,l=n.extended.urlId):(h=-1,l=-1)}}t(r)}};ka=me([I(0,Qe),I(1,Je),I(2,rp)],ka);function zg(e,t){if(confirm(`Do you want to navigate to ${t}?
52
+
53
+ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Oo=Ne("CharSizeService"),si=Ne("CoreBrowserService"),tc=Ne("MouseService"),ni=Ne("RenderService"),$g=Ne("SelectionService"),sp=Ne("CharacterJoinerService"),Ar=Ne("ThemeService"),np=Ne("LinkProviderService"),Fg=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Du.isErrorNoTelemetry(e)?new Du(e.message+`
54
+
55
+ `+e.stack):new Error(e.message+`
56
+
57
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Hg=new Fg;function Nn(e){Wg(e)||Hg.onUnexpectedError(e)}var ba="Canceled";function Wg(e){return e instanceof jg?!0:e instanceof Error&&e.name===ba&&e.message===ba}var jg=class extends Error{constructor(){super(ba),this.name=this.message}};function Ug(e){return new Error(`Illegal argument: ${e}`)}var Du=class Ea extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ea)return t;let i=new Ea;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Da=class op extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,op.prototype)}};function nt(e,t=0){return e[e.length-(1+t)]}var Kg;(e=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function r(n){return n>0}e.isGreaterThan=r;function s(n){return n===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Kg||(Kg={}));function Vg(e,t){let i=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(i,arguments))),s}}var lp;(e=>{function t(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*s(y){yield y}e.single=s;function n(y){return t(y)?y:s(y)}e.wrap=n;function o(y){return y||i}e.from=o;function*l(y){for(let C=y.length-1;C>=0;C--)yield y[C]}e.reverse=l;function h(y){return!y||y[Symbol.iterator]().next().done===!0}e.isEmpty=h;function a(y){return y[Symbol.iterator]().next().value}e.first=a;function d(y,C){let k=0;for(let L of y)if(C(L,k++))return!0;return!1}e.some=d;function c(y,C){for(let k of y)if(C(k))return k}e.find=c;function*f(y,C){for(let k of y)C(k)&&(yield k)}e.filter=f;function*u(y,C){let k=0;for(let L of y)yield C(L,k++)}e.map=u;function*m(y,C){let k=0;for(let L of y)yield*C(L,k++)}e.flatMap=m;function*S(...y){for(let C of y)yield*C}e.concat=S;function w(y,C,k){let L=k;for(let M of y)L=C(L,M);return L}e.reduce=w;function*p(y,C,k=y.length){for(C<0&&(C+=y.length),k<0?k+=y.length:k>y.length&&(k=y.length);C<k;C++)yield y[C]}e.slice=p;function _(y,C=Number.POSITIVE_INFINITY){let k=[];if(C===0)return[k,y];let L=y[Symbol.iterator]();for(let M=0;M<C;M++){let V=L.next();if(V.done)return[k,e.empty()];k.push(V.value)}return[k,{[Symbol.iterator](){return L}}]}e.consume=_;async function v(y){let C=[];for await(let k of y)C.push(k);return Promise.resolve(C)}e.asyncToArray=v})(lp||(lp={}));function Ji(e){if(lp.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function qg(...e){return ae(()=>Ji(e))}function ae(e){return{dispose:Vg(()=>{e()})}}var ap=class hp{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{Ji(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?hp.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};ap.DISABLE_DISPOSED_WARNING=!1;var Li=ap,X=class{constructor(){this._store=new Li,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)}};X.None=Object.freeze({dispose(){}});var Br=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.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}},Qt=typeof window=="object"?window:globalThis,La=class Ra{constructor(t){this.element=t,this.next=Ra.Undefined,this.prev=Ra.Undefined}};La.Undefined=new La(void 0);var he=La,Lu=class{constructor(){this._first=he.Undefined,this._last=he.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===he.Undefined}clear(){let e=this._first;for(;e!==he.Undefined;){let t=e.next;e.prev=he.Undefined,e.next=he.Undefined,e=t}this._first=he.Undefined,this._last=he.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new he(e);if(this._first===he.Undefined)this._first=i,this._last=i;else if(t){let s=this._last;this._last=i,i.prev=s,s.next=i}else{let s=this._first;this._first=i,i.next=s,s.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==he.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==he.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==he.Undefined&&e.next!==he.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===he.Undefined&&e.next===he.Undefined?(this._first=he.Undefined,this._last=he.Undefined):e.next===he.Undefined?(this._last=this._last.prev,this._last.next=he.Undefined):e.prev===he.Undefined&&(this._first=this._first.next,this._first.prev=he.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==he.Undefined;)yield e.element,e=e.next}},Yg=globalThis.performance&&typeof globalThis.performance.now=="function",Xg=class cp{static create(t){return new cp(t)}constructor(t){this._now=Yg&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ie;(e=>{e.None=()=>X.None;function t(A,E){return c(A,()=>{},0,void 0,!0,void 0,E)}e.defer=t;function i(A){return(E,P=null,b)=>{let N=!1,K;return K=A(x=>{if(!N)return K?K.dispose():N=!0,E.call(P,x)},null,b),N&&K.dispose(),K}}e.once=i;function r(A,E,P){return a((b,N=null,K)=>A(x=>b.call(N,E(x)),null,K),P)}e.map=r;function s(A,E,P){return a((b,N=null,K)=>A(x=>{E(x),b.call(N,x)},null,K),P)}e.forEach=s;function n(A,E,P){return a((b,N=null,K)=>A(x=>E(x)&&b.call(N,x),null,K),P)}e.filter=n;function o(A){return A}e.signal=o;function l(...A){return(E,P=null,b)=>{let N=qg(...A.map(K=>K(x=>E.call(P,x))));return d(N,b)}}e.any=l;function h(A,E,P,b){let N=P;return r(A,K=>(N=E(N,K),N),b)}e.reduce=h;function a(A,E){let P,b={onWillAddFirstListener(){P=A(N.fire,N)},onDidRemoveLastListener(){P==null||P.dispose()}},N=new T(b);return E==null||E.add(N),N.event}function d(A,E){return E instanceof Array?E.push(A):E&&E.add(A),A}function c(A,E,P=100,b=!1,N=!1,K,x){let z,j,R,H=0,J,Z={leakWarningThreshold:K,onWillAddFirstListener(){z=A(Se=>{H++,j=E(j,Se),b&&!R&&(Fe.fire(j),j=void 0),J=()=>{let ft=j;j=void 0,R=void 0,(!b||H>1)&&Fe.fire(ft),H=0},typeof P=="number"?(clearTimeout(R),R=setTimeout(J,P)):R===void 0&&(R=0,queueMicrotask(J))})},onWillRemoveListener(){N&&H>0&&(J==null||J())},onDidRemoveLastListener(){J=void 0,z.dispose()}},Fe=new T(Z);return x==null||x.add(Fe),Fe.event}e.debounce=c;function f(A,E=0,P){return e.debounce(A,(b,N)=>b?(b.push(N),b):[N],E,void 0,!0,void 0,P)}e.accumulate=f;function u(A,E=(b,N)=>b===N,P){let b=!0,N;return n(A,K=>{let x=b||!E(K,N);return b=!1,N=K,x},P)}e.latch=u;function m(A,E,P){return[e.filter(A,E,P),e.filter(A,b=>!E(b),P)]}e.split=m;function S(A,E=!1,P=[],b){let N=P.slice(),K=A(j=>{N?N.push(j):z.fire(j)});b&&b.add(K);let x=()=>{N==null||N.forEach(j=>z.fire(j)),N=null},z=new T({onWillAddFirstListener(){K||(K=A(j=>z.fire(j)),b&&b.add(K))},onDidAddFirstListener(){N&&(E?setTimeout(x):x())},onDidRemoveLastListener(){K&&K.dispose(),K=null}});return b&&b.add(z),z.event}e.buffer=S;function w(A,E){return(P,b,N)=>{let K=E(new _);return A(function(x){let z=K.evaluate(x);z!==p&&P.call(b,z)},void 0,N)}}e.chain=w;let p=Symbol("HaltChainable");class _{constructor(){this.steps=[]}map(E){return this.steps.push(E),this}forEach(E){return this.steps.push(P=>(E(P),P)),this}filter(E){return this.steps.push(P=>E(P)?P:p),this}reduce(E,P){let b=P;return this.steps.push(N=>(b=E(b,N),b)),this}latch(E=(P,b)=>P===b){let P=!0,b;return this.steps.push(N=>{let K=P||!E(N,b);return P=!1,b=N,K?N:p}),this}evaluate(E){for(let P of this.steps)if(E=P(E),E===p)break;return E}}function v(A,E,P=b=>b){let b=(...z)=>x.fire(P(...z)),N=()=>A.on(E,b),K=()=>A.removeListener(E,b),x=new T({onWillAddFirstListener:N,onDidRemoveLastListener:K});return x.event}e.fromNodeEventEmitter=v;function y(A,E,P=b=>b){let b=(...z)=>x.fire(P(...z)),N=()=>A.addEventListener(E,b),K=()=>A.removeEventListener(E,b),x=new T({onWillAddFirstListener:N,onDidRemoveLastListener:K});return x.event}e.fromDOMEventEmitter=y;function C(A){return new Promise(E=>i(A)(E))}e.toPromise=C;function k(A){let E=new T;return A.then(P=>{E.fire(P)},()=>{E.fire(void 0)}).finally(()=>{E.dispose()}),E.event}e.fromPromise=k;function L(A,E){return A(P=>E.fire(P))}e.forward=L;function M(A,E,P){return E(P),A(b=>E(b))}e.runAndSubscribe=M;class V{constructor(E,P){this._observable=E,this._counter=0,this._hasChanged=!1;let b={onWillAddFirstListener:()=>{E.addObserver(this)},onDidRemoveLastListener:()=>{E.removeObserver(this)}};this.emitter=new T(b),P&&P.add(this.emitter)}beginUpdate(E){this._counter++}handlePossibleChange(E){}handleChange(E,P){this._hasChanged=!0}endUpdate(E){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function W(A,E){return new V(A,E).emitter.event}e.fromObservable=W;function U(A){return(E,P,b)=>{let N=0,K=!1,x={beginUpdate(){N++},endUpdate(){N--,N===0&&(A.reportChanges(),K&&(K=!1,E.call(P)))},handlePossibleChange(){},handleChange(){K=!0}};A.addObserver(x),A.reportChanges();let z={dispose(){A.removeObserver(x)}};return b instanceof Li?b.add(z):Array.isArray(b)&&b.push(z),z}}e.fromObservableLight=U})(Ie||(Ie={}));var Pa=class Ma{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ma._idPool++}`,Ma.all.add(this)}start(t){this._stopWatch=new Xg,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Pa.all=new Set,Pa._idPool=0;var Gg=Pa,Qg=-1,up=class dp{constructor(t,i,r=(dp._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let h=new eS(l,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[r,s]of this._stacks)(!t||i<s)&&(t=[r,s],i=s);return t}};up._idPool=1;var Jg=up,Zg=class fp{constructor(t){this.value=t}static create(){let t=new Error;return new fp(t.stack??"")}print(){console.warn(this.value.split(`
58
+ `).slice(2).join(`
59
+ `))}},eS=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},tS=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},iS=0,_l=class{constructor(e){this.value=e,this.id=iS++}},rS=2,sS,T=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new Jg((e==null?void 0:e.onListenerError)??Nn,((i=this._options)==null?void 0:i.leakWarningThreshold)??Qg):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new Gg(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,i,r;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),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var o,l,h,a,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let c=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(c);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],u=new tS(`${c}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Nn)(u),X.None}if(this._disposed)return X.None;t&&(e=e.bind(t));let r=new _l(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Zg.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof _l?(this._deliveryQueue??(this._deliveryQueue=new nS),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||h.call(l,this),this._listeners=r,(d=(a=this._options)==null?void 0:a.onDidAddFirstListener)==null||d.call(a,this)),this._size++;let n=ae(()=>{s==null||s(),this._removeListener(r)});return i instanceof Li?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(e){var s,n,o,l;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,(l=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||l.call(o,this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);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--,t[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*rS<=t.length){let h=0;for(let a=0;a<t.length;a++)t[a]?t[h++]=t[a]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let i=((r=this._options)==null?void 0:r.onListenerError)||Nn;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,r,s;if((t=this._deliveryQueue)!=null&&t.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 _l)this._deliver(this._listeners,e);else{let n=this._deliveryQueue;n.enqueue(this,e,this._listeners.length),this._deliverQueue(n)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},nS=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ba=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new T,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new T,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Ba.INSTANCE=new Ba;var ic=Ba;function oS(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}ic.INSTANCE.onDidChangeZoomLevel;function lS(e){return ic.INSTANCE.getZoomFactor(e)}ic.INSTANCE.onDidChangeFullscreen;var Ir=typeof navigator=="object"?navigator.userAgent:"",Ta=Ir.indexOf("Firefox")>=0,aS=Ir.indexOf("AppleWebKit")>=0,rc=Ir.indexOf("Chrome")>=0,hS=!rc&&Ir.indexOf("Safari")>=0;Ir.indexOf("Electron/")>=0;Ir.indexOf("Android")>=0;var pl=!1;if(typeof Qt.matchMedia=="function"){let e=Qt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Qt.matchMedia("(display-mode: fullscreen)");pl=e.matches,oS(Qt,e,({matches:i})=>{pl&&t.matches||(pl=i)})}var gr="en",Na=!1,Oa=!1,On=!1,_p=!1,pn,An=gr,Ru=gr,cS,Et,Vi=globalThis,Ae,Cd;typeof Vi.vscode<"u"&&typeof Vi.vscode.process<"u"?Ae=Vi.vscode.process:typeof process<"u"&&typeof((Cd=process==null?void 0:process.versions)==null?void 0:Cd.node)=="string"&&(Ae=process);var xd,uS=typeof((xd=Ae==null?void 0:Ae.versions)==null?void 0:xd.electron)=="string",dS=uS&&(Ae==null?void 0:Ae.type)==="renderer",kd;if(typeof Ae=="object"){Na=Ae.platform==="win32",Oa=Ae.platform==="darwin",On=Ae.platform==="linux",On&&Ae.env.SNAP&&Ae.env.SNAP_REVISION,Ae.env.CI||Ae.env.BUILD_ARTIFACTSTAGINGDIRECTORY,pn=gr,An=gr;let e=Ae.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);pn=t.userLocale,Ru=t.osLocale,An=t.resolvedLanguage||gr,cS=(kd=t.languagePack)==null?void 0:kd.translationsConfigFile}catch{}_p=!0}else typeof navigator=="object"&&!dS?(Et=navigator.userAgent,Na=Et.indexOf("Windows")>=0,Oa=Et.indexOf("Macintosh")>=0,(Et.indexOf("Macintosh")>=0||Et.indexOf("iPad")>=0||Et.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,On=Et.indexOf("Linux")>=0,(Et==null?void 0:Et.indexOf("Mobi"))>=0,An=globalThis._VSCODE_NLS_LANGUAGE||gr,pn=navigator.language.toLowerCase(),Ru=pn):console.error("Unable to resolve platform.");var pp=Na,jt=Oa,fS=On,Pu=_p,Ut=Et,hi=An,_S;(e=>{function t(){return hi}e.value=t;function i(){return hi.length===2?hi==="en":hi.length>=3?hi[0]==="e"&&hi[1]==="n"&&hi[2]==="-":!1}e.isDefaultVariant=i;function r(){return hi==="en"}e.isDefault=r})(_S||(_S={}));var pS=typeof Vi.postMessage=="function"&&!Vi.importScripts;(()=>{if(pS){let e=[];Vi.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let n=e[r];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),n.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),Vi.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var mS=!!(Ut&&Ut.indexOf("Chrome")>=0);Ut&&Ut.indexOf("Firefox")>=0;!mS&&Ut&&Ut.indexOf("Safari")>=0;Ut&&Ut.indexOf("Edg/")>=0;Ut&&Ut.indexOf("Android")>=0;var sr=typeof navigator=="object"?navigator:{};Pu||document.queryCommandSupported&&document.queryCommandSupported("copy")||sr&&sr.clipboard&&sr.clipboard.writeText,Pu||sr&&sr.clipboard&&sr.clipboard.readText;var sc=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ml=new sc,Mu=new sc,Bu=new sc,vS=new Array(230),mp;(e=>{function t(l){return ml.keyCodeToStr(l)}e.toString=t;function i(l){return ml.strToKeyCode(l)}e.fromString=i;function r(l){return Mu.keyCodeToStr(l)}e.toUserSettingsUS=r;function s(l){return Bu.keyCodeToStr(l)}e.toUserSettingsGeneral=s;function n(l){return Mu.strToKeyCode(l)||Bu.strToKeyCode(l)}e.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ml.keyCodeToStr(l)}e.toElectronAccelerator=o})(mp||(mp={}));var gS=class vp{constructor(t,i,r,s,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(t){return t instanceof vp&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${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 SS([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},SS=class{constructor(e){if(e.length===0)throw Ug("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function yS(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return mp.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(Ta)switch(t){case 59:return 85;case 60:if(fS)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(jt)return 57;break}else if(aS&&(jt&&t===93||!jt&&t===92))return 57;return vS[t]||0}var wS=jt?256:2048,CS=512,xS=1024,kS=jt?2048:256,Tu=class{constructor(e){var i;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=yS(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=wS),this.altKey&&(t|=CS),this.shiftKey&&(t|=xS),this.metaKey&&(t|=kS),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new gS(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Nu=new WeakMap;function bS(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var ES=class{static getSameOriginWindowChain(e){let t=Nu.get(e);if(!t){t=[],Nu.set(e,t);let i=e,r;do r=bS(i),r?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,r=0,s=this.getSameOriginWindowChain(e);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===t||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();i+=l.top,r+=l.left}return{top:i,left:r}}},mn=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=ES.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ou=class{constructor(e,t=0,i=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let r=!1;if(rc){let n=navigator.userAgent.match(/Chrome\/(\d+)/);r=(n?parseInt(n[1]):123)<=122}if(e){let n=e,o=e,l=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")r?this.deltaY=n.wheelDeltaY/(120*l):this.deltaY=n.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?Ta&&!jt?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")hS&&pp?this.deltaX=-(n.wheelDeltaX/120):r?this.deltaX=n.wheelDeltaX/(120*l):this.deltaX=n.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?Ta&&!jt?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},gp=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),DS;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof LS?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ie.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:gp})})(DS||(DS={}));var LS=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?gp:(this._emitter||(this._emitter=new T),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},nc=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Da("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Da("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},RS=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Da("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=ae(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},PS;(e=>{async function t(r){let s,n=await Promise.all(r.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return n}e.settled=t;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}e.withAsyncBody=i})(PS||(PS={}));var Au=class pt{static fromArray(t){return new pt(i=>{i.emitMany(t)})}static fromPromise(t){return new pt(async i=>{i.emitMany(await t)})}static fromPromises(t){return new pt(async i=>{await Promise.all(t.map(async r=>i.emitOne(await r)))})}static merge(t){return new pt(async i=>{await Promise.all(t.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new T,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ie.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(t,i){return new pt(async r=>{for await(let s of t)r.emitOne(i(s))})}map(t){return pt.map(this,t)}static filter(t,i){return new pt(async r=>{for await(let s of t)i(s)&&r.emitOne(s)})}filter(t){return pt.filter(this,t)}static coalesce(t){return pt.filter(t,i=>!!i)}coalesce(){return pt.coalesce(this)}static async toPromise(t){let i=[];for await(let r of t)i.push(r);return i}toPromise(){return pt.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Au.EMPTY=Au.fromArray([]);var{getWindow:Ft,getWindowId:MS,onDidRegisterWindow:BS}=function(){let e=new Map,t={window:Qt,disposables:new Li};e.set(Qt.vscodeWindowId,t);let i=new T,r=new T,s=new T;function n(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return X.None;let l=new Li,h={window:o,disposables:l.add(new Li)};return e.set(o.vscodeWindowId,h),l.add(ae(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),l.add(q(o,Le.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(h),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){var a;let l=o;if((a=l==null?void 0:l.ownerDocument)!=null&&a.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:Qt},getDocument(o){return Ft(o).document}}}(),TS=class{constructor(e,t,i,r){this._node=e,this._type=t,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 q(e,t,i,r){return new TS(e,t,i,r)}var Iu=function(e,t,i,r){return q(e,t,i,r)},oc,NS=class extends RS{constructor(e){super(),this.defaultTarget=e&&Ft(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},zu=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Nn(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,r=new Map,s=n=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),r.set(n,!0);o.length>0;)o.sort(zu.sort),o.shift().execute();r.set(n,!1)};oc=(n,o,l=0)=>{let h=MS(n),a=new zu(o,l),d=e.get(h);return d||(d=[],e.set(h,d)),d.push(a),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>s(h))),a}})();function OS(e){let t=e.getBoundingClientRect(),i=Ft(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Le={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"},AS=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Ze(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ze(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ze(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ze(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ze(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ze(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ze(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ze(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ze(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ze(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ze(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ze(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ze(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ze(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ze(e){return typeof e=="number"?`${e}px`:e}function vs(e){return new AS(e)}var Sp=class{constructor(){this._hooks=new Li,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let n=e;try{e.setPointerCapture(t),this._hooks.add(ae(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=Ft(e)}this._hooks.add(q(n,Le.POINTER_MOVE,o=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(q(n,Le.POINTER_UP,o=>this.stopMonitoring(!0)))}};function IS(e,t,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$${t}`;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 It;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(It||(It={}));var rs=class je extends X{constructor(){super(),this.dispatched=!1,this.targets=new Lu,this.ignoreTargets=new Lu,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ie.runAndSubscribe(BS,({window:t,disposables:i})=>{i.add(q(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(q(t.document,"touchend",r=>this.onTouchEnd(t,r))),i.add(q(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Qt,disposables:this._store}))}static addTarget(t){if(!je.isTouchDevice())return X.None;je.INSTANCE||(je.INSTANCE=new je);let i=je.INSTANCE.targets.push(t);return ae(i)}static ignoreTarget(t){if(!je.isTouchDevice())return X.None;je.INSTANCE||(je.INSTANCE=new je);let i=je.INSTANCE.ignoreTargets.push(t);return ae(i)}static isTouchDevice(){return"ontouchstart"in Qt||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=t.targetTouches.length;r<s;r++){let n=t.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(It.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let l=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let h=this.activeTouches[l.identifier],a=Date.now()-h.initialTimeStamp;if(a<je.HOLD_DELAY&&Math.abs(h.initialPageX-nt(h.rollingPageX))<30&&Math.abs(h.initialPageY-nt(h.rollingPageY))<30){let d=this.newGestureEvent(It.Tap,h.initialTarget);d.pageX=nt(h.rollingPageX),d.pageY=nt(h.rollingPageY),this.dispatchEvent(d)}else if(a>=je.HOLD_DELAY&&Math.abs(h.initialPageX-nt(h.rollingPageX))<30&&Math.abs(h.initialPageY-nt(h.rollingPageY))<30){let d=this.newGestureEvent(It.Contextmenu,h.initialTarget);d.pageX=nt(h.rollingPageX),d.pageY=nt(h.rollingPageY),this.dispatchEvent(d)}else if(s===1){let d=nt(h.rollingPageX),c=nt(h.rollingPageY),f=nt(h.rollingTimestamps)-h.rollingTimestamps[0],u=d-h.rollingPageX[0],m=c-h.rollingPageY[0],S=[...this.targets].filter(w=>h.initialTarget instanceof Node&&w.contains(h.initialTarget));this.inertia(t,S,r,Math.abs(u)/f,u>0?1:-1,d,Math.abs(m)/f,m>0?1:-1,c)}this.dispatchEvent(this.newGestureEvent(It.End,h.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(t){if(t.type===It.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>je.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,t.tapCount=r}else(t.type===It.Change||t.type===It.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,n=t.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(t),this.dispatched=!0}}inertia(t,i,r,s,n,o,l,h,a){this.handle=oc(t,()=>{let d=Date.now(),c=d-r,f=0,u=0,m=!0;s+=je.SCROLL_FRICTION*c,l+=je.SCROLL_FRICTION*c,s>0&&(m=!1,f=n*s*c),l>0&&(m=!1,u=h*l*c);let S=this.newGestureEvent(It.Change);S.translationX=f,S.translationY=u,i.forEach(w=>w.dispatchEvent(S)),m||this.inertia(t,i,d,s,n,o+f,l,h,a+u)})}onTouchMove(t){let i=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let n=t.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],l=this.newGestureEvent(It.Change,o.initialTarget);l.translationX=n.pageX-nt(o.rollingPageX),l.translationY=n.pageY-nt(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),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&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};rs.SCROLL_FRICTION=-.005,rs.HOLD_DELAY=700,rs.CLEAR_TAP_COUNT_TIME=400,me([IS],rs,"isTouchDevice",1);var zS=rs,lc=class extends X{onclick(e,t){this._register(q(e,Le.CLICK,i=>t(new mn(Ft(e),i))))}onmousedown(e,t){this._register(q(e,Le.MOUSE_DOWN,i=>t(new mn(Ft(e),i))))}onmouseover(e,t){this._register(q(e,Le.MOUSE_OVER,i=>t(new mn(Ft(e),i))))}onmouseleave(e,t){this._register(q(e,Le.MOUSE_LEAVE,i=>t(new mn(Ft(e),i))))}onkeydown(e,t){this._register(q(e,Le.KEY_DOWN,i=>t(new Tu(i))))}onkeyup(e,t){this._register(q(e,Le.KEY_UP,i=>t(new Tu(i))))}oninput(e,t){this._register(q(e,Le.INPUT,t))}onblur(e,t){this._register(q(e,Le.BLUR,t))}onfocus(e,t){this._register(q(e,Le.FOCUS,t))}onchange(e,t){this._register(q(e,Le.CHANGE,t))}ignoreGesture(e){return zS.ignoreTarget(e)}},$u=11,$S=class extends lc{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=$u+"px",this.domNode.style.height=$u+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Sp),this._register(Iu(this.bgDomNode,Le.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Iu(this.domNode,Le.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new NS),this._pointerdownScheduleRepeatTimer=this._register(new nc)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ft(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},FS=class Aa{constructor(t,i,r,s,n,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,s=s|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new Aa(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Aa(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,i){let r=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,h=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:h}}},HS=class extends X{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new FS(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let i=this._state.withScrollDimensions(e,t);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(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;t?r=new Hu(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(e);this._smoothScrolling=Hu.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 e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},Fu=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function vl(e,t){let i=t-e;return function(r){return e+i*US(r)}}function WS(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}var Hu=class Ia{constructor(t,i,r,s){this.from=t,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(t,i,r){if(Math.abs(t-i)>2.5*r){let s,n;return t<i?(s=t+.75*r,n=i-.75*r):(s=t-.75*r,n=i+.75*r),WS(vl(t,s),vl(n,i),.33)}return vl(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),s=this.scrollTop(i);return new Fu(r,s,!1)}return new Fu(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return Ia.start(t,i,r)}static start(t,i,r){r=r+10;let s=Date.now()-10;return new Ia(t,i,s,r)}};function jS(e){return Math.pow(e,3)}function US(e){return 1-jS(1-e)}var KS=class extends X{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new nc)}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 t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},VS=140,yp=class extends lc{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 KS(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Sp),this._shouldRender=!0,this.domNode=vs(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(q(this.domNode.domNode,Le.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new $S(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=vs(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(q(this.slider.domNode,Le.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let s=OS(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}let r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let n=this._sliderOrthogonalPointerPosition(s),o=Math.abs(n-i);if(pp&&o>VS){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let l=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},wp=class za{constructor(t,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),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 za(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,r,s,n){let o=Math.max(0,r-t),l=Math.max(0,o-2*i),h=s>0&&s>r;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let a=Math.round(Math.max(20,Math.floor(r*l/s))),d=(l-a)/(s-r),c=n*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(a),computedSliderRatio:d,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){let t=za._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},qS=class extends yp{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new wp(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},YS=class extends yp{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new wp(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},XS=500,Wu=50,GS=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},$a=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,r=1,s=this._rear;do{let n=s===this._front?t:Math.pow(2,-r);if(t-=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(t){if(rc){let i=Ft(t.browserEvent),r=lS(i);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,r){let s=null,n=new GS(t,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(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),i){let s=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),h=Math.max(Math.min(s,o),1),a=Math.max(Math.min(n,l),1),d=Math.max(s,o),c=Math.max(n,l);d%h===0&&c%a===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};$a.INSTANCE=new $a;var QS=$a,JS=class extends lc{constructor(e,t,i){super(),this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new T),this.onWillScroll=this._onWillScroll.event,this._options=e0(t),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 YS(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new qS(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(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=vs(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=vs(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=vs(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 nc),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ji(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,jt&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ou(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ji(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new Ou(i))};this._mouseWheelToDispose.push(q(this._listenOnDomNode,Le.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=QS.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.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 l=!jt&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),a={};if(n){let d=Wu*n,c=h.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(a,c)}if(o){let d=Wu*o,c=h.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(a,c)}a=this._scrollable.validateScrollPosition(a),(h.scrollLeft!==a.scrollLeft||h.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,r=i?" left":"",s=t?" top":"",n=i||t?" 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(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),XS)}},ZS=class extends JS{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function e0(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,jt&&(t.className+=" mac"),t}var Fa=class extends X{constructor(e,t,i,r,s,n,o,l){super(),this._bufferService=i,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new T),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new HS({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:a=>oc(r.window,a)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new ZS(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(a=>{this._scrollableElement.updateOptions({handleMouseWheel:!(a&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ie.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ae(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ae(()=>this._styleElement.remove())),this._register(Ie.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
60
+ `)})),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(a=>this._handleScroll(a)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){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 t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};Fa=me([I(2,Qe),I(3,si),I(4,tp),I(5,Ar),I(6,Je),I(7,ni)],Fa);var Ha=class extends X{constructor(e,t,i,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=r,this._renderService=s,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(n=>this._removeDecoration(n))),this._register(ae(()=>{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 r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(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=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Ha=me([I(1,Qe),I(2,si),I(3,Vs),I(4,ni)],Ha);var t0=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ot={full:0,left:0,center:0,right:0},ci={full:0,left:0,center:0,right:0},qr={full:0,left:0,center:0,right:0},uo=class extends X{constructor(e,t,i,r,s,n,o,l){var a;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=r,this._renderService=s,this._optionsService=n,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new t0,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(),(a=this._viewportElement.parentElement)==null||a.insertBefore(this._canvas,this._viewportElement),this._register(ae(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;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),t=Math.ceil((this._canvas.width-1)/3);ci.full=this._canvas.width,ci.left=e,ci.center=t,ci.right=e,this._refreshDrawHeightConstants(),qr.full=1,qr.left=1,qr.center=1+ci.left,qr.right=1+ci.left+ci.center}_refreshDrawHeightConstants(){Ot.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Ot.left=t,Ot.center=t,Ot.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ot.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ot.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ot.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ot.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(qr[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ot[e.position||"full"]/2),ci[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ot[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};uo=me([I(2,Qe),I(3,Vs),I(4,ni),I(5,Je),I(6,Ar),I(7,si)],uo);var D;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
61
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(D||(D={}));var In;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(In||(In={}));var Cp;(e=>e.ST=`${D.ESC}\\`)(Cp||(Cp={}));var Wa=class{constructor(e,t,i,r,s,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._coreService=s,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${D.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Wa=me([I(2,Qe),I(3,Je),I(4,ir),I(5,ni)],Wa);var Pe=0,Me=0,Be=0,_e=0,ju={css:"#00000000",rgba:0},we;(e=>{function t(s,n,o,l){return l!==void 0?`#${Oi(s)}${Oi(n)}${Oi(o)}${Oi(l)}`:`#${Oi(s)}${Oi(n)}${Oi(o)}`}e.toCss=t;function i(s,n,o,l=255){return(s<<24|n<<16|o<<8|l)>>>0}e.toRgba=i;function r(s,n,o,l){return{css:e.toCss(s,n,o,l),rgba:e.toRgba(s,n,o,l)}}e.toColor=r})(we||(we={}));var ne;(e=>{function t(h,a){if(_e=(a.rgba&255)/255,_e===1)return{css:a.css,rgba:a.rgba};let d=a.rgba>>24&255,c=a.rgba>>16&255,f=a.rgba>>8&255,u=h.rgba>>24&255,m=h.rgba>>16&255,S=h.rgba>>8&255;Pe=u+Math.round((d-u)*_e),Me=m+Math.round((c-m)*_e),Be=S+Math.round((f-S)*_e);let w=we.toCss(Pe,Me,Be),p=we.toRgba(Pe,Me,Be);return{css:w,rgba:p}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function r(h,a,d){let c=zn.ensureContrastRatio(h.rgba,a.rgba,d);if(c)return we.toColor(c>>24&255,c>>16&255,c>>8&255)}e.ensureContrastRatio=r;function s(h){let a=(h.rgba|255)>>>0;return[Pe,Me,Be]=zn.toChannels(a),{css:we.toCss(Pe,Me,Be),rgba:a}}e.opaque=s;function n(h,a){return _e=Math.round(a*255),[Pe,Me,Be]=zn.toChannels(h.rgba),{css:we.toCss(Pe,Me,Be,_e),rgba:we.toRgba(Pe,Me,Be,_e)}}e.opacity=n;function o(h,a){return _e=h.rgba&255,n(h,_e*a/255)}e.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=l})(ne||(ne={}));var ce;(e=>{let t,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Pe=parseInt(s.slice(1,2).repeat(2),16),Me=parseInt(s.slice(2,3).repeat(2),16),Be=parseInt(s.slice(3,4).repeat(2),16),we.toColor(Pe,Me,Be);case 5:return Pe=parseInt(s.slice(1,2).repeat(2),16),Me=parseInt(s.slice(2,3).repeat(2),16),Be=parseInt(s.slice(3,4).repeat(2),16),_e=parseInt(s.slice(4,5).repeat(2),16),we.toColor(Pe,Me,Be,_e);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 Pe=parseInt(n[1]),Me=parseInt(n[2]),Be=parseInt(n[3]),_e=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),we.toColor(Pe,Me,Be,_e);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Pe,Me,Be,_e]=t.getImageData(0,0,1,1).data,_e!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:we.toRgba(Pe,Me,Be,_e),css:s}}e.toColor=r})(ce||(ce={}));var Ve;(e=>{function t(r){return i(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function i(r,s,n){let o=r/255,l=s/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),c=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+d*.7152+c*.0722}e.relativeLuminance2=i})(Ve||(Ve={}));var zn;(e=>{function t(o,l){if(_e=(l&255)/255,_e===1)return l;let h=l>>24&255,a=l>>16&255,d=l>>8&255,c=o>>24&255,f=o>>16&255,u=o>>8&255;return Pe=c+Math.round((h-c)*_e),Me=f+Math.round((a-f)*_e),Be=u+Math.round((d-u)*_e),we.toRgba(Pe,Me,Be)}e.blend=t;function i(o,l,h){let a=Ve.relativeLuminance(o>>8),d=Ve.relativeLuminance(l>>8);if(Kt(a,d)<h){if(d<a){let u=r(o,l,h),m=Kt(a,Ve.relativeLuminance(u>>8));if(m<h){let S=s(o,l,h),w=Kt(a,Ve.relativeLuminance(S>>8));return m>w?u:S}return u}let c=s(o,l,h),f=Kt(a,Ve.relativeLuminance(c>>8));if(f<h){let u=r(o,l,h),m=Kt(a,Ve.relativeLuminance(u>>8));return f>m?c:u}return c}}e.ensureContrastRatio=i;function r(o,l,h){let a=o>>24&255,d=o>>16&255,c=o>>8&255,f=l>>24&255,u=l>>16&255,m=l>>8&255,S=Kt(Ve.relativeLuminance2(f,u,m),Ve.relativeLuminance2(a,d,c));for(;S<h&&(f>0||u>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),u-=Math.max(0,Math.ceil(u*.1)),m-=Math.max(0,Math.ceil(m*.1)),S=Kt(Ve.relativeLuminance2(f,u,m),Ve.relativeLuminance2(a,d,c));return(f<<24|u<<16|m<<8|255)>>>0}e.reduceLuminance=r;function s(o,l,h){let a=o>>24&255,d=o>>16&255,c=o>>8&255,f=l>>24&255,u=l>>16&255,m=l>>8&255,S=Kt(Ve.relativeLuminance2(f,u,m),Ve.relativeLuminance2(a,d,c));for(;S<h&&(f<255||u<255||m<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),u=Math.min(255,u+Math.ceil((255-u)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),S=Kt(Ve.relativeLuminance2(f,u,m),Ve.relativeLuminance2(a,d,c));return(f<<24|u<<16|m<<8|255)>>>0}e.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(zn||(zn={}));function Oi(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Kt(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var i0=class extends Ks{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}},fo=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ct}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let i=[],r=t.translateToString(!0),s=0,n=0,o=0,l=t.getFg(0),h=t.getBg(0);for(let a=0;a<t.getTrimmedLength();a++)if(t.loadCell(a,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==h){if(a-s>1){let d=this._getJoinedRanges(r,o,n,t,s);for(let c=0;c<d.length;c++)i.push(d[c])}s=a,o=n,l=this._workCell.fg,h=this._workCell.bg}n+=this._workCell.getChars().length||Si.length}if(this._bufferService.cols-s>1){let a=this._getJoinedRanges(r,o,n,t,s);for(let d=0;d<a.length;d++)i.push(a[d])}return i}_getJoinedRanges(e,t,i,r,s){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let h=this._characterJoiners[l].handler(n);for(let a=0;a<h.length;a++)fo._mergeRanges(o,h[a])}catch(h){console.error(h)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(e,t,i){let r=0,s=!1,n=0,o=e[r];if(o){for(let l=i;l<this._bufferService.cols;l++){let h=t.getWidth(l),a=t.getString(l).length||Si.length;if(h!==0){if(!s&&o[0]<=n&&(o[0]=l,s=!0),o[1]<=n){if(o[1]=l,o=e[++r],!o)break;o[0]<=n?(o[0]=l,s=!0):s=!1}n+=a}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let r=0;r<e.length;r++){let s=e[r];if(i){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};fo=me([I(0,Qe)],fo);function r0(e){return 57508<=e&&e<=57558}function s0(e){return 9472<=e&&e<=9631}function n0(e){return r0(e)||s0(e)}function o0(){return{css:{canvas:vn(),cell:vn()},device:{canvas:vn(),cell:vn(),char:{width:0,height:0,left:0,top:0}}}}function vn(){return{width:0,height:0}}var ja=class{constructor(e,t,i,r,s,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._themeService=o,this._workCell=new Ct,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,r,s,n,o,l,h,a,d){let c=[],f=this._characterJoinerService.getJoinedCharacters(t),u=this._themeService.colors,m=e.getNoBgTrimmedLength();i&&m<n+1&&(m=n+1);let S,w=0,p="",_=0,v=0,y=0,C=0,k=!1,L=0,M=!1,V=0,W=0,U=[],A=a!==-1&&d!==-1;for(let E=0;E<m;E++){e.loadCell(E,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let b=!1,N=E>=W,K=E,x=this._workCell;if(f.length>0&&E===f[0][0]&&N){let ee=f.shift(),Fo=this._isCellInSelection(ee[0],t);for(_=ee[0]+1;_<ee[1];_++)N&&(N=Fo===this._isCellInSelection(_,t));N&&(N=!i||n<ee[0]||n>=ee[1]),N?(b=!0,x=new i0(this._workCell,e.translateToString(!0,ee[0],ee[1]),ee[1]-ee[0]),K=ee[1]-1,P=x.getWidth()):W=ee[1]}let z=this._isCellInSelection(E,t),j=i&&E===n,R=A&&E>=a&&E<=d,H=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,ee=>{H=!0});let J=x.getChars()||Si;if(J===" "&&(x.isUnderline()||x.isOverline())&&(J=" "),V=P*l-h.get(J,x.isBold(),x.isItalic()),!S)S=this._document.createElement("span");else if(w&&(z&&M||!z&&!M&&x.bg===v)&&(z&&M&&u.selectionForeground||x.fg===y)&&x.extended.ext===C&&R===k&&V===L&&!j&&!b&&!H&&N){x.isInvisible()?p+=Si:p+=J,w++;continue}else w&&(S.textContent=p),S=this._document.createElement("span"),w=0,p="";if(v=x.bg,y=x.fg,C=x.extended.ext,k=R,L=V,M=z,b&&n>=E&&n<=K&&(n=E),!this._coreService.isCursorHidden&&j&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&U.push("xterm-cursor-blink"),U.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline");break}}if(x.isBold()&&U.push("xterm-bold"),x.isItalic()&&U.push("xterm-italic"),x.isDim()&&U.push("xterm-dim"),x.isInvisible()?p=Si:p=x.getChars()||Si,x.isUnderline()&&(U.push(`xterm-underline-${x.extended.underlineStyle}`),p===" "&&(p=" "),!x.isUnderlineColorDefault()))if(x.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${Ks.toColorRGB(x.getUnderlineColor()).join(",")})`;else{let ee=x.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&x.isBold()&&ee<8&&(ee+=8),S.style.textDecorationColor=u.ansi[ee].css}x.isOverline()&&(U.push("xterm-overline"),p===" "&&(p=" ")),x.isStrikethrough()&&U.push("xterm-strikethrough"),R&&(S.style.textDecoration="underline");let Z=x.getFgColor(),Fe=x.getFgColorMode(),Se=x.getBgColor(),ft=x.getBgColorMode(),$o=!!x.isInverse();if($o){let ee=Z;Z=Se,Se=ee;let Fo=Fe;Fe=ft,ft=Fo}let oi,Xs,zr=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,ee=>{ee.options.layer!=="top"&&zr||(ee.backgroundColorRGB&&(ft=50331648,Se=ee.backgroundColorRGB.rgba>>8&16777215,oi=ee.backgroundColorRGB),ee.foregroundColorRGB&&(Fe=50331648,Z=ee.foregroundColorRGB.rgba>>8&16777215,Xs=ee.foregroundColorRGB),zr=ee.options.layer==="top")}),!zr&&z&&(oi=this._coreBrowserService.isFocused?u.selectionBackgroundOpaque:u.selectionInactiveBackgroundOpaque,Se=oi.rgba>>8&16777215,ft=50331648,zr=!0,u.selectionForeground&&(Fe=50331648,Z=u.selectionForeground.rgba>>8&16777215,Xs=u.selectionForeground)),zr&&U.push("xterm-decoration-top");let li;switch(ft){case 16777216:case 33554432:li=u.ansi[Se],U.push(`xterm-bg-${Se}`);break;case 50331648:li=we.toColor(Se>>16,Se>>8&255,Se&255),this._addStyle(S,`background-color:#${Uu((Se>>>0).toString(16),"0",6)}`);break;case 0:default:$o?(li=u.foreground,U.push("xterm-bg-257")):li=u.background}switch(oi||x.isDim()&&(oi=ne.multiplyOpacity(li,.5)),Fe){case 16777216:case 33554432:x.isBold()&&Z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Z+=8),this._applyMinimumContrast(S,li,u.ansi[Z],x,oi,void 0)||U.push(`xterm-fg-${Z}`);break;case 50331648:let ee=we.toColor(Z>>16&255,Z>>8&255,Z&255);this._applyMinimumContrast(S,li,ee,x,oi,Xs)||this._addStyle(S,`color:#${Uu(Z.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,li,u.foreground,x,oi,Xs)||$o&&U.push("xterm-fg-257")}U.length&&(S.className=U.join(" "),U.length=0),!j&&!b&&!H&&N?w++:S.textContent=p,V!==this.defaultSpacing&&(S.style.letterSpacing=`${V}px`),c.push(S),E=K}return S&&w&&(S.textContent=p),c}_applyMinimumContrast(e,t,i,r,s,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||n0(r.getCode()))return!1;let o=this._getContrastCache(r),l;if(!s&&!n&&(l=o.getColor(t.rgba,i.rgba)),l===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=ne.ensureContrastRatio(s||t,n||i,h),o.setColor((s||t).rgba,(n||i).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?e>=i[0]&&t>=i[1]&&e<r[0]&&t<=r[1]:e<i[0]&&t>=i[1]&&e>=r[0]&&t<=r[1]:t>i[1]&&t<r[1]||i[1]===r[1]&&t===i[1]&&e>=i[0]&&e<r[0]||i[1]<r[1]&&t===r[1]&&e<r[0]||i[1]<r[1]&&t===i[1]&&e>=i[0]}};ja=me([I(1,sp),I(2,Je),I(3,si),I(4,ir),I(5,Vs),I(6,Ar)],ja);function Uu(e,t,i){for(;e.length<i;)e=t+e;return e}var l0=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,r,s,n],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,r){e===this._font&&t===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,i){let r=0;if(!t&&!i&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let s=e;t&&(s+="B"),i&&(s+="I");let n=this._holey.get(s);if(n===void 0){let o=0;t&&(o|=1),i&&(o|=2),n=this._measure(e,o),n>0&&this._holey.set(s,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},a0=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let s=e.buffers.active.ydisp,n=t[1]-s,o=i[1]-s,l=Math.max(n,0),h=Math.min(o,e.rows-1);if(l>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function h0(){return new a0}var gl="xterm-dom-renderer-owner-",_t="xterm-rows",gn="xterm-fg-",Ku="xterm-bg-",Yr="xterm-focus",Sn="xterm-selection",c0=1,Ua=class extends X{constructor(e,t,i,r,s,n,o,l,h,a,d,c,f,u){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=r,this._viewportElement=s,this._helperContainer=n,this._linkifier2=o,this._charSizeService=h,this._optionsService=a,this._bufferService=d,this._coreService=c,this._coreBrowserService=f,this._themeService=u,this._terminalClass=c0++,this._rowElements=[],this._selectionRenderModel=h0(),this.onRequestRedraw=this._register(new T).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(_t),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(Sn),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=o0(),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=l.createInstance(ja,document),this._element.classList.add(gl+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(ae(()=>{this._element.classList.remove(gl+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new l0(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${_t} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${_t} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${_t} .xterm-dim { color: ${ne.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${_t}.${Yr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${_t}.${Yr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${_t}.${Yr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${_t} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${_t} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${_t} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_t} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${_t} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Sn} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Sn} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Sn} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${gn}${n} { color: ${o.css}; }${this._terminalSelector} .${gn}${n}.xterm-dim { color: ${ne.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Ku}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${gn}257 { color: ${ne.opaque(e.background).css}; }${this._terminalSelector} .${gn}257.xterm-dim { color: ${ne.multiplyOpacity(ne.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ku}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Yr),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Yr),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(i){let h=e[0]>t[0];l.appendChild(this._createSelectionElement(n,h?t[0]:e[0],h?e[0]:t[0],o-n+1))}else{let h=r===n?e[0]:0,a=n===s?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(n,h,a));let d=o-n-1;if(l.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,d)),n!==o){let c=s===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,c))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,i,r=1){let s=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${n}px`,s.style.width=`${o}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,r=i.ybase+i.y,s=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let a=h+i.ydisp,d=this._rowElements[h],c=i.lines.get(a);if(!d||!c)break;d.replaceChildren(...this._rowFactory.createRow(c,a,a===r,o,l,s,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${gl}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,r,s,n){i<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),r=Math.max(Math.min(r,o),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,h=l.ybase+l.y,a=Math.min(l.x,s-1),d=this._optionsService.rawOptions.cursorBlink,c=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let u=i;u<=r;++u){let m=u+l.ydisp,S=this._rowElements[u],w=l.lines.get(m);if(!S||!w)break;S.replaceChildren(...this._rowFactory.createRow(w,m,m===h,c,f,a,d,this.dimensions.css.cell.width,this._widthCache,n?u===i?e:0:-1,n?(u===r?t:s)-1:-1))}}};Ua=me([I(7,ec),I(8,Oo),I(9,Je),I(10,Qe),I(11,ir),I(12,si),I(13,Ar)],Ua);var Ka=class extends X{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new T),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new d0(this._optionsService))}catch{this._measureStrategy=this._register(new u0(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Ka=me([I(2,Je)],Ka);var xp=class extends X{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},u0=class extends xp{constructor(e,t,i){super(),this._document=e,this._parentElement=t,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}},d0=class extends xp{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},f0=class extends X{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new _0(this._window)),this._onDprChange=this._register(new T),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new T),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Ie.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(q(this._textarea,"focus",()=>this._isFocused=!0)),this._register(q(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}},_0=class extends X{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Br),this._onDprChange=this._register(new T),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ae(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=q(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)}},p0=class extends X{constructor(){super(),this.linkProviders=[],this._register(ae(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function ac(e,t,i){let r=i.getBoundingClientRect(),s=e.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-n,t.clientY-r.top-o]}function m0(e,t,i,r,s,n,o,l,h){if(!n)return;let a=ac(e,t,i);if(a)return a[0]=Math.ceil((a[0]+(h?o/2:0))/o),a[1]=Math.ceil(a[1]/l),a[0]=Math.min(Math.max(a[0],1),r+(h?1:0)),a[1]=Math.min(Math.max(a[1],1),s),a}var Va=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,s){return m0(window,e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let i=ac(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};Va=me([I(0,ni),I(1,Oo)],Va);var v0=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},kp={};Dg(kp,{getSafariVersion:()=>S0,isChromeOS:()=>Lp,isFirefox:()=>bp,isIpad:()=>y0,isIphone:()=>w0,isLegacyEdge:()=>g0,isLinux:()=>hc,isMac:()=>_o,isNode:()=>Ao,isSafari:()=>Ep,isWindows:()=>Dp});var Ao=typeof process<"u"&&"title"in process,qs=Ao?"node":navigator.userAgent,Ys=Ao?"node":navigator.platform,bp=qs.includes("Firefox"),g0=qs.includes("Edge"),Ep=/^((?!chrome|android).)*safari/i.test(qs);function S0(){if(!Ep)return 0;let e=qs.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var _o=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ys),y0=Ys==="iPad",w0=Ys==="iPhone",Dp=["Windows","Win16","Win32","WinCE"].includes(Ys),hc=Ys.indexOf("Linux")>=0,Lp=/\bCrOS\b/.test(qs),Rp=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),s=e.timeRemaining(),i*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},C0=class extends Rp{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},x0=class extends Rp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},po=!Ao&&"requestIdleCallback"in window?x0:C0,k0=class{constructor(){this._queue=new po}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},qa=class extends X{constructor(e,t,i,r,s,n,o,l,h){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=r,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new Br),this._pausedResizeTask=new k0,this._observerDisposable=this._register(new Br),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 T),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new T),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new T),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new T),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new v0((a,d)=>this._renderRows(a,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new b0(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ae(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var a;return(a=this._renderer.value)==null?void 0:a.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(a=>this._registerIntersectionObserver(a,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=ae(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),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,t,i){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};qa=me([I(2,Je),I(3,Oo),I(4,ir),I(5,Vs),I(6,Qe),I(7,si),I(8,Ar)],qa);var b0=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function E0(e,t,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return R0(s,n,e,t,i,r)+Io(n,t,i,r)+P0(s,n,e,t,i,r);let o;if(n===t)return o=s>e?"D":"C",As(Math.abs(s-e),Os(o,r));o=n>t?"D":"C";let l=Math.abs(n-t),h=L0(n>t?e:s,i)+(l-1)*i.cols+1+D0(n>t?s:e);return As(h,Os(o,r))}function D0(e,t){return e-1}function L0(e,t){return t.cols-e}function R0(e,t,i,r,s,n){return Io(t,r,s,n).length===0?"":As(Mp(e,t,e,t-Zi(t,s),!1,s).length,Os("D",n))}function Io(e,t,i,r){let s=e-Zi(e,i),n=t-Zi(t,i),o=Math.abs(s-n)-M0(e,t,i);return As(o,Os(Pp(e,t),r))}function P0(e,t,i,r,s,n){let o;Io(t,r,s,n).length>0?o=r-Zi(r,s):o=t;let l=r,h=B0(e,t,i,r,s,n);return As(Mp(e,o,i,l,h==="C",s).length,Os(h,n))}function M0(e,t,i){var o;let r=0,s=e-Zi(e,i),n=t-Zi(t,i);for(let l=0;l<Math.abs(s-n);l++){let h=Pp(e,t)==="A"?-1:1;(o=i.buffer.lines.get(s+h*l))!=null&&o.isWrapped&&r++}return r}function Zi(e,t){let i=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)i++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return i}function B0(e,t,i,r,s,n){let o;return Io(i,r,s,n).length>0?o=r-Zi(r,s):o=t,e<i&&o<=r||e>=i&&o<r?"C":"D"}function Pp(e,t){return e>t?"A":"B"}function Mp(e,t,i,r,s,n){let o=e,l=t,h="";for(;(o!==i||l!==r)&&l>=0&&l<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!s&&o<0&&(h+=n.buffer.translateBufferLineToString(l,!1,0,e+1),o=n.cols-1,e=o,l--);return h+n.buffer.translateBufferLineToString(l,!1,e,o)}function Os(e,t){let i=t?"O":"[";return D.ESC+i+e}function As(e,t){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=t;return i}var T0=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Vu(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Sl=50,N0=15,O0=50,A0=500,I0=" ",z0=new RegExp(I0,"g"),Ya=class extends X{constructor(e,t,i,r,s,n,o,l,h){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=r,this._coreService=s,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ct,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new T),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new T),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new T),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new T),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=a=>this._handleMouseMove(a),this._mouseUpListener=a=>this._handleMouseUp(a),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(a=>this._handleTrim(a)),this._register(this._bufferService.buffers.onBufferActivate(a=>this._handleBufferActivate(a))),this.enable(),this._model=new T0(this._bufferService),this._activeSelectionMode=0,this._register(ae(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(a=>{a.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=i.translateBufferLineToString(o,!0,s,n);r.push(l)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(i.translateBufferLineToString(e[1],!0,e[0],s));for(let n=e[1]+1;n<=t[1]-1;n++){let o=i.lines.get(n),l=i.translateBufferLineToString(n,!0);o!=null&&o.isWrapped?r[r.length-1]+=l:r.push(l)}if(e[1]!==t[1]){let n=i.lines.get(t[1]),o=i.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(s=>s.replace(z0," ")).join(Dp?`\r
62
+ `:`
63
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),hc&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r||!t?!1:this._areCoordsInSelection(t,i,r)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r?!1:this._areCoordsInSelection([e,t],i,r)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,n;let i=(n=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=Vu(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=ac(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-Sl),Sl),t/=Sl,t/Math.abs(t)+Math.round(t*(N0-1)))}shouldForceSelection(e){return _o?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(),O0)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(_o&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let r=i.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<A0&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let r=E0(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:s>1&&t!==r&&(i+=s-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,n=s.lines.get(e[1]);if(!n)return;let o=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(n,e[0]),h=l,a=e[0]-l,d=0,c=0,f=0,u=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;h<o.length&&o.charAt(h+1)===" ";)h++}else{let w=e[0],p=e[0];n.getWidth(w)===0&&(d++,w--),n.getWidth(p)===2&&(c++,p++);let _=n.getString(p).length;for(_>1&&(u+=_-1,h+=_-1);w>0&&l>0&&!this._isCharWordSeparator(n.loadCell(w-1,this._workCell));){n.loadCell(w-1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,w--):v>1&&(f+=v-1,l-=v-1),l--,w--}for(;p<n.length&&h+1<o.length&&!this._isCharWordSeparator(n.loadCell(p+1,this._workCell));){n.loadCell(p+1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===2?(c++,p++):v>1&&(u+=v-1,h+=v-1),h++,p++}}h++;let m=l+a-d+f,S=Math.min(this._bufferService.cols,h-l+d+c-f-u);if(!(!t&&o.slice(l,h).trim()==="")){if(i&&m===0&&n.getCodePoint(0)!==32){let w=s.lines.get(e[1]-1);if(w&&n.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let p=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(p){let _=this._bufferService.cols-p.start;m-=_,S+=_}}}if(r&&m+S===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let w=s.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let p=this._getWordAt([0,e[1]+1],!1,!1,!0);p&&(S+=p.length)}}return{start:m,length:S}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Vu(i,this._bufferService.cols)}};Ya=me([I(3,Qe),I(4,ir),I(5,tc),I(6,Je),I(7,ni),I(8,si)],Ya);var qu=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Yu=class{constructor(){this._color=new qu,this._css=new qu}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},xe=Object.freeze((()=>{let e=[ce.toColor("#2e3436"),ce.toColor("#cc0000"),ce.toColor("#4e9a06"),ce.toColor("#c4a000"),ce.toColor("#3465a4"),ce.toColor("#75507b"),ce.toColor("#06989a"),ce.toColor("#d3d7cf"),ce.toColor("#555753"),ce.toColor("#ef2929"),ce.toColor("#8ae234"),ce.toColor("#fce94f"),ce.toColor("#729fcf"),ce.toColor("#ad7fa8"),ce.toColor("#34e2e2"),ce.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=t[i/36%6|0],s=t[i/6%6|0],n=t[i%6];e.push({css:we.toCss(r,s,n),rgba:we.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;e.push({css:we.toCss(r,r,r),rgba:we.toRgba(r,r,r)})}return e})()),zi=ce.toColor("#ffffff"),ss=ce.toColor("#000000"),Xu=ce.toColor("#ffffff"),Gu=ss,Xr={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},$0=zi,Xa=class extends X{constructor(e){super(),this._optionsService=e,this._contrastCache=new Yu,this._halfContrastCache=new Yu,this._onChangeColors=this._register(new T),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:zi,background:ss,cursor:Xu,cursorAccent:Gu,selectionForeground:void 0,selectionBackgroundTransparent:Xr,selectionBackgroundOpaque:ne.blend(ss,Xr),selectionInactiveBackgroundTransparent:Xr,selectionInactiveBackgroundOpaque:ne.blend(ss,Xr),scrollbarSliderBackground:ne.opacity(zi,.2),scrollbarSliderHoverBackground:ne.opacity(zi,.4),scrollbarSliderActiveBackground:ne.opacity(zi,.5),overviewRulerBorder:zi,ansi:xe.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ie(e.foreground,zi),t.background=ie(e.background,ss),t.cursor=ne.blend(t.background,ie(e.cursor,Xu)),t.cursorAccent=ne.blend(t.background,ie(e.cursorAccent,Gu)),t.selectionBackgroundTransparent=ie(e.selectionBackground,Xr),t.selectionBackgroundOpaque=ne.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ie(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ne.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ie(e.selectionForeground,ju):void 0,t.selectionForeground===ju&&(t.selectionForeground=void 0),ne.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ne.opacity(t.selectionBackgroundTransparent,.3)),ne.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ne.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ie(e.scrollbarSliderBackground,ne.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ie(e.scrollbarSliderHoverBackground,ne.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ie(e.scrollbarSliderActiveBackground,ne.opacity(t.foreground,.5)),t.overviewRulerBorder=ie(e.overviewRulerBorder,$0),t.ansi=xe.slice(),t.ansi[0]=ie(e.black,xe[0]),t.ansi[1]=ie(e.red,xe[1]),t.ansi[2]=ie(e.green,xe[2]),t.ansi[3]=ie(e.yellow,xe[3]),t.ansi[4]=ie(e.blue,xe[4]),t.ansi[5]=ie(e.magenta,xe[5]),t.ansi[6]=ie(e.cyan,xe[6]),t.ansi[7]=ie(e.white,xe[7]),t.ansi[8]=ie(e.brightBlack,xe[8]),t.ansi[9]=ie(e.brightRed,xe[9]),t.ansi[10]=ie(e.brightGreen,xe[10]),t.ansi[11]=ie(e.brightYellow,xe[11]),t.ansi[12]=ie(e.brightBlue,xe[12]),t.ansi[13]=ie(e.brightMagenta,xe[13]),t.ansi[14]=ie(e.brightCyan,xe[14]),t.ansi[15]=ie(e.brightWhite,xe[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<i;r++)t.ansi[r+16]=ie(e.extendedAnsi[r],xe[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Xa=me([I(0,Je)],Xa);function ie(e,t){if(e!==void 0)try{return ce.toColor(e)}catch{}return t}var F0=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},H0=class{constructor(){this._services=new F0,this._services.set(ec,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=Ng(e).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] ${e.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=i.length>0?i[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},W0={trace:0,debug:1,info:2,warn:3,error:4,off:5},j0="xterm.js: ",Ga=class extends X{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=W0[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":j0)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Ga=me([I(0,Je)],Ga);var Qu=class extends X{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new T),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new T),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new T),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(e+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let r=this._length+i.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let s=t-1;s>=0;s--)this.set(e+s+i,this.get(e+s));let r=e+t+i-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+i,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Y=3,ye=Object.freeze(new Ks),yn=0,yl=2,ns=class Bp{constructor(t,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Y);let s=i||Ct.fromCharData([0,Q_,1,0]);for(let n=0;n<t;++n)this.setCell(n,s);this.length=t}get(t){let i=this._data[t*Y+0],r=i&2097151;return[this._data[t*Y+1],i&2097152?this._combined[t]:r?_i(r):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,i){this._data[t*Y+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*Y+0]=t|2097152|i[2]<<22):this._data[t*Y+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*Y+0]>>22}hasWidth(t){return this._data[t*Y+0]&12582912}getFg(t){return this._data[t*Y+1]}getBg(t){return this._data[t*Y+2]}hasContent(t){return this._data[t*Y+0]&4194303}getCodePoint(t){let i=this._data[t*Y+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*Y+0]&2097152}getString(t){let i=this._data[t*Y+0];return i&2097152?this._combined[t]:i&2097151?_i(i&2097151):""}isProtected(t){return this._data[t*Y+2]&536870912}loadCell(t,i){return yn=t*Y,i.content=this._data[yn+0],i.fg=this._data[yn+1],i.bg=this._data[yn+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Y+0]=i.content,this._data[t*Y+1]=i.fg,this._data[t*Y+2]=i.bg}setCellFromCodepoint(t,i,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Y+0]=i|r<<22,this._data[t*Y+1]=s.fg,this._data[t*Y+2]=s.bg}addCodepointToCell(t,i,r){let s=this._data[t*Y+0];s&2097152?this._combined[t]+=_i(i):s&2097151?(this._combined[t]=_i(s&2097151)+_i(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*Y+0]=s}insertCells(t,i,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length-t){let s=new Ct;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,s));for(let n=0;n<i;++n)this.setCell(t+n,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,i,r){if(t%=this.length,i<this.length-t){let s=new Ct;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,s));for(let n=this.length-i;n<this.length;++n)this.setCell(n,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,i,r,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.setCell(t++,r)}resize(t,i){if(t===this.length)return this._data.length*4*yl<this._data.buffer.byteLength;let r=t*Y;if(t>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<t;++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 l=parseInt(s[o],10);l>=t&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,r*4*yl<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*yl<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new Bp(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Y+0]&4194303)return t+(this._data[t*Y+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Y+0]&4194303||this._data[t*Y+2]&50331648)return t+(this._data[t*Y+0]>>22);return 0}copyCellsFrom(t,i,r,s,n){let o=t._data;if(n)for(let h=s-1;h>=0;h--){for(let a=0;a<Y;a++)this._data[(r+h)*Y+a]=o[(i+h)*Y+a];o[(i+h)*Y+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[i+h])}else for(let h=0;h<s;h++){for(let a=0;a<Y;a++)this._data[(r+h)*Y+a]=o[(i+h)*Y+a];o[(i+h)*Y+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[i+h])}let l=Object.keys(t._combined);for(let h=0;h<l.length;h++){let a=parseInt(l[h],10);a>=i&&(this._combined[a-i+r]=t._combined[a])}}translateToString(t,i,r,s){i=i??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let o=this._data[i*Y+0],l=o&2097151,h=o&2097152?this._combined[i]:l?_i(l):Si;if(n+=h,s)for(let a=0;a<h.length;++a)s.push(i);i+=o>>22||1}return s&&s.push(i),n}};function U0(e,t,i,r,s,n){let o=[];for(let l=0;l<e.length-1;l++){let h=l,a=e.get(++h);if(!a.isWrapped)continue;let d=[e.get(l)];for(;h<e.length&&a.isWrapped;)d.push(a),a=e.get(++h);if(!n&&r>=l&&r<h){l+=d.length-1;continue}let c=0,f=Is(d,c,t),u=1,m=0;for(;u<d.length;){let w=Is(d,u,t),p=w-m,_=i-f,v=Math.min(p,_);d[c].copyCellsFrom(d[u],m,f,v,!1),f+=v,f===i&&(c++,f=0),m+=v,m===w&&(u++,m=0),f===0&&c!==0&&d[c-1].getWidth(i-1)===2&&(d[c].copyCellsFrom(d[c-1],i-1,f++,1,!1),d[c-1].setCell(i-1,s))}d[c].replaceCells(f,i,s);let S=0;for(let w=d.length-1;w>0&&(w>c||d[w].getTrimmedLength()===0);w--)S++;S>0&&(o.push(l+d.length-S),o.push(S)),l+=d.length-1}return o}function K0(e,t){let i=[],r=0,s=t[r],n=0;for(let o=0;o<e.length;o++)if(s===o){let l=t[++r];e.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,s=t[++r]}else i.push(o);return{layout:i,countRemoved:n}}function V0(e,t){let i=[];for(let r=0;r<t.length;r++)i.push(e.get(t[r]));for(let r=0;r<i.length;r++)e.set(r,i[r]);e.length=t.length}function q0(e,t,i){let r=[],s=e.map((h,a)=>Is(e,a,t)).reduce((h,a)=>h+a),n=0,o=0,l=0;for(;l<s;){if(s-l<i){r.push(s-l);break}n+=i;let h=Is(e,o,t);n>h&&(n-=h,o++);let a=e[o].getWidth(n-1)===2;a&&n--;let d=a?i-1:i;r.push(d),l+=d}return r}function Is(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,s=e[t+1].getWidth(0)===2;return r&&s?i-1:i}var Tp=class Np{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Np._nextId++,this._onDispose=this.register(new T),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ji(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Tp._nextId=1;var Y0=Tp,De={},$i=De.B;De[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:"≥","{":"π","|":"≠","}":"£","~":"·"};De.A={"#":"£"};De.B=void 0;De[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};De.C=De[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};De.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};De.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};De.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};De.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};De.E=De[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};De.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};De.H=De[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};De["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Ju=4294967295,Zu=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,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=ye.clone(),this.savedCharset=$i,this.markers=[],this._nullCell=Ct.fromCharData([0,Q_,1,0]),this._whitespaceCell=Ct.fromCharData([0,Si,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new po,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Qu(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new co),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new co),this._whitespaceCell}getBlankLine(e,t){return new ns(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Ju?Ju:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ye);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Qu(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(ye),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,i);let n=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ns(e,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 ns(e,i)));else for(let o=this._rows;o>t;o--)this.lines.length>t+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,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=U0(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ye),i);if(r.length>0){let s=K0(this.lines,r);V0(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(ye),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ns(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(ye),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let h=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),h.unshift(l);if(!i){let v=this.ybase+this.y;if(v>=o&&v<o+h.length)continue}let a=h[h.length-1].getTrimmedLength(),d=q0(h,this._cols,e),c=d.length-h.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+c):f=Math.max(0,this.lines.length-this.lines.maxLength+c);let u=[];for(let v=0;v<c;v++){let y=this.getBlankLine(ye,!0);u.push(y)}u.length>0&&(s.push({start:o+h.length+n,newLines:u}),n+=u.length),h.push(...u);let m=d.length-1,S=d[m];S===0&&(m--,S=d[m]);let w=h.length-c-1,p=a;for(;w>=0;){let v=Math.min(p,S);if(h[m]===void 0)break;if(h[m].copyCellsFrom(h[w],p-v,S-v,v,!0),S-=v,S===0&&(m--,S=d[m]),p-=v,p===0){w--;let y=Math.max(w,0);p=Is(h,y,this._cols)}}for(let v=0;v<h.length;v++)d[v]<e&&h[v].setCell(d[v],r);let _=c-f;for(;_-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+c,this.ybase+t-1)}if(s.length>0){let o=[],l=[];for(let S=0;S<this.lines.length;S++)l.push(this.lines.get(S));let h=this.lines.length,a=h-1,d=0,c=s[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let f=0;for(let S=Math.min(this.lines.maxLength-1,h+n-1);S>=0;S--)if(c&&c.start>a+f){for(let w=c.newLines.length-1;w>=0;w--)this.lines.set(S--,c.newLines[w]);S++,o.push({index:a+1,amount:c.newLines.length}),f+=c.newLines.length,c=s[++d]}else this.lines.set(S,l[a--]);let u=0;for(let S=o.length-1;S>=0;S--)o[S].index+=u,this.lines.onInsertEmitter.fire(o[S]),u+=o[S].amount;let m=Math.max(0,h+n-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,i=0,r){let s=this.lines.get(e);return s?s.translateToString(t,i,r):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new Y0(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},X0=class extends X{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new T),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 Zu(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Zu(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Op=2,Ap=1,Qa=class extends X{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new T),this.onResize=this._onResize.event,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Op),this.rows=Math.max(e.rawOptions.rows||0,Ap),this.buffers=this._register(new X0(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;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(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};Qa=me([I(0,Je)],Qa);var nr={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:_o,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},G0=["normal","bold","100","200","300","400","500","600","700","800","900"],Q0=class extends X{constructor(e){super(),this._onOptionChange=this._register(new T),this.onOptionChange=this._onOptionChange.event;let t={...nr};for(let i in e)if(i in t)try{let r=e[i];t[i]=this._sanitizeAndValidateOption(i,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ae(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in nr))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,r)=>{if(!(i in nr))throw new Error(`No option with key "${i}"`);r=this._sanitizeAndValidateOption(i,r),this.rawOptions[i]!==r&&(this.rawOptions[i]=r,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let r={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=nr[e]),!J0(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=nr[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=G0.includes(t)?t:nr[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function J0(e){return e==="block"||e==="underline"||e==="bar"}function os(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let r in e)i[r]=t<=1?e[r]:e[r]&&os(e[r],t-1);return i}var ed=Object.freeze({insertMode:!1}),td=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ja=class extends X{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new T),this.onData=this._onData.event,this._onUserInput=this._register(new T),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new T),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new T),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=os(ed),this.decPrivateModes=os(td)}reset(){this.modes=os(ed),this.decPrivateModes=os(td)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Ja=me([I(0,Qe),I(1,ip),I(2,Je)],Ja);var id={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function wl(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var Cl=String.fromCharCode,rd={DEFAULT:e=>{let t=[wl(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Cl(t[0])}${Cl(t[1])}${Cl(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${wl(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${wl(e,!0)};${e.x};${e.y}${t}`}},Za=class extends X{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new T),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(id))this.addProtocol(r,id[r]);for(let r of Object.keys(rd))this.addEncoding(r,rd[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let r=t/i,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Za=me([I(0,Qe),I(1,ir),I(2,Je)],Za);var xl=[[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]],Z0=[[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]],ke;function ey(e,t){let i=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=i;)if(s=i+r>>1,e>t[s][1])i=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var ty=class{constructor(){if(this.version="6",!ke){ke=new Uint8Array(65536),ke.fill(1),ke[0]=0,ke.fill(0,1,32),ke.fill(0,127,160),ke.fill(2,4352,4448),ke[9001]=2,ke[9002]=2,ke.fill(2,11904,42192),ke[12351]=1,ke.fill(2,44032,55204),ke.fill(2,63744,64256),ke.fill(2,65040,65050),ke.fill(2,65072,65136),ke.fill(2,65280,65377),ke.fill(2,65504,65511);for(let e=0;e<xl.length;++e)ke.fill(0,xl[e][0],xl[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ke[e]:ey(e,Z0)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=i===0&&t!==0;if(r){let s=ji.extractWidth(t);s===0?r=!1:s>i&&(i=s)}return ji.createPropertyValue(0,i,r)}},ji=class $n{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new T,this.onChange=this._onChange.event;let t=new ty;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,r=!1){return(t&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(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,r=0,s=t.length;for(let n=0;n<s;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let a=t.charCodeAt(n);56320<=a&&a<=57343?o=(o-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let l=this.charProperties(o,r),h=$n.extractWidth(l);$n.extractShouldJoin(l)&&(h-=$n.extractWidth(r)),i+=h,r=l}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},iy=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function sd(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var Gr=2147483647,ry=256,Ip=class eh{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>ry)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new eh;if(!t.length)return i;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let s=t[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 t=new eh(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Gr?Gr:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Gr?Gr:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&(t[i]=this._subParams.slice(r,s))}return t}addDigit(t){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+t,Gr):t}},Qr=[],sy=class{constructor(){this._state=0,this._active=Qr,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=Qr}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=Qr,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Qr,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,i){if(!this._active.length)this._handlerFb(this._id,"PUT",No(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].end(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Qr,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,t,i){this._hitLimit||(this._data+=No(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},Jr=[],ny=class{constructor(){this._handlers=Object.create(null),this._active=Jr,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Jr}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=Jr,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Jr,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",No(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].unhook(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Jr,this._ident=0}},ls=new Ip;ls.addParam(0);var nd=class{constructor(e){this._handler=e,this._data="",this._params=ls,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ls,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=No(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(i=>(this._params=ls,this._data="",this._hitLimit=!1,i));return this._params=ls,this._data="",this._hitLimit=!1,t}},oy=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,r){this.table[t<<8|e]=i<<4|r}addMany(e,t,i,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=i<<4|r}},mt=160,ly=function(){let e=new oy(4095),t=Array.apply(null,Array(256)).map((l,h)=>h),i=(l,h)=>t.slice(l,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;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(mt,0,2,0),e.add(mt,8,5,8),e.add(mt,6,0,6),e.add(mt,11,0,11),e.add(mt,13,13,13),e}(),ay=class extends X{constructor(e=ly){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 Ip,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ae(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new sy),this._dcsParser=this._register(new ny),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>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 s=0;s<e.intermediates.length;++s){let n=e.intermediates.charCodeAt(s);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=r,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,r,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,i){let r=0,s=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&h>-1){for(;h>=0&&(o=l[h](this._params),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&h>-1){for(;h>=0&&(o=l[h](),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,i),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,i),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=n;l<t;++l){switch(r=e[l],s=this._transitions.table[this.currentState<<8|(r<160?r:mt)],s>>4){case 2:for(let f=l+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r<mt){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<mt){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<mt){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<mt){this._printHandler(e,l,f),l=f-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|r],a=h?h.length-1:-1;for(;a>=0&&(o=h[a](this._params),o!==!0);a--)if(o instanceof Promise)return this._preserveStack(3,h,a,s,l),o;a<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++l<t&&(r=e[l])>47&&r<60);l--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let d=this._escHandlers[this._collect<<8|r],c=d?d.length-1:-1;for(;c>=0&&(o=d[c](),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(4,d,c,s,l),o;c<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let f=l+1;;++f)if(f>=t||(r=e[f])===24||r===26||r===27||r>127&&r<mt){this._dcsParser.put(e,l,f),l=f-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,s,l),o;r===27&&(s|=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=l+1;;f++)if(f>=t||(r=e[f])<32||r>127&&r<mt){this._oscParser.put(e,l,f),l=f-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,s,l),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},hy=/^([\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})$/,cy=/^[\da-f]+$/;function od(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=hy.exec(t);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(t.indexOf("#")===0&&(t=t.slice(1),cy.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(t.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 kl(e,t){let i=e.toString(16),r=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function uy(e,t=16){let[i,r,s]=e;return`rgb:${kl(i,t)}/${kl(r,t)}/${kl(s,t)}`}var dy={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ui=131072,ld=10;function ad(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var hd=5e3,cd=0,fy=class extends X{constructor(e,t,i,r,s,n,o,l,h=new ay){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Bg,this._utf8Decoder=new Tg,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ye.clone(),this._eraseAttrDataInternal=ye.clone(),this._onRequestBell=this._register(new T),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new T),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new T),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new T),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new T),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new T),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new T),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new T),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new T),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new T),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new T),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new T),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 th(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(a=>this._activeBuffer=a.activeBuffer)),this._parser.setCsiHandlerFallback((a,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(a),params:d.toArray()})}),this._parser.setEscHandlerFallback(a=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(a)})}),this._parser.setExecuteHandlerFallback(a=>{this._logService.debug("Unknown EXECUTE code: ",{code:a})}),this._parser.setOscHandlerFallback((a,d,c)=>{this._logService.debug("Unknown OSC code: ",{identifier:a,action:d,data:c})}),this._parser.setDcsHandlerFallback((a,d,c)=>{d==="HOOK"&&(c=c.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(a),action:d,payload:c})}),this._parser.setPrintHandler((a,d,c)=>this.print(a,d,c)),this._parser.registerCsiHandler({final:"@"},a=>this.insertChars(a)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},a=>this.scrollLeft(a)),this._parser.registerCsiHandler({final:"A"},a=>this.cursorUp(a)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},a=>this.scrollRight(a)),this._parser.registerCsiHandler({final:"B"},a=>this.cursorDown(a)),this._parser.registerCsiHandler({final:"C"},a=>this.cursorForward(a)),this._parser.registerCsiHandler({final:"D"},a=>this.cursorBackward(a)),this._parser.registerCsiHandler({final:"E"},a=>this.cursorNextLine(a)),this._parser.registerCsiHandler({final:"F"},a=>this.cursorPrecedingLine(a)),this._parser.registerCsiHandler({final:"G"},a=>this.cursorCharAbsolute(a)),this._parser.registerCsiHandler({final:"H"},a=>this.cursorPosition(a)),this._parser.registerCsiHandler({final:"I"},a=>this.cursorForwardTab(a)),this._parser.registerCsiHandler({final:"J"},a=>this.eraseInDisplay(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},a=>this.eraseInDisplay(a,!0)),this._parser.registerCsiHandler({final:"K"},a=>this.eraseInLine(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},a=>this.eraseInLine(a,!0)),this._parser.registerCsiHandler({final:"L"},a=>this.insertLines(a)),this._parser.registerCsiHandler({final:"M"},a=>this.deleteLines(a)),this._parser.registerCsiHandler({final:"P"},a=>this.deleteChars(a)),this._parser.registerCsiHandler({final:"S"},a=>this.scrollUp(a)),this._parser.registerCsiHandler({final:"T"},a=>this.scrollDown(a)),this._parser.registerCsiHandler({final:"X"},a=>this.eraseChars(a)),this._parser.registerCsiHandler({final:"Z"},a=>this.cursorBackwardTab(a)),this._parser.registerCsiHandler({final:"`"},a=>this.charPosAbsolute(a)),this._parser.registerCsiHandler({final:"a"},a=>this.hPositionRelative(a)),this._parser.registerCsiHandler({final:"b"},a=>this.repeatPrecedingCharacter(a)),this._parser.registerCsiHandler({final:"c"},a=>this.sendDeviceAttributesPrimary(a)),this._parser.registerCsiHandler({prefix:">",final:"c"},a=>this.sendDeviceAttributesSecondary(a)),this._parser.registerCsiHandler({final:"d"},a=>this.linePosAbsolute(a)),this._parser.registerCsiHandler({final:"e"},a=>this.vPositionRelative(a)),this._parser.registerCsiHandler({final:"f"},a=>this.hVPosition(a)),this._parser.registerCsiHandler({final:"g"},a=>this.tabClear(a)),this._parser.registerCsiHandler({final:"h"},a=>this.setMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"h"},a=>this.setModePrivate(a)),this._parser.registerCsiHandler({final:"l"},a=>this.resetMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"l"},a=>this.resetModePrivate(a)),this._parser.registerCsiHandler({final:"m"},a=>this.charAttributes(a)),this._parser.registerCsiHandler({final:"n"},a=>this.deviceStatus(a)),this._parser.registerCsiHandler({prefix:"?",final:"n"},a=>this.deviceStatusPrivate(a)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},a=>this.softReset(a)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},a=>this.setCursorStyle(a)),this._parser.registerCsiHandler({final:"r"},a=>this.setScrollRegion(a)),this._parser.registerCsiHandler({final:"s"},a=>this.saveCursor(a)),this._parser.registerCsiHandler({final:"t"},a=>this.windowOptions(a)),this._parser.registerCsiHandler({final:"u"},a=>this.restoreCursor(a)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},a=>this.insertColumns(a)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},a=>this.deleteColumns(a)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},a=>this.selectProtected(a)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},a=>this.requestMode(a,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},a=>this.requestMode(a,!1)),this._parser.setExecuteHandler(D.BEL,()=>this.bell()),this._parser.setExecuteHandler(D.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(D.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(D.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(D.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(D.BS,()=>this.backspace()),this._parser.setExecuteHandler(D.HT,()=>this.tab()),this._parser.setExecuteHandler(D.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(D.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(In.IND,()=>this.index()),this._parser.setExecuteHandler(In.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(In.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ot(a=>(this.setTitle(a),this.setIconName(a),!0))),this._parser.registerOscHandler(1,new ot(a=>this.setIconName(a))),this._parser.registerOscHandler(2,new ot(a=>this.setTitle(a))),this._parser.registerOscHandler(4,new ot(a=>this.setOrReportIndexedColor(a))),this._parser.registerOscHandler(8,new ot(a=>this.setHyperlink(a))),this._parser.registerOscHandler(10,new ot(a=>this.setOrReportFgColor(a))),this._parser.registerOscHandler(11,new ot(a=>this.setOrReportBgColor(a))),this._parser.registerOscHandler(12,new ot(a=>this.setOrReportCursorColor(a))),this._parser.registerOscHandler(104,new ot(a=>this.restoreIndexedColor(a))),this._parser.registerOscHandler(110,new ot(a=>this.restoreFgColor(a))),this._parser.registerOscHandler(111,new ot(a=>this.restoreBgColor(a))),this._parser.registerOscHandler(112,new ot(a=>this.restoreCursorColor(a))),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 a in De)this._parser.registerEscHandler({intermediates:"(",final:a},()=>this.selectCharset("("+a)),this._parser.registerEscHandler({intermediates:")",final:a},()=>this.selectCharset(")"+a)),this._parser.registerEscHandler({intermediates:"*",final:a},()=>this.selectCharset("*"+a)),this._parser.registerEscHandler({intermediates:"+",final:a},()=>this.selectCharset("+"+a)),this._parser.registerEscHandler({intermediates:"-",final:a},()=>this.selectCharset("-"+a)),this._parser.registerEscHandler({intermediates:".",final:a},()=>this.selectCharset("."+a)),this._parser.registerEscHandler({intermediates:"/",final:a},()=>this.selectCharset("/"+a));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(a=>(this._logService.error("Parsing error: ",a),a)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new nd((a,d)=>this.requestStatusString(a,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),hd))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${hd} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){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,t))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ui&&(n=this._parseStack.position+ui)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,a=>String.fromCharCode(a)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(a=>a.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ui&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ui))),o||this._dirtyRowTracker.clearRange(),e.length>ui)for(let a=n;a<e.length;a+=ui){let d=a+ui<e.length?a+ui:e.length,c=typeof e=="string"?this._stringDecoder.decode(e.substring(a,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(a,d),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,s,c,a),this._logSlowResolvingAsync(i),i}else if(!o){let a=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,a))return this._preserveStack(r,s,a,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=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(l,this._bufferService.rows-1)})}print(e,t,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,a=this._coreService.modes.insertMode,d=this._curAttrData,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&c.getWidth(this._activeBuffer.x-1)===2&&c.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let u=t;u<i;++u){if(r=e[u],r<127&&n){let p=n[String.fromCharCode(r)];p&&(r=p.charCodeAt(0))}let m=this._unicodeService.charProperties(r,f);s=ji.extractWidth(m);let S=ji.extractShouldJoin(m),w=S?ji.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire(_i(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-w>l){if(h){let p=c,_=this._activeBuffer.x-w;for(this._activeBuffer.x=w,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),c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),w>0&&c instanceof ns&&c.copyCellsFrom(p,_,0,w,!1);_<l;)p.setCellFromCodepoint(_++,0,1,d)}else if(this._activeBuffer.x=l-1,s===2)continue}if(S&&this._activeBuffer.x){let p=c.getWidth(this._activeBuffer.x-1)?1:2;c.addCodepointToCell(this._activeBuffer.x-p,r,s);for(let _=s-w;--_>=0;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(a&&(c.insertCells(this._activeBuffer.x,s-w,this._activeBuffer.getNullCell(d)),c.getWidth(l-1)===2&&c.setCellFromCodepoint(l-1,0,1,d)),c.setCellFromCodepoint(this._activeBuffer.x++,r,s,d),s>0)for(;--s;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&i-t>0&&c.getWidth(this._activeBuffer.x)===0&&!c.hasContent(this._activeBuffer.x)&&c.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>ad(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new nd(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ot(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let i;switch(e.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,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);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,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);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,t);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(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let 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(;t--;)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(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let 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;t--;)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(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(ye));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let i=e.params[0]||1,r=ji.extractWidth(t),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),l=0;for(let a=0;a<n.length;){let d=n.codePointAt(a)||0;o[l++]=d,a+=d>65535?2:1}let h=l;for(let a=1;a<i;++a)o.copyWithin(h,0,l),h+=l;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(D.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(D.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(D.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(D.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(D.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,$i),this._charsetService.setgCharset(1,$i),this._charsetService.setgCharset(2,$i),this._charsetService.setgCharset(3,$i);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:h}=this._bufferService,{active:a,alt:d}=l,c=this._optionsService.rawOptions,f=(S,w)=>(o.triggerDataEvent(`${D.ESC}[${t?"":"?"}${S};${w}$y`),!0),u=S=>S?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,u(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,u(c.convertEol)):f(m,0):m===1?f(m,u(r.applicationCursorKeys)):m===3?f(m,c.windowOptions.setWinLines?h===80?2:h===132?1:0:0):m===6?f(m,u(r.origin)):m===7?f(m,u(r.wraparound)):m===8?f(m,3):m===9?f(m,u(s==="X10")):m===12?f(m,u(c.cursorBlink)):m===25?f(m,u(!o.isCursorHidden)):m===45?f(m,u(r.reverseWraparound)):m===66?f(m,u(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,u(s==="VT200")):m===1002?f(m,u(s==="DRAG")):m===1003?f(m,u(s==="ANY")):m===1004?f(m,u(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,u(n==="SGR")):m===1015?f(m,4):m===1016?f(m,u(n==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,u(a===d)):m===2004?f(m,u(r.bracketedPasteMode)):m===2026?f(m,u(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,i,r,s){return t===2?(e|=50331648,e&=-16777216,e|=Ks.fromColorRGB([i,r,s])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=e.params[t+n],e.hasSubParams(t+n)){let o=e.getSubParams(t+n),l=0;do r[1]===5&&(s=1),r[n+l+1+s]=o[l];while(++l<o.length&&l+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+t<e.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(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ye.fg,e.bg=ye.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,i,r=this._curAttrData;for(let s=0;s<t;s++)i=e.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(e.hasSubParams(s)?e.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|=ye.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=ye.bg&16777215):i===38||i===48||i===58?s+=this._extractColor(e,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|=ye.fg&16777215,r.bg&=-67108864,r.bg|=ye.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${D.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${D.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${D.ESC}[?${t};${i}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ye.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!ad(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${D.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>ld&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>ld&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],i=e.split(";");for(;i.length>1;){let r=i.shift(),s=i.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(ud(n))if(s==="?")t.push({type:0,index:n});else{let o=od(s);o&&t.push({type:1,index:n,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.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:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let r=0;r<i.length&&!(t>=this._specialColors.length);++r,++t)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=od(i[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],i=e.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let s=parseInt(i[r]);ud(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,$i),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(dy[e[0]],De[e[1]]||$i),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ye.clone(),this._eraseAttrDataInternal=ye.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ct;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(i);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=o=>(this._coreService.triggerDataEvent(`${D.ESC}${o}${D.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},th=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(cd=e,e=t,t=cd),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};th=me([I(0,Qe)],th);function ud(e){return 0<=e&&e<256}var _y=5e7,dd=12,py=50,my=class extends X{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 T),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>_y)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,t);if(s){let o=l=>performance.now()-i>=dd?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(i,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-i>=dd)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>py&&(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()}},ih=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(h,l)),this._dataByLinkId.set(h.id,h),h.id}let i=e,r=this._getEntryIdKey(i),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};ih=me([I(0,Qe)],ih);var fd=!1,vy=class extends X{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Br),this._onBinary=this._register(new T),this.onBinary=this._onBinary.event,this._onData=this._register(new T),this.onData=this._onData.event,this._onLineFeed=this._register(new T),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new T),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new T),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new T),this._instantiationService=new H0,this.optionsService=this._register(new Q0(e)),this._instantiationService.setService(Je,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Qa)),this._instantiationService.setService(Qe,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ga)),this._instantiationService.setService(ip,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ja)),this._instantiationService.setService(ir,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Za)),this._instantiationService.setService(tp,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ji)),this._instantiationService.setService(Ig,this.unicodeService),this._charsetService=this._instantiationService.createInstance(iy),this._instantiationService.setService(Ag,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ih),this._instantiationService.setService(rp,this._oscLinkService),this._inputHandler=this._register(new fy(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ie.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ie.forward(this._bufferService.onResize,this._onResize)),this._register(Ie.forward(this.coreService.onData,this._onData)),this._register(Ie.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 my((t,i)=>this._inputHandler.parse(t,i))),this._register(Ie.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new T),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!fd&&(this._logService.warn("writeSync is unreliable and will be removed soon."),fd=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Op),t=Math.max(t,Ap),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(sd.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(sd(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ae(()=>{for(let t of e)t.dispose()})}}},gy={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 Sy(e,t,i,r){var o;let s={type:0,cancel:!1,key:void 0},n=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=D.ESC+"OA":s.key=D.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=D.ESC+"OD":s.key=D.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=D.ESC+"OC":s.key=D.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=D.ESC+"OB":s.key=D.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":D.DEL,e.altKey&&(s.key=D.ESC+s.key);break;case 9:if(e.shiftKey){s.key=D.ESC+"[Z";break}s.key=D.HT,s.cancel=!0;break;case 13:s.key=e.altKey?D.ESC+D.CR:D.CR,s.cancel=!0;break;case 27:s.key=D.ESC,e.altKey&&(s.key=D.ESC+D.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;n?s.key=D.ESC+"[1;"+(n+1)+"D":t?s.key=D.ESC+"OD":s.key=D.ESC+"[D";break;case 39:if(e.metaKey)break;n?s.key=D.ESC+"[1;"+(n+1)+"C":t?s.key=D.ESC+"OC":s.key=D.ESC+"[C";break;case 38:if(e.metaKey)break;n?s.key=D.ESC+"[1;"+(n+1)+"A":t?s.key=D.ESC+"OA":s.key=D.ESC+"[A";break;case 40:if(e.metaKey)break;n?s.key=D.ESC+"[1;"+(n+1)+"B":t?s.key=D.ESC+"OB":s.key=D.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=D.ESC+"[2~");break;case 46:n?s.key=D.ESC+"[3;"+(n+1)+"~":s.key=D.ESC+"[3~";break;case 36:n?s.key=D.ESC+"[1;"+(n+1)+"H":t?s.key=D.ESC+"OH":s.key=D.ESC+"[H";break;case 35:n?s.key=D.ESC+"[1;"+(n+1)+"F":t?s.key=D.ESC+"OF":s.key=D.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=D.ESC+"[5;"+(n+1)+"~":s.key=D.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=D.ESC+"[6;"+(n+1)+"~":s.key=D.ESC+"[6~";break;case 112:n?s.key=D.ESC+"[1;"+(n+1)+"P":s.key=D.ESC+"OP";break;case 113:n?s.key=D.ESC+"[1;"+(n+1)+"Q":s.key=D.ESC+"OQ";break;case 114:n?s.key=D.ESC+"[1;"+(n+1)+"R":s.key=D.ESC+"OR";break;case 115:n?s.key=D.ESC+"[1;"+(n+1)+"S":s.key=D.ESC+"OS";break;case 116:n?s.key=D.ESC+"[15;"+(n+1)+"~":s.key=D.ESC+"[15~";break;case 117:n?s.key=D.ESC+"[17;"+(n+1)+"~":s.key=D.ESC+"[17~";break;case 118:n?s.key=D.ESC+"[18;"+(n+1)+"~":s.key=D.ESC+"[18~";break;case 119:n?s.key=D.ESC+"[19;"+(n+1)+"~":s.key=D.ESC+"[19~";break;case 120:n?s.key=D.ESC+"[20;"+(n+1)+"~":s.key=D.ESC+"[20~";break;case 121:n?s.key=D.ESC+"[21;"+(n+1)+"~":s.key=D.ESC+"[21~";break;case 122:n?s.key=D.ESC+"[23;"+(n+1)+"~":s.key=D.ESC+"[23~";break;case 123:n?s.key=D.ESC+"[24;"+(n+1)+"~":s.key=D.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=D.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=D.DEL:e.keyCode===219?s.key=D.ESC:e.keyCode===220?s.key=D.FS:e.keyCode===221&&(s.key=D.GS);else if((!i||r)&&e.altKey&&!e.metaKey){let l=(o=gy[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)s.key=D.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,a=String.fromCharCode(h);e.shiftKey&&(a=a.toUpperCase()),s.key=D.ESC+a}else if(e.keyCode===32)s.key=D.ESC+(e.ctrlKey?D.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),s.key=D.ESC+h,s.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=D.US),e.key==="@"&&(s.key=D.NUL));break}return s}var ve=0,yy=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new po,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new po,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((s,n)=>this._getKey(s)-this._getKey(n)),t=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(r[s]=e[t],t++):r[s]=this._array[i++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(ve=this._search(t),ve===-1)||this._getKey(this._array[ve])!==t)return!1;do if(this._array[ve]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ve),!0;while(++ve<this._array.length&&this._getKey(this._array[ve])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,n)=>s-n),t=0,i=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:i[r++]=this._array[s];this._array=i,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&&(ve=this._search(e),!(ve<0||ve>=this._array.length)&&this._getKey(this._array[ve])===e))do yield this._array[ve];while(++ve<this._array.length&&this._getKey(this._array[ve])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ve=this._search(e),!(ve<0||ve>=this._array.length)&&this._getKey(this._array[ve])===e))do t(this._array[ve]);while(++ve<this._array.length&&this._getKey(this._array[ve])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let r=t+i>>1,s=this._getKey(this._array[r]);if(s>e)i=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},bl=0,_d=0,wy=class extends X{constructor(){super(),this._decorations=new yy(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new T),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new T),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ae(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Cy(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let r=0,s=0;for(let n of this._decorations.getKeyIterator(t))r=n.options.x??0,s=r+(n.options.width??1),e>=r&&e<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,r){this._decorations.forEachByKey(t,s=>{bl=s.options.x??0,_d=bl+(s.options.width??1),e>=bl&&e<_d&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},Cy=class extends Li{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new T),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new T),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ce.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ce.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},xy=1e3,ky=class{constructor(e,t=xy){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,n=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},pd=20,mo=class extends X{constructor(e,t,i,r){super(),this._terminal=e,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 ky(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(`
64
+ `))),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(q(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ae(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<pd+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
65
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===pd+1&&(this._liveRegion.textContent+=Ca.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,r=i.lines.length.toString();for(let s=e;s<=t;s++){let n=i.lines.get(i.ydisp+s),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",h=(i.ydisp+s+1).toString(),a=this._rowElements[s];a&&(l.length===0?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=l,this._rowColumns.set(a,o)),a.setAttribute("aria-posinset",h),a.setAttribute("aria-setsize",r),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],s=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||e.relatedTarget!==r)return;let o,l;if(t===0?(o=i,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===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(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((l=r.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(i.node))return;let s=({node:h,offset:a})=>{let d=h instanceof Text?h.parentNode:h,c=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(c))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(d);if(!f)return console.warn("columns is null. Race condition?"),null;let u=a<f.length?f[a]:f.slice(-1)[0]+1;return u>=this._terminal.cols&&(++c,u=0),{row:c,column:u}},n=s(t),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(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,n;e.style.transform="";let t=e.getBoundingClientRect().width,i=(n=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:n[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};mo=me([I(1,ec),I(2,si),I(3,ni)],mo);var rh=class extends X{constructor(e,t,i,r,s){super(),this._element=e,this._mouseService=t,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 T),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new T),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ae(()=>{var n;Ji(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(q(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(q(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(q(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(q(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.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||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):o.provideLinks(e.y,l=>{var a,d;if(this._isMouseOut)return;let h=l==null?void 0:l.map(c=>({link:c}));(a=this._activeProviderReplies)==null||a.set(n,h),i=this._checkLinkProviderResult(n,e,i),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],l=o.link.range.start.y<e?0:o.link.range.start.x,h=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let a=l;a<=h;a++){if(i.has(a)){s.splice(n--,1);break}i.add(a)}}}}_checkLinkProviderResult(e,t,i){var n;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(l=>this._linkAtPosition(l.link,t));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 l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(h=>this._linkAtPosition(h.link,t));if(l){i=!0,this._handleNewLink(l);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&by(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Ji(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{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(e.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(e,t,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.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);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return i<=s&&s<=r}_positionFromMouseEvent(e,t,i){let r=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,r,s){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};rh=me([I(1,tc),I(2,ni),I(3,Qe),I(4,np)],rh);function by(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Ey=class extends vy{constructor(e={}){super(e),this._linkifier=this._register(new Br),this.browser=kp,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Br),this._onCursorMove=this._register(new T),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new T),this.onKey=this._onKey.event,this._onRender=this._register(new T),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new T),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new T),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new T),this.onBell=this._onBell.event,this._onFocus=this._register(new T),this._onBlur=this._register(new T),this._onA11yCharEmitter=this._register(new T),this._onA11yTabEmitter=this._register(new T),this._onWillOpen=this._register(new T),this._setup(),this._decorationService=this._instantiationService.createInstance(wy),this._instantiationService.setService(Vs,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(p0),this._instantiationService.setService(np,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(ka)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Ie.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ie.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ie.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ie.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ae(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let i,r="";switch(t.index){case 256:i="foreground",r="10";break;case 257:i="background",r="11";break;case 258:i="cursor",r="12";break;default:i="ansi",r="4;"+t.index}switch(t.type){case 0:let s=ne.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${D.ESC}]${r};${uy(s)}${Cp.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=we.toColor(...t.color));else{let n=i;this._themeService.modifyColors(o=>o[n]=we.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(mo,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.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(D.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(q(this.element,"copy",t=>{this.hasSelection()&&Pg(t,this._selectionService)}));let e=t=>Mg(t,this.textarea,this.coreService,this.optionsService);this._register(q(this.textarea,"paste",e)),this._register(q(this.element,"paste",e)),bp?this._register(q(this.element,"mousedown",t=>{t.button===2&&bu(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(q(this.element,"contextmenu",t=>{bu(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),hc&&this._register(q(this.element,"auxclick",t=>{t.button===1&&G_(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(q(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(q(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(q(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(q(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(q(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(q(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(q(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;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"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(q(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",wa.get()),Lp||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(f0,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(si,this._coreBrowserService),this._register(q(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(q(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ka,this._document,this._helperContainer),this._instantiationService.setService(Oo,this._charSizeService),this._themeService=this._instantiationService.createInstance(Xa),this._instantiationService.setService(Ar,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(fo),this._instantiationService.setService(sp,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(qa,this.rows,this.screenElement)),this._instantiationService.setService(ni,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Wa,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Va),this._instantiationService.setService(tc,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(rh,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Fa,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ya,this.element,this.screenElement,r)),this._instantiationService.setService($g,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(Ie.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(Ha,this.screenElement)),this._register(q(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),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(mo,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uo,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uo,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Ua,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){var a,d,c,f,u;let o=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!o)return!1;let l,h;switch(n.overrideType||n.type){case"mousemove":h=32,n.buttons===void 0?(l=3,n.button!==void 0&&(l=n.button<3?n.button:3)):l=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":h=0,l=n.button<3?n.button:3;break;case"mousedown":h=1,l=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let m=n.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(n,(f=(c=(d=(a=e._renderService)==null?void 0:a.dimensions)==null?void 0:d.device)==null?void 0:c.cell)==null?void 0:f.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return!1;h=m<0?0:1,l=4;break;default:return!1}return h===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:h,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),n&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),n&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),n&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(q(t,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(n)})),this._register(q(t,"wheel",n=>{var o,l,h,a,d;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,(a=(h=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:h.cell)==null?void 0:a.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(n,!0);let c=D.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(c,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){X_(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,i){this._selectionService.setSelection(e,t,i)}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,t){var i;(i=this._selectionService)==null||i.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=Sy(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let r=this.rows-1;return this.scrollLines(i.type===2?-r:r),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===D.ETX||i.key===D.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Dy(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var i;(i=this._charSizeService)==null||i.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(ye));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.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(D.ESC+"[I"):this.coreService.triggerDataEvent(D.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.ESC}[4;${i};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Dy(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Ly=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Ry=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Ct)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},md=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new Ry(t)}getNullCell(){return new Ct}},Py=class extends X{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new T),this.onBufferChange=this._onBufferChange.event,this._normal=new md(this._core.buffers.normal,"normal"),this._alternate=new md(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)}},My=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,r)=>t(i,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},By=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}},Ty=["cols","rows"],At=0,Ny=class extends X{constructor(e){super(),this._core=this._register(new Ey(e)),this._addonManager=this._register(new Ly),this._publicOptions={...this._core.options};let t=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:t.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(e){if(Ty.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new My(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new By(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 Py(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
66
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return wa.get()},set promptLabel(e){wa.set(e)},get tooMuchOutput(){return Ca.get()},set tooMuchOutput(e){Ca.set(e)}}}_verifyIntegers(...e){for(At of e)if(At===1/0||isNaN(At)||At%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(At of e)if(At&&(At===1/0||isNaN(At)||At%1!==0||At<0))throw new Error("This API only accepts positive integers")}};/**
67
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
68
+ * @license MIT
69
+ *
70
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
71
+ * @license MIT
72
+ *
73
+ * Originally forked from (with the author's permission):
74
+ * Fabrice Bellard's javascript vt100 for jslinux:
75
+ * http://bellard.org/jslinux/
76
+ * Copyright (c) 2011 Fabrice Bellard
77
+ */var Oy=2,Ay=1,Iy=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var c;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((c=this._terminal.options.overviewRuler)==null?void 0:c.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"))},l=o.top+o.bottom,h=o.right+o.left,a=r-l,d=s-h-t;return{cols:Math.max(Oy,Math.floor(d/e.css.cell.width)),rows:Math.max(Ay,Math.floor(a/e.css.cell.height))}}};function zy({session:e,token:t,cols:i,rows:r,readonly:s=!1,takeSize:n,onData:o,onExit:l,onFiles:h}){const a=["localhost","127.0.0.1","::1","[::1]"].includes(location.hostname);if(location.protocol!=="https:"&&!a)throw new Error("nexuscrew: ws:// rifiutato su origine non-locale e non-TLS (apri via tunnel su localhost o servi in HTTPS)");const d=location.protocol==="https:"?"wss":"ws",c=new WebSocket(`${d}://${location.host}/ws`);return c.binaryType="arraybuffer",c.onopen=()=>{const f={type:"attach",session:e,token:t,cols:i,rows:r,readonly:s};n!==void 0&&(f.takeSize=n),c.send(JSON.stringify(f))},c.onmessage=f=>{if(typeof f.data=="string"){let u;try{u=JSON.parse(f.data)}catch{return}u.type==="exit"&&l&&l(u.code),u.type==="files"&&h&&h(u)}else o&&o(new Uint8Array(f.data))},{sendInput:f=>{c.readyState===1&&c.send(typeof f=="string"?new TextEncoder().encode(f):f)},resize:(f,u)=>{c.readyState===1&&c.send(JSON.stringify({type:"resize",cols:f,rows:u}))},action:f=>{c.readyState===1&&c.send(JSON.stringify({type:"action",name:f}))},close:()=>c.close(),raw:c}}function zp({session:e,token:t,readonly:i,takeSize:r,sendRef:s,actionRef:n,ctrlRef:o,setCtrlArmed:l,onFiles:h,fontSize:a=13}){const d=O.useRef(null),c=O.useRef(null),f=O.useRef(a);return f.current=a,O.useEffect(()=>{const u=c.current;u&&(u.term.options.fontSize=a,u.fit.fit(),u.sock.resize(u.term.cols,u.term.rows))},[a]),O.useEffect(()=>{const u=new Ny({cursorBlink:!0,fontSize:f.current,scrollback:1e3,theme:{background:"#0a0e0a"}}),m=new Iy;u.loadAddon(m),u.open(d.current),m.fit();const S=new TextDecoder;let w;try{w=zy({session:e,token:t,readonly:i,takeSize:r,onFiles:h,cols:u.cols,rows:u.rows,onData:b=>u.write(S.decode(b)),onExit:()=>u.write(`\r
78
+ \x1B[33m[sessione finita]\x1B[0m\r
79
+ `)})}catch(b){return u.write(`\r
80
+ \x1B[31m${b.message}\x1B[0m\r
81
+ `),()=>u.dispose()}c.current={term:u,fit:m,sock:w},s&&(s.current=b=>w.sendInput(b)),n&&(n.current=b=>w.action(b));const p=u.onData(b=>{if(!i){if(o&&o.current&&b.length===1){const N=b.charCodeAt(0);let K=N;N>=97&&N<=122?K=N-96:N>=64&&N<=95?K=N-64:N===32&&(K=0),b=String.fromCharCode(K),o.current=!1,l&&l(!1)}w.sendInput(b)}}),_=d.current,v=24;let y=null,C=null,k=0,L=null;const M=b=>{if(b.touches.length!==1){y=null;return}y=b.touches[0].clientY,C=b.touches[0].clientX,k=0,L=null},V=b=>{if(y===null||b.touches.length!==1)return;b.preventDefault(),b.stopPropagation();const N=b.touches[0];if(L===null&&(Math.abs(N.clientY-y)>8||Math.abs(N.clientX-C)>8)&&(L=Math.abs(N.clientY-y)>Math.abs(N.clientX-C)),!!L){for(k+=N.clientY-y,y=N.clientY;k>=v;)w.action("scroll-up"),k-=v;for(;k<=-v;)w.action("scroll-down"),k+=v}},W=()=>{y=null};let U=0;const A=b=>{for(b.preventDefault(),b.stopPropagation(),U+=b.deltaY;U<=-v;)w.action("scroll-up"),U+=v;for(;U>=v;)w.action("scroll-down"),U-=v};_.addEventListener("touchstart",M,{passive:!0}),_.addEventListener("touchmove",V,{passive:!1,capture:!0}),_.addEventListener("touchend",W,{passive:!0}),_.addEventListener("wheel",A,{passive:!1,capture:!0});const E=()=>{m.fit(),w.resize(u.cols,u.rows)};window.addEventListener("resize",E);const P=window.visualViewport;return P&&(P.addEventListener("resize",E),P.addEventListener("scroll",E)),()=>{c.current=null,p.dispose(),_.removeEventListener("touchstart",M),_.removeEventListener("touchmove",V,{capture:!0}),_.removeEventListener("touchend",W),_.removeEventListener("wheel",A,{capture:!0}),window.removeEventListener("resize",E),P&&(P.removeEventListener("resize",E),P.removeEventListener("scroll",E)),w.close(),u.dispose()}},[e,t,i,r,s,n,o,l,h]),g.jsx("div",{className:"nc-terminal",ref:d})}const vd="",Yt="\x1B",$y=[{label:"↑",seq:Yt+"[A"},{label:"↓",seq:Yt+"[B"},{label:"PgUp",seq:Yt+"[5~"},{label:"PgDn",seq:Yt+"[6~"}];function Fy({send:e,action:t,ctrlArmed:i=!1,onCtrl:r}){const[s,n]=O.useState(!1),o=(h,a,d)=>g.jsx("button",{onMouseDown:c=>{c.preventDefault(),e(a),d&&d()},children:h},h),l=(h,a)=>g.jsx("button",{onMouseDown:d=>{d.preventDefault(),t(a)},children:h},h);return s?g.jsxs("div",{className:"nc-keybar copy",children:[g.jsx("span",{className:"tag",children:"copy-mode"}),$y.map(h=>o(h.label,h.seq)),o("esci (q)","q",()=>n(!1))]}):g.jsxs("div",{className:"nc-keybar",children:[o("esc",Yt),o("tab"," "),g.jsx("button",{className:i?"armed":"",onMouseDown:h=>{h.preventDefault(),r&&r()},children:"ctrl"},"ctrl"),o("⌃C",""),o("←",Yt+"[D"),o("↑",Yt+"[A"),o("↓",Yt+"[B"),o("→",Yt+"[C"),o("scroll",vd+"[",()=>n(!0)),l("←win","prev-window"),l("win→","next-window"),l("⬅pane","pane-left"),l("pane➡","pane-right"),o("detach",vd+"d")]})}const Hy=e=>e>1048576?`${(e/1048576).toFixed(1)}M`:e>1024?`${(e/1024).toFixed(0)}K`:`${e}B`;function $p({session:e,token:t,filesEvent:i,onClose:r}){Ni();const[s,n]=O.useState("outbox"),[o,l]=O.useState({inbox:[],outbox:[]}),[h,a]=O.useState(""),d=O.useRef(null);async function c(){try{const w=await(await yt(`/api/files?session=${encodeURIComponent(e)}`,t)).json();if(w.error){a(w.error);return}l(w);const p=w.outbox[0]?w.outbox[0].mtime:0;localStorage.setItem(z_(e),String(p))}catch(S){a(String(S))}}O.useEffect(()=>{c()},[e]),O.useEffect(()=>{i&&i.session===e&&c()},[i]);async function f(S){for(const w of S){a(`carico ${w.name}…`);const p=new FormData;p.append("session",e),p.append("file",w);try{const v=await(await yt("/api/files/upload",t,{method:"POST",body:p})).json();a(v.error?`errore: ${v.error}`:"")}catch(_){a(String(_))}}c()}async function u(S){const w=await yt(`/api/files/download?session=${encodeURIComponent(e)}&box=${s}&name=${encodeURIComponent(S)}`,t);if(!w.ok){a("errore download");return}const p=await w.blob(),_=URL.createObjectURL(p),v=document.createElement("a");v.href=_,v.download=S,v.click(),URL.revokeObjectURL(_)}async function m(S){await yt(`/api/files?session=${encodeURIComponent(e)}&box=${s}&name=${encodeURIComponent(S)}`,t,{method:"DELETE"}),c()}return g.jsxs("div",{className:"nc-files",children:[g.jsxs("header",{children:[g.jsx("b",{children:e}),g.jsx("button",{onClick:r,title:F("close"),children:g.jsx(Pt,{name:"x",size:20})})]}),g.jsxs("nav",{children:[g.jsx("button",{className:s==="outbox"?"on":"",onClick:()=>n("outbox"),children:"outbox"}),g.jsx("button",{className:s==="inbox"?"on":"",onClick:()=>n("inbox"),children:"inbox"}),g.jsxs("button",{className:"up",onClick:()=>d.current&&d.current.click(),children:[g.jsx(Pt,{name:"upload",size:18})," ",F("upload")]}),g.jsx("input",{type:"file",multiple:!0,ref:d,style:{display:"none"},onChange:S=>{f(Array.from(S.target.files||[])),S.target.value=""}})]}),h&&g.jsx("div",{className:"nc-busy",children:h}),g.jsxs("ul",{children:[o[s].map(S=>g.jsxs("li",{children:[g.jsx("span",{className:"name",onClick:()=>u(S.name),children:S.name}),g.jsx("small",{children:Hy(S.size)}),g.jsx("button",{onClick:()=>m(S.name),title:"elimina",children:g.jsx(Pt,{name:"trash",size:18})})]},S.name)),o[s].length===0&&g.jsx("li",{className:"empty",children:F("empty-files")})]})]})}const Wy="\r";function jy(e){let t=e.length;for(;t>0;){const i=e.charCodeAt(t-1);if(i===10||i===13)t-=1;else break}return e.slice(0,t)}function Fp({send:e,token:t}){Ni();const[i,r]=O.useState(""),[s,n]=O.useState(!1),[o,l]=O.useState(""),[h,a]=O.useState(!1),d=O.useRef(null),c=O.useRef(null);O.useEffect(()=>{let p=!1;return yt("/api/voice/status",t).then(_=>_.json()).then(_=>{p||a(!!_.serverSttConfigured)}).catch(()=>{p||a(!1)}),()=>{p=!0}},[t]);const u=!!(typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)||h);function m(){const p=jy(i);p&&(e(p),e(Wy),r(""))}function S(){d.current&&d.current.stop(),c.current&&c.current.stop(),n(!1)}async function w(){l("");const p=window.SpeechRecognition||window.webkitSpeechRecognition;if(p){const _=new p;_.lang="it-IT",_.continuous=!1,_.interimResults=!0;const v=i?`${i} `:"";_.onresult=y=>{const C=Array.from(y.results).map(k=>k[0].transcript).join("");r(v+C)},_.onend=()=>n(!1),_.onerror=y=>{l(`voice: ${y.error||"errore"}`),n(!1)},d.current=_,_.start(),n(!0);return}try{const _=await navigator.mediaDevices.getUserMedia({audio:!0}),v=new MediaRecorder(_),y=[];v.ondataavailable=C=>y.push(C.data),v.onstop=async()=>{_.getTracks().forEach(C=>C.stop()),n(!1),l("trascrivo…");try{const C=new Blob(y,{type:v.mimeType||"audio/webm"}),L=await(await yt("/api/voice/transcribe",t,{method:"POST",headers:{"content-type":"application/octet-stream"},body:C})).json();L.error?l(L.error):(l(""),r(M=>M+(M?" ":"")+(L.text||"")))}catch(C){l(String(C))}},c.current={stop:()=>v.state!=="inactive"&&v.stop()},v.start(),n(!0)}catch{l("microfono non disponibile"),n(!1)}}return g.jsxs("div",{className:"nc-composer",children:[o&&g.jsx("div",{className:"nc-composer-err",children:o}),g.jsxs("div",{className:"nc-composer-row",children:[g.jsx("textarea",{rows:2,value:i,placeholder:F("composer-placeholder"),onChange:p=>r(p.target.value)}),u&&g.jsx("button",{className:s?"mic on":"mic",onClick:s?S:w,title:F("voice"),children:g.jsx(Pt,{name:"mic",size:22})}),g.jsx("button",{className:"go",onClick:m,title:F("send"),children:g.jsx(Pt,{name:"enter",size:22})})]})]})}function Uy(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function Ky({sessions:e=[],cells:t=[],activeSessions:i=[],onPick:r,onAddTile:s,onPower:n,onKill:o,onNew:l}){const[h,a]=Ni(),d=new Set((t||[]).map(u=>u.tmuxSession)),c=(e||[]).filter(u=>!d.has(u.name)),f=new Set(i||[]);return g.jsxs("aside",{className:"nc-sidebar",children:[g.jsxs("div",{className:"nc-side-head",children:[g.jsx("span",{className:"nc-side-title",children:F("fleet")}),g.jsxs("button",{className:"nc-new-btn",onClick:l,title:F("new-session"),children:["+ ",F("new")]})]}),(t||[]).length>0&&g.jsx("div",{className:"nc-side-group",children:t.map(u=>{const m=u.degraded?"warn":u.tmux?"on":"",S=u.degraded?F("cell-degraded"):u.tmux?F("cell-on"):F("cell-off");return g.jsxs("div",{className:"nc-cell",title:S,children:[g.jsx("span",{className:`nc-dot ${m}`}),g.jsxs("span",{className:"nc-cell-main",children:[g.jsx("b",{children:u.cell}),g.jsxs("small",{children:[u.engine,u.key?`·${u.key}`:""]})]}),g.jsx("button",{className:"nc-power",onClick:()=>n&&n(u),title:u.active?F("power-off"):F("power-on"),children:"⏻"})]},u.cell)})}),g.jsx("div",{className:"nc-side-group-title",children:F("other-sessions")}),g.jsxs("div",{className:"nc-side-group",children:[c.map(u=>g.jsxs("div",{className:`nc-side-card${f.has(u.name)?" active":""}`,draggable:!0,onDragStart:m=>m.dataTransfer.setData("text/nc-session",u.name),onClick:()=>s&&s(u.name),onDoubleClick:()=>r&&r(u.name),children:[g.jsx("span",{className:u.attached?"nc-dot on":"nc-dot"}),g.jsxs("span",{className:"nc-card-main",children:[g.jsx("b",{children:u.name}),g.jsxs("small",{children:[u.preview?u.preview:u.cmd?u.cmd:F("windows").replace("{n}",String(u.windows||0)),u.outbox&&u.outbox.count>0?` · 📦${u.outbox.count}`:""]})]}),u.activity?g.jsx("span",{className:"nc-rel",children:Uy(u.activity)}):null,g.jsx("button",{className:"nc-menu",title:F("terminate"),onClick:m=>{m.stopPropagation(),window.confirm(F("terminate-confirm").replace("{name}",u.name))&&o&&o(u.name)},children:"⋯"})]},u.name)),c.length===0&&g.jsx("div",{className:"nc-empty",children:F("no-sessions-short")})]}),g.jsx("div",{className:"nc-side-lang",children:K_.map((u,m)=>g.jsxs("span",{children:[m>0&&" · ",g.jsx("button",{className:`nc-lang-btn${h===u?" on":""}`,onClick:()=>a(u),title:u,children:u.toUpperCase()})]},u))})]})}function Vy({session:e,token:t,focused:i,onFocus:r,onClose:s,onOpenSingle:n,alive:o=!0}){const l=O.useRef(()=>{}),h=O.useRef(()=>{}),a=O.useRef(!1),[d,c]=O.useState(!1),[f,u]=O.useState(!1),[m,S]=O.useState(!1),[w,p]=O.useState(null);return g.jsxs("div",{className:`nc-tile${i?" focused":""}`,onMouseDown:()=>r&&r(e),children:[g.jsxs("div",{className:"nc-tile-head",children:[g.jsxs("button",{className:"nc-tile-name",onClick:()=>r&&r(e),children:[g.jsx("span",{className:o?"nc-dot on":"nc-dot"}),g.jsx("b",{children:e})]}),g.jsxs("span",{className:"nc-tile-actions",children:[g.jsx("button",{onClick:()=>u(_=>!_),title:"composer",children:"⌨"}),g.jsx("button",{onClick:()=>S(_=>!_),title:"file",children:"📁"}),n&&g.jsx("button",{onClick:()=>n(e),title:"vista singola",children:"↗"}),s&&g.jsx("button",{className:"nc-tile-close",onClick:()=>s(e),title:"chiudi",children:"✕"})]})]}),g.jsxs("div",{className:"nc-tile-body",children:[g.jsx(zp,{session:e,token:t,readonly:!1,takeSize:!1,sendRef:l,actionRef:h,ctrlRef:a,setCtrlArmed:c,onFiles:p,fontSize:11}),m&&g.jsx("div",{className:"nc-tile-files",onMouseDown:_=>_.stopPropagation(),children:g.jsx($p,{session:e,token:t,filesEvent:w,onClose:()=>S(!1)})})]}),f&&g.jsx("div",{className:"nc-tile-composer",onMouseDown:_=>_.stopPropagation(),children:g.jsx(Fp,{send:_=>l.current(_),token:t})})]})}const qy=9,vo=.2;function Hp(){return{columns:[]}}function zs(e){return e.columns.flatMap(t=>t.tiles.map(i=>i.session))}const zo=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(i=>({...i}))}))});function cc(e,t,i){if(zs(e).includes(t)||zs(e).length>=qy)return e;const r=zo(e),s={session:t,height:1};if(i==="end")return r.columns.push({width:1,tiles:[s]}),r;if(i&&typeof i.col=="number"&&typeof i.row=="number"&&r.columns[i.col])return r.columns[i.col].tiles.splice(i.row,0,s),r;if(i&&typeof i.col=="number"){const n=Math.max(0,Math.min(r.columns.length,i.col));return r.columns.splice(n,0,{width:1,tiles:[s]}),r}return r.columns.push({width:1,tiles:[s]}),r}function uc(e,t){const i=zo(e);for(const r of i.columns)r.tiles=r.tiles.filter(s=>s.session!==t);return i.columns=i.columns.filter(r=>r.tiles.length>0),i}function Yy(e,t,i){return zs(e).includes(t)?cc(uc(e,t),t,i):e}function Xy(e,t,i){const r=zo(e);return r.columns[t]&&(r.columns[t].width=Math.max(vo,Number(i)||1)),r}function Gy(e,t,i,r){const s=zo(e),n=s.columns[t]&&s.columns[t].tiles[i];return n&&(n.height=Math.max(vo,Number(r)||1)),s}function Qy(e){if(!e||!Array.isArray(e.columns))return Hp();const t=e.columns.map(r=>({width:Math.max(vo,Number(r&&r.width)||1),tiles:(Array.isArray(r&&r.tiles)?r.tiles:[]).filter(s=>s&&typeof s.session=="string"&&s.session).map(s=>({session:s.session,height:Math.max(vo,Number(s.height)||1)}))})).filter(r=>r.tiles.length>0),i=new Set;for(const r of t)r.tiles=r.tiles.filter(s=>!i.has(s.session)&&i.add(s.session));return{columns:t.filter(r=>r.tiles.length>0)}}const gd=.2;function Jy({layout:e,onLayoutChange:t,token:i,sessionsAlive:r,focusSession:s,onFocus:n,onOpenSingle:o}){const[l,h]=O.useState(null),a=O.useRef(null),d=O.useRef([]),c=e.columns.length,f=(v,y)=>l&&l.col===v&&l.row===y,u=v=>l&&l.col===v&&l.row===void 0,m=!!l&&l.col===c;function S(v){v.preventDefault();const y=v.dataTransfer.getData("text/nc-session"),C=l;if(h(null),!y||!C)return;const k=C.row!==void 0?{col:C.col,row:C.row}:{col:C.col};t(zs(e).includes(y)?Yy(e,y,k):cc(e,y,k))}function w(v,y){v.preventDefault(),v.stopPropagation();const C=v.clientX,k=e.columns[y].width,L=a.current&&a.current.clientWidth||1,M=W=>{const U=Math.max(gd,k+(W.clientX-C)/L);t(Xy(e,y,U))},V=()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",V)};window.addEventListener("pointermove",M),window.addEventListener("pointerup",V)}function p(v,y,C){v.preventDefault(),v.stopPropagation();const k=v.clientY,L=e.columns[y].tiles[C].height,M=d.current[y],V=M&&M.clientHeight||1,W=A=>{const E=Math.max(gd,L+(A.clientY-k)/V);t(Gy(e,y,C,E))},U=()=>{window.removeEventListener("pointermove",W),window.removeEventListener("pointerup",U)};window.addEventListener("pointermove",W),window.addEventListener("pointerup",U)}function _(v){t(uc(e,v))}return g.jsxs("div",{className:"nc-grid",ref:a,onDragOver:v=>{v.preventDefault(),l&&l.col===c||h({col:c})},onDrop:S,children:[e.columns.flatMap((v,y)=>{const C=[];return C.push(g.jsx("div",{className:`nc-col${u(y)?" drop-newcol":""}`,ref:k=>{d.current[y]=k},style:{flexGrow:v.width,flexBasis:0},onDragOver:k=>{k.preventDefault(),k.stopPropagation(),l&&l.col===y&&l.row===void 0||h({col:y})},children:v.tiles.flatMap((k,L)=>{const M=[];return M.push(g.jsx("div",{className:`nc-tile-slot${f(y,L)?" drop-split":""}`,style:{flexGrow:k.height,flexBasis:0},onDragOver:V=>{V.preventDefault(),V.stopPropagation(),l&&l.col===y&&l.row===L||h({col:y,row:L})},children:g.jsx(Vy,{session:k.session,token:i,focused:s===k.session,onFocus:n,onClose:_,onOpenSingle:o,alive:!r||r.has(k.session)})},k.session)),L<v.tiles.length-1&&M.push(g.jsx("div",{className:"nc-divider-h",onPointerDown:V=>p(V,y,L)},`h${L}`)),M})},`c${y}`)),y<c-1&&C.push(g.jsx("div",{className:"nc-divider-v",onPointerDown:k=>w(k,y)},`v${y}`)),C}),m&&g.jsx("div",{className:"nc-drop-line-v nc-drop-line-end"}),c===0&&g.jsx("div",{className:"nc-grid-empty",children:"trascina qui una sessione dalla sidebar, o doppio-clic per la vista singola"})]})}const Wp=9,jp=24,Up="nc_grid_v1",Sd="(min-width:1024px) and (pointer:fine)";function Zy(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Wp&&e<=jp?e:13}function e1(){const t=location.hash.replace(/^#/,"").match(/(?:^|&)token=([^&]+)/);if(t){const i=decodeURIComponent(t[1]);try{history.replaceState(null,"",location.pathname+location.search)}catch{}try{localStorage.setItem("nc_token",i)}catch{}return i}return sessionStorage.getItem("nc_token")||localStorage.getItem("nc_token")||""}function t1(){try{return Qy(JSON.parse(localStorage.getItem(Up)||"null"))}catch{return Hp()}}function yd(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function i1(){const[e,t]=O.useState(()=>window.matchMedia(Sd).matches);return O.useEffect(()=>{const i=window.matchMedia(Sd),r=s=>t(s.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),e}function wd({session:e,token:t,onBack:i}){Ni();const[r,s]=O.useState(!1),[n,o]=O.useState(()=>window.matchMedia("(pointer: coarse)").matches),[l,h]=O.useState(null),[a,d]=O.useState(Zy),[c,f]=O.useState(""),u=y=>d(C=>{const k=Math.max(Wp,Math.min(jp,C+y));return localStorage.setItem("nc_fontsize",String(k)),k}),m=O.useRef(()=>{}),S=O.useRef(()=>{}),w=O.useRef(!1),[p,_]=O.useState(!1),v=()=>{w.current=!w.current,_(w.current)};return O.useEffect(()=>{let y=!0;async function C(){let L=null,M=null;try{const U=await(await yt("/api/sessions",t)).json();Array.isArray(U.sessions)&&(L=U.sessions.find(A=>A.name===e))}catch{}try{const W=await Jh(t);W.available&&Array.isArray(W.cells)&&(M=W.cells.find(U=>U.tmuxSession===e))}catch{}if(!y)return;let V="";M?V=`${M.engine}${M.key?`·${M.key}`:""}`:L&&(V=L.attached?`attached · ${yd(L.activity)}`:L.activity?yd(L.activity):""),f(V)}C();const k=setInterval(C,4e3);return()=>{y=!1,clearInterval(k)}},[e,t]),g.jsxs("div",{className:"nc-app",children:[g.jsxs("header",{className:"nc-bar nc-bar-single",children:[g.jsxs("button",{onClick:i,title:F("sessions"),children:[g.jsx(Pt,{name:"chevronLeft",size:18}),g.jsx("span",{className:"nc-bar-label",children:F("sessions")})]}),g.jsxs("span",{className:"nc-bar-center",children:[g.jsx("b",{children:e}),c&&g.jsx("small",{className:"nc-bar-sub",children:c})]}),g.jsxs("span",{className:"nc-bar-right",children:[g.jsx("button",{onClick:()=>u(-1),title:F("zoom-out"),children:g.jsx(Pt,{name:"zoomOut",size:18})}),g.jsx("button",{onClick:()=>u(1),title:F("zoom-in"),children:g.jsx(Pt,{name:"zoomIn",size:18})}),g.jsx("button",{onClick:()=>o(y=>!y),title:F("composer"),children:g.jsx(Pt,{name:"keyboard",size:20})}),g.jsx("button",{onClick:()=>s(y=>!y),title:F("files"),children:g.jsx(Pt,{name:"folder",size:20})})]})]}),g.jsx("div",{className:"nc-termwrap",children:g.jsx(zp,{session:e,token:t,readonly:!1,sendRef:m,actionRef:S,ctrlRef:w,setCtrlArmed:_,onFiles:h,fontSize:a})}),g.jsx(Fy,{send:y=>m.current(y),action:y=>S.current(y),ctrlArmed:p,onCtrl:v}),n&&g.jsx(Fp,{send:y=>m.current(y),token:t}),r&&g.jsx($p,{session:e,token:t,filesEvent:l,onClose:()=>s(!1)})]})}function r1(){Ni();const[e,t]=O.useState(e1()),[i,r]=O.useState(!1),s=i1(),[n,o]=O.useState(null),[l,h]=O.useState([]),[a,d]=O.useState([]),[c,f]=O.useState(t1),[u,m]=O.useState(null),[S,w]=O.useState(null),[p,_]=O.useState(null),[v,y]=O.useState(!1),[C,k]=O.useState(["shell","claude","codex-vl","pi"]);O.useEffect(()=>{try{localStorage.setItem(Up,JSON.stringify(c))}catch{}},[c]);const L=O.useCallback(async()=>{try{const b=await(await yt("/api/sessions",e)).json();b.error||h(b.sessions||[])}catch{}try{const P=await Jh(e);d(P.available?P.cells||[]:[])}catch{d([])}},[e]);O.useEffect(()=>{if(!s)return;L();const P=setInterval(L,4e3);return()=>clearInterval(P)},[s,L]),O.useEffect(()=>{if(!s)return;let P=!1;return yt("/api/config",e).then(b=>b.json()).then(b=>{!P&&Array.isArray(b.presets)&&b.presets.length&&k(b.presets)}).catch(()=>{}),()=>{P=!0}},[s,e]);const M=new Set(l.map(P=>P.name)),V=zs(c),W=P=>f(b=>cc(b,P,"end")),U=async P=>{try{await W_(e,P)}catch{return}f(b=>uc(b,P)),L()},A=async P=>{if(!p)return;const{cell:b}=p;P.action==="up"?await $_(e,{cell:b,engine:P.engine,boot:!!P.boot}):await F_(e,{cell:b,boot:!!P.boot}),L()},E=async P=>{await H_(e,P),L()};return e?s?g.jsxs("div",{className:"nc-workspace",children:[g.jsx(Ky,{sessions:l,cells:a,activeSessions:V,onPick:w,onAddTile:W,onPower:_,onKill:U,onNew:()=>y(!0)}),g.jsx("div",{className:"nc-workspace-main",children:g.jsx(Jy,{layout:c,onLayoutChange:f,token:e,sessionsAlive:M,focusSession:u,onFocus:m,onOpenSingle:w})}),S&&g.jsx("div",{className:"nc-single-overlay",children:g.jsx(wd,{session:S,token:e,onBack:()=>w(null)})}),p&&g.jsx(V_,{cell:p,onConfirm:A,onClose:()=>_(null)}),v&&g.jsx(q_,{presets:C,onCreate:E,onClose:()=>y(!1)})]}):n?g.jsx(wd,{session:n,token:e,onBack:()=>o(null)}):g.jsx(bg,{onPick:o,token:e}):g.jsxs("div",{className:"nc-auth",children:[g.jsx("p",{children:F("auth-prompt")}),g.jsx("input",{onChange:P=>t(P.target.value.trim()),placeholder:"token"}),g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",checked:i,onChange:P=>r(P.target.checked)})," ",F("remember-device")]}),g.jsx("button",{onClick:()=>{(i?localStorage:sessionStorage).setItem("nc_token",e)},children:"ok"})]})}El.createRoot(document.getElementById("root")).render(g.jsx(lm.StrictMode,{children:g.jsx(r1,{})}));