paneful 0.9.13 → 0.9.15

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,87 @@
1
+ var e,t,i,r,s,n,o,a,l;function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const i of e)if("childList"===i.type)for(const e of i.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var c={exports:{}},u={},d={exports:{}},f={},_=Symbol.for("react.element"),p=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),b=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),k=Symbol.iterator;var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,M={};function R(e,t,i){this.props=e,this.context=t,this.refs=M,this.updater=i||L}function T(){}function P(e,t,i){this.props=e,this.context=t,this.refs=M,this.updater=i||L}R.prototype.isReactComponent={},R.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)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")},R.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},T.prototype=R.prototype;var D=P.prototype=new T;D.constructor=P,E(D,R.prototype),D.isPureReactComponent=!0;var B=Array.isArray,A=Object.prototype.hasOwnProperty,N={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function O(e,t,i){var r,s={},n=null,o=null;if(null!=t)for(r in void 0!==t.ref&&(o=t.ref),void 0!==t.key&&(n=""+t.key),t)A.call(t,r)&&!I.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(1===a)s.children=i;else if(1<a){for(var l=Array(a),h=0;h<a;h++)l[h]=arguments[h+2];s.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===s[r]&&(s[r]=a[r]);return{$$typeof:_,type:e,key:n,ref:o,props:s,_owner:N.current}}function z(e){return"object"==typeof e&&null!==e&&e.$$typeof===_}var F=/\/+/g;function j(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function W(e,t,i,r,s){var n=typeof e;"undefined"!==n&&"boolean"!==n||(e=null);var o=!1;if(null===e)o=!0;else switch(n){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case _:case p:o=!0}}if(o)return s=s(o=e),e=""===r?"."+j(o,0):r,B(s)?(i="",null!=e&&(i=e.replace(F,"$&/")+"/"),W(s,t,i,"",function(e){return e})):null!=s&&(z(s)&&(s=function(e,t){return{$$typeof:_,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,i+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(F,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=""===r?".":r+":",B(e))for(var a=0;a<e.length;a++){var l=r+j(n=e[a],a);o+=W(n,t,i,l,s)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=k&&e[k]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),a=0;!(n=e.next()).done;)o+=W(n=n.value,t,i,l=r+j(n,a++),s);else if("object"===n)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function H(e,t,i){if(null==e)return e;var r=[],s=0;return W(e,r,"","",function(e){return t.call(i,e,s++)}),r}function $(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var U={current:null},K={transition:null},q={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:K,ReactCurrentOwner:N};function V(){throw Error("act(...) is not supported in production builds of React.")}f.Children={map:H,forEach:function(e,t,i){H(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return H(e,function(){t++}),t},toArray:function(e){return H(e,function(e){return e})||[]},only:function(e){if(!z(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},f.Component=R,f.Fragment=g,f.Profiler=m,f.PureComponent=P,f.StrictMode=v,f.Suspense=w,f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q,f.act=V,f.cloneElement=function(e,t,i){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=E({},e.props),s=e.key,n=e.ref,o=e._owner;if(null!=t){if(void 0!==t.ref&&(n=t.ref,o=N.current),void 0!==t.key&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)A.call(t,l)&&!I.hasOwnProperty(l)&&(r[l]=void 0===t[l]&&void 0!==a?a[l]:t[l])}var l=arguments.length-2;if(1===l)r.children=i;else if(1<l){a=Array(l);for(var h=0;h<l;h++)a[h]=arguments[h+2];r.children=a}return{$$typeof:_,type:e.type,key:s,ref:n,props:r,_owner:o}},f.createContext=function(e){return(e={$$typeof:b,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:y,_context:e},e.Consumer=e},f.createElement=O,f.createFactory=function(e){var t=O.bind(null,e);return t.type=e,t},f.createRef=function(){return{current:null}},f.forwardRef=function(e){return{$$typeof:S,render:e}},f.isValidElement=z,f.lazy=function(e){return{$$typeof:C,_payload:{_status:-1,_result:e},_init:$}},f.memo=function(e,t){return{$$typeof:x,type:e,compare:void 0===t?null:t}},f.startTransition=function(e){var t=K.transition;K.transition={};try{e()}finally{K.transition=t}},f.unstable_act=V,f.useCallback=function(e,t){return U.current.useCallback(e,t)},f.useContext=function(e){return U.current.useContext(e)},f.useDebugValue=function(){},f.useDeferredValue=function(e){return U.current.useDeferredValue(e)},f.useEffect=function(e,t){return U.current.useEffect(e,t)},f.useId=function(){return U.current.useId()},f.useImperativeHandle=function(e,t,i){return U.current.useImperativeHandle(e,t,i)},f.useInsertionEffect=function(e,t){return U.current.useInsertionEffect(e,t)},f.useLayoutEffect=function(e,t){return U.current.useLayoutEffect(e,t)},f.useMemo=function(e,t){return U.current.useMemo(e,t)},f.useReducer=function(e,t,i){return U.current.useReducer(e,t,i)},f.useRef=function(e){return U.current.useRef(e)},f.useState=function(e){return U.current.useState(e)},f.useSyncExternalStore=function(e,t,i){return U.current.useSyncExternalStore(e,t,i)},f.useTransition=function(){return U.current.useTransition()},f.version="18.3.1",d.exports=f;var Y=d.exports;const G=h(Y);
2
+ /**
3
+ * @license React
4
+ * react-jsx-runtime.production.min.js
5
+ *
6
+ * Copyright (c) Facebook, Inc. and its affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var X=Y,Q=Symbol.for("react.element"),J=Symbol.for("react.fragment"),Z=Object.prototype.hasOwnProperty,ee=X.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,te={key:!0,ref:!0,__self:!0,__source:!0};function ie(e,t,i){var r,s={},n=null,o=null;for(r in void 0!==i&&(n=""+i),void 0!==t.key&&(n=""+t.key),void 0!==t.ref&&(o=t.ref),t)Z.call(t,r)&&!te.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===s[r]&&(s[r]=t[r]);return{$$typeof:Q,type:e,key:n,ref:o,props:s,_owner:ee.current}}u.Fragment=J,u.jsx=ie,u.jsxs=ie,c.exports=u;var re=c.exports,se={},ne={exports:{}},oe={},ae={exports:{}},le={};
11
+ /**
12
+ * @license React
13
+ * scheduler.production.min.js
14
+ *
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+ !function(e){function t(e,t){var i=e.length;e.push(t);e:for(;0<i;){var r=i-1>>>1,n=e[r];if(!(0<s(n,t)))break e;e[r]=t,e[i]=n,i=r}}function i(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],i=e.pop();if(i!==t){e[0]=i;e:for(var r=0,n=e.length,o=n>>>1;r<o;){var a=2*(r+1)-1,l=e[a],h=a+1,c=e[h];if(0>s(l,i))h<n&&0>s(c,l)?(e[r]=c,e[h]=i,r=h):(e[r]=l,e[a]=i,r=a);else{if(!(h<n&&0>s(c,i)))break e;e[r]=c,e[h]=i,r=h}}}return t}function s(e,t){var i=e.sortIndex-t.sortIndex;return 0!==i?i:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var n=performance;e.unstable_now=function(){return n.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],h=[],c=1,u=null,d=3,f=!1,_=!1,p=!1,g="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,m="undefined"!=typeof setImmediate?setImmediate:null;function y(e){for(var s=i(h);null!==s;){if(null===s.callback)r(h);else{if(!(s.startTime<=e))break;r(h),s.sortIndex=s.expirationTime,t(l,s)}s=i(h)}}function b(e){if(p=!1,y(e),!_)if(null!==i(l))_=!0,D(S);else{var t=i(h);null!==t&&B(b,t.startTime-e)}}function S(t,s){_=!1,p&&(p=!1,v(k),k=-1),f=!0;var n=d;try{for(y(s),u=i(l);null!==u&&(!(u.expirationTime>s)||t&&!M());){var o=u.callback;if("function"==typeof o){u.callback=null,d=u.priorityLevel;var a=o(u.expirationTime<=s);s=e.unstable_now(),"function"==typeof a?u.callback=a:u===i(l)&&r(l),y(s)}else r(l);u=i(l)}if(null!==u)var c=!0;else{var g=i(h);null!==g&&B(b,g.startTime-s),c=!1}return c}finally{u=null,d=n,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,x=!1,C=null,k=-1,L=5,E=-1;function M(){return!(e.unstable_now()-E<L)}function R(){if(null!==C){var t=e.unstable_now();E=t;var i=!0;try{i=C(!0,t)}finally{i?w():(x=!1,C=null)}}else x=!1}if("function"==typeof m)w=function(){m(R)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,P=T.port2;T.port1.onmessage=R,w=function(){P.postMessage(null)}}else w=function(){g(R,0)};function D(e){C=e,x||(x=!0,w())}function B(t,i){k=g(function(){t(e.unstable_now())},i)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){_||f||(_=!0,D(S))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return i(l)},e.unstable_next=function(e){switch(d){case 1:case 2:case 3:var t=3;break;default:t=d}var i=d;d=t;try{return e()}finally{d=i}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var i=d;d=e;try{return t()}finally{d=i}},e.unstable_scheduleCallback=function(r,s,n){var o=e.unstable_now();switch("object"==typeof n&&null!==n?n="number"==typeof(n=n.delay)&&0<n?o+n:o:n=o,r){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return r={id:c++,callback:s,priorityLevel:r,startTime:n,expirationTime:a=n+a,sortIndex:-1},n>o?(r.sortIndex=n,t(h,r),null===i(l)&&r===i(h)&&(p?(v(k),k=-1):p=!0,B(b,n-o))):(r.sortIndex=a,t(l,r),_||f||(_=!0,D(S))),r},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(e){var t=d;return function(){var i=d;d=t;try{return e.apply(this,arguments)}finally{d=i}}}}(le),ae.exports=le;var he=ae.exports,ce=Y,ue=he;
21
+ /**
22
+ * @license React
23
+ * react-dom.production.min.js
24
+ *
25
+ * Copyright (c) Facebook, Inc. and its affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */function de(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 fe=new Set,_e={};function pe(e,t){ge(e,t),ge(e+"Capture",t)}function ge(e,t){for(_e[e]=t,e=0;e<t.length;e++)fe.add(t[e])}var ve=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),me=Object.prototype.hasOwnProperty,ye=/^[: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]*$/,be={},Se={};function we(e,t,i,r,s,n,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var xe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xe[e]=new we(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xe[t]=new we(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){xe[e]=new we(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xe[e]=new we(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){xe[e]=new we(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){xe[e]=new we(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){xe[e]=new we(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){xe[e]=new we(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){xe[e]=new we(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ce=/[\-:]([a-z])/g;function ke(e){return e[1].toUpperCase()}function Le(e,t,i,r){var s=xe.hasOwnProperty(t)?xe[t]:null;(null!==s?0!==s.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,i,r){if(null==t||function(e,t,i,r){if(null!==i&&0===i.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==i?!i.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,i,r))return!0;if(r)return!1;if(null!==i)switch(i.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,i,s,r)&&(i=null),r||null===s?function(e){return!!me.call(Se,e)||!me.call(be,e)&&(ye.test(e)?Se[e]=!0:(be[e]=!0,!1))}(t)&&(null===i?e.removeAttribute(t):e.setAttribute(t,""+i)):s.mustUseProperty?e[s.propertyName]=null===i?3!==s.type&&"":i:(t=s.attributeName,r=s.attributeNamespace,null===i?e.removeAttribute(t):(i=3===(s=s.type)||4===s&&!0===i?"":""+i,r?e.setAttributeNS(r,t,i):e.setAttribute(t,i))))}"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(Ce,ke);xe[t]=new we(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(Ce,ke);xe[t]=new we(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(Ce,ke);xe[t]=new we(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){xe[e]=new we(e,1,!1,e.toLowerCase(),null,!1,!1)}),xe.xlinkHref=new we("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){xe[e]=new we(e,1,!1,e.toLowerCase(),null,!0,!0)});var Ee=ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Me=Symbol.for("react.element"),Re=Symbol.for("react.portal"),Te=Symbol.for("react.fragment"),Pe=Symbol.for("react.strict_mode"),De=Symbol.for("react.profiler"),Be=Symbol.for("react.provider"),Ae=Symbol.for("react.context"),Ne=Symbol.for("react.forward_ref"),Ie=Symbol.for("react.suspense"),Oe=Symbol.for("react.suspense_list"),ze=Symbol.for("react.memo"),Fe=Symbol.for("react.lazy"),je=Symbol.for("react.offscreen"),We=Symbol.iterator;function He(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=We&&e[We]||e["@@iterator"])?e:null}var $e,Ue=Object.assign;function Ke(e){if(void 0===$e)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);$e=t&&t[1]||""}return"\n"+$e+e}var qe=!1;function Ve(e,t){if(!e||qe)return"";qe=!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()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(_f){var r=_f}Reflect.construct(e,[],t)}else{try{t.call()}catch(_f){r=_f}e.call(t.prototype)}else{try{throw Error()}catch(_f){r=_f}e()}}catch(_f){if(_f&&r&&"string"==typeof _f.stack){for(var s=_f.stack.split("\n"),n=r.stack.split("\n"),o=s.length-1,a=n.length-1;1<=o&&0<=a&&s[o]!==n[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==n[a]){if(1!==o||1!==a)do{if(o--,0>--a||s[o]!==n[a]){var l="\n"+s[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=o&&0<=a);break}}}finally{qe=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?Ke(e):""}function Ye(e){switch(e.tag){case 5:return Ke(e.type);case 16:return Ke("Lazy");case 13:return Ke("Suspense");case 19:return Ke("SuspenseList");case 0:case 2:case 15:return e=Ve(e.type,!1);case 11:return e=Ve(e.type.render,!1);case 1:return e=Ve(e.type,!0);default:return""}}function Ge(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case Te:return"Fragment";case Re:return"Portal";case De:return"Profiler";case Pe:return"StrictMode";case Ie:return"Suspense";case Oe:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case Ae:return(e.displayName||"Context")+".Consumer";case Be:return(e._context.displayName||"Context")+".Provider";case Ne:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ze:return null!==(t=e.displayName||null)?t:Ge(e.type)||"Memo";case Fe:t=e._payload,e=e._init;try{return Ge(e(t))}catch(i){}}return null}function Xe(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=(e=t.render).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 Ge(t);case 8:return t===Pe?"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("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function Qe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function Je(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Ze(e){e._valueTracker||(e._valueTracker=function(e){var t=Je(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==i&&"function"==typeof i.get&&"function"==typeof i.set){var s=i.get,n=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(e){r=""+e,n.call(this,e)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function et(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),r="";return e&&(r=Je(e)?e.checked?"true":"false":e.value),(e=r)!==i&&(t.setValue(e),!0)}function tt(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function it(e,t){var i=t.checked;return Ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=i?i:e._wrapperState.initialChecked})}function rt(e,t){var i=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;i=Qe(null!=t.value?t.value:i),e._wrapperState={initialChecked:r,initialValue:i,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function st(e,t){null!=(t=t.checked)&&Le(e,"checked",t,!1)}function nt(e,t){st(e,t);var i=Qe(t.value),r=t.type;if(null!=i)"number"===r?(0===i&&""===e.value||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?at(e,t.type,i):t.hasOwnProperty("defaultValue")&&at(e,t.type,Qe(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function ot(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}""!==(i=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==i&&(e.name=i)}function at(e,t,i){"number"===t&&tt(e.ownerDocument)===e||(null==i?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var lt=Array.isArray;function ht(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=""+Qe(i),t=null,s=0;s<e.length;s++){if(e[s].value===i)return e[s].selected=!0,void(r&&(e[s].defaultSelected=!0));null!==t||e[s].disabled||(t=e[s])}null!==t&&(t.selected=!0)}}function ct(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(de(91));return Ue({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ut(e,t){var i=t.value;if(null==i){if(i=t.children,t=t.defaultValue,null!=i){if(null!=t)throw Error(de(92));if(lt(i)){if(1<i.length)throw Error(de(93));i=i[0]}t=i}null==t&&(t=""),i=t}e._wrapperState={initialValue:Qe(i)}}function dt(e,t){var i=Qe(t.value),r=Qe(t.defaultValue);null!=i&&((i=""+i)!==e.value&&(e.value=i),null==t.defaultValue&&e.defaultValue!==i&&(e.defaultValue=i)),null!=r&&(e.defaultValue=""+r)}function ft(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function _t(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 pt(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?_t(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var gt,vt,mt=(vt=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((gt=gt||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=gt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return vt(e,t)})}:vt);function yt(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&3===i.nodeType)return void(i.nodeValue=t)}e.textContent=t}var bt={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},St=["Webkit","ms","Moz","O"];function wt(e,t,i){return null==t||"boolean"==typeof t||""===t?"":i||"number"!=typeof t||0===t||bt.hasOwnProperty(e)&&bt[e]?(""+t).trim():t+"px"}function xt(e,t){for(var i in e=e.style,t)if(t.hasOwnProperty(i)){var r=0===i.indexOf("--"),s=wt(i,t[i],r);"float"===i&&(i="cssFloat"),r?e.setProperty(i,s):e[i]=s}}Object.keys(bt).forEach(function(e){St.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),bt[t]=bt[e]})});var Ct=Ue({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 kt(e,t){if(t){if(Ct[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(de(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(de(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(de(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(de(62))}}function Lt(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;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 Et=null;function Mt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Rt=null,Tt=null,Pt=null;function Dt(e){if(e=Ln(e)){if("function"!=typeof Rt)throw Error(de(280));var t=e.stateNode;t&&(t=Mn(t),Rt(e.stateNode,e.type,t))}}function Bt(e){Tt?Pt?Pt.push(e):Pt=[e]:Tt=e}function At(){if(Tt){var e=Tt,t=Pt;if(Pt=Tt=null,Dt(e),t)for(e=0;e<t.length;e++)Dt(t[e])}}function Nt(e,t){return e(t)}function It(){}var Ot=!1;function zt(e,t,i){if(Ot)return e(t,i);Ot=!0;try{return Nt(e,t,i)}finally{Ot=!1,(null!==Tt||null!==Pt)&&(It(),At())}}function Ft(e,t){var i=e.stateNode;if(null===i)return null;var r=Mn(i);if(null===r)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)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(i&&"function"!=typeof i)throw Error(de(231,t,typeof i));return i}var jt=!1;if(ve)try{var Wt={};Object.defineProperty(Wt,"passive",{get:function(){jt=!0}}),window.addEventListener("test",Wt,Wt),window.removeEventListener("test",Wt,Wt)}catch(vt){jt=!1}function Ht(e,t,i,r,s,n,o,a,l){var h=Array.prototype.slice.call(arguments,3);try{t.apply(i,h)}catch(c){this.onError(c)}}var $t=!1,Ut=null,Kt=!1,qt=null,Vt={onError:function(e){$t=!0,Ut=e}};function Yt(e,t,i,r,s,n,o,a,l){$t=!1,Ut=null,Ht.apply(Vt,arguments)}function Gt(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(i=t.return),e=t.return}while(e)}return 3===t.tag?i:null}function Xt(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Qt(e){if(Gt(e)!==e)throw Error(de(188))}function Jt(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Gt(e)))throw Error(de(188));return t!==e?null:e}for(var i=e,r=t;;){var s=i.return;if(null===s)break;var n=s.alternate;if(null===n){if(null!==(r=s.return)){i=r;continue}break}if(s.child===n.child){for(n=s.child;n;){if(n===i)return Qt(s),e;if(n===r)return Qt(s),t;n=n.sibling}throw Error(de(188))}if(i.return!==r.return)i=s,r=n;else{for(var o=!1,a=s.child;a;){if(a===i){o=!0,i=s,r=n;break}if(a===r){o=!0,r=s,i=n;break}a=a.sibling}if(!o){for(a=n.child;a;){if(a===i){o=!0,i=n,r=s;break}if(a===r){o=!0,r=n,i=s;break}a=a.sibling}if(!o)throw Error(de(189))}}if(i.alternate!==r)throw Error(de(190))}if(3!==i.tag)throw Error(de(188));return i.stateNode.current===i?e:t}(e))?Zt(e):null}function Zt(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Zt(e);if(null!==t)return t;e=e.sibling}return null}var ei=ue.unstable_scheduleCallback,ti=ue.unstable_cancelCallback,ii=ue.unstable_shouldYield,ri=ue.unstable_requestPaint,si=ue.unstable_now,ni=ue.unstable_getCurrentPriorityLevel,oi=ue.unstable_ImmediatePriority,ai=ue.unstable_UserBlockingPriority,li=ue.unstable_NormalPriority,hi=ue.unstable_LowPriority,ci=ue.unstable_IdlePriority,ui=null,di=null;var fi=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(_i(e)/pi|0)|0},_i=Math.log,pi=Math.LN2;var gi=64,vi=4194304;function mi(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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function yi(e,t){var i=e.pendingLanes;if(0===i)return 0;var r=0,s=e.suspendedLanes,n=e.pingedLanes,o=268435455&i;if(0!==o){var a=o&~s;0!==a?r=mi(a):0!==(n&=o)&&(r=mi(n))}else 0!==(o=i&~s)?r=mi(o):0!==n&&(r=mi(n));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&s)&&((s=r&-r)>=(n=t&-t)||16===s&&4194240&n))return t;if(4&r&&(r|=16&i),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)s=1<<(i=31-fi(t)),r|=e[i],t&=~s;return r}function bi(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;default:return-1}}function Si(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function wi(){var e=gi;return!(4194240&(gi<<=1))&&(gi=64),e}function xi(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Ci(e,t,i){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-fi(t)]=i}function ki(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var r=31-fi(i),s=1<<r;s&t|e[r]&t&&(e[r]|=t),i&=~s}}var Li=0;function Ei(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var Mi,Ri,Ti,Pi,Di,Bi=!1,Ai=[],Ni=null,Ii=null,Oi=null,zi=new Map,Fi=new Map,ji=[],Wi="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 Hi(e,t){switch(e){case"focusin":case"focusout":Ni=null;break;case"dragenter":case"dragleave":Ii=null;break;case"mouseover":case"mouseout":Oi=null;break;case"pointerover":case"pointerout":zi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fi.delete(t.pointerId)}}function $i(e,t,i,r,s,n){return null===e||e.nativeEvent!==n?(e={blockedOn:t,domEventName:i,eventSystemFlags:r,nativeEvent:n,targetContainers:[s]},null!==t&&(null!==(t=Ln(t))&&Ri(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==s&&-1===t.indexOf(s)&&t.push(s),e)}function Ui(e){var t=kn(e.target);if(null!==t){var i=Gt(t);if(null!==i)if(13===(t=i.tag)){if(null!==(t=Xt(i)))return e.blockedOn=t,void Di(e.priority,function(){Ti(i)})}else if(3===t&&i.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===i.tag?i.stateNode.containerInfo:null)}e.blockedOn=null}function Ki(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var i=ir(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==i)return null!==(t=Ln(i))&&Ri(t),e.blockedOn=i,!1;var r=new(i=e.nativeEvent).constructor(i.type,i);Et=r,i.target.dispatchEvent(r),Et=null,t.shift()}return!0}function qi(e,t,i){Ki(e)&&i.delete(t)}function Vi(){Bi=!1,null!==Ni&&Ki(Ni)&&(Ni=null),null!==Ii&&Ki(Ii)&&(Ii=null),null!==Oi&&Ki(Oi)&&(Oi=null),zi.forEach(qi),Fi.forEach(qi)}function Yi(e,t){e.blockedOn===t&&(e.blockedOn=null,Bi||(Bi=!0,ue.unstable_scheduleCallback(ue.unstable_NormalPriority,Vi)))}function Gi(e){function t(t){return Yi(t,e)}if(0<Ai.length){Yi(Ai[0],e);for(var i=1;i<Ai.length;i++){var r=Ai[i];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==Ni&&Yi(Ni,e),null!==Ii&&Yi(Ii,e),null!==Oi&&Yi(Oi,e),zi.forEach(t),Fi.forEach(t),i=0;i<ji.length;i++)(r=ji[i]).blockedOn===e&&(r.blockedOn=null);for(;0<ji.length&&null===(i=ji[0]).blockedOn;)Ui(i),null===i.blockedOn&&ji.shift()}var Xi=Ee.ReactCurrentBatchConfig,Qi=!0;function Ji(e,t,i,r){var s=Li,n=Xi.transition;Xi.transition=null;try{Li=1,er(e,t,i,r)}finally{Li=s,Xi.transition=n}}function Zi(e,t,i,r){var s=Li,n=Xi.transition;Xi.transition=null;try{Li=4,er(e,t,i,r)}finally{Li=s,Xi.transition=n}}function er(e,t,i,r){if(Qi){var s=ir(e,t,i,r);if(null===s)Xs(e,t,r,tr,i),Hi(e,r);else if(function(e,t,i,r,s){switch(t){case"focusin":return Ni=$i(Ni,e,t,i,r,s),!0;case"dragenter":return Ii=$i(Ii,e,t,i,r,s),!0;case"mouseover":return Oi=$i(Oi,e,t,i,r,s),!0;case"pointerover":var n=s.pointerId;return zi.set(n,$i(zi.get(n)||null,e,t,i,r,s)),!0;case"gotpointercapture":return n=s.pointerId,Fi.set(n,$i(Fi.get(n)||null,e,t,i,r,s)),!0}return!1}(s,e,t,i,r))r.stopPropagation();else if(Hi(e,r),4&t&&-1<Wi.indexOf(e)){for(;null!==s;){var n=Ln(s);if(null!==n&&Mi(n),null===(n=ir(e,t,i,r))&&Xs(e,t,r,tr,i),n===s)break;s=n}null!==s&&r.stopPropagation()}else Xs(e,t,r,null,i)}}var tr=null;function ir(e,t,i,r){if(tr=null,null!==(e=kn(e=Mt(r))))if(null===(t=Gt(e)))e=null;else if(13===(i=t.tag)){if(null!==(e=Xt(t)))return e;e=null}else if(3===i){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return tr=e,null}function rr(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(ni()){case oi:return 1;case ai:return 4;case li:case hi:return 16;case ci:return 536870912;default:return 16}default:return 16}}var sr=null,nr=null,or=null;function ar(){if(or)return or;var e,t,i=nr,r=i.length,s="value"in sr?sr.value:sr.textContent,n=s.length;for(e=0;e<r&&i[e]===s[e];e++);var o=r-e;for(t=1;t<=o&&i[r-t]===s[n-t];t++);return or=s.slice(e,1<t?1-t:void 0)}function lr(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function hr(){return!0}function cr(){return!1}function ur(e){function t(t,i,r,s,n){for(var o in this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=n,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(s):s[o]);return this.isDefaultPrevented=(null!=s.defaultPrevented?s.defaultPrevented:!1===s.returnValue)?hr:cr,this.isPropagationStopped=cr,this}return Ue(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=hr)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=hr)},persist:function(){},isPersistent:hr}),t}var dr,fr,_r,pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gr=ur(pr),vr=Ue({},pr,{view:0,detail:0}),mr=ur(vr),yr=Ue({},vr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pr,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==_r&&(_r&&"mousemove"===e.type?(dr=e.screenX-_r.screenX,fr=e.screenY-_r.screenY):fr=dr=0,_r=e),dr)},movementY:function(e){return"movementY"in e?e.movementY:fr}}),br=ur(yr),Sr=ur(Ue({},yr,{dataTransfer:0})),wr=ur(Ue({},vr,{relatedTarget:0})),xr=ur(Ue({},pr,{animationName:0,elapsedTime:0,pseudoElement:0})),Cr=Ue({},pr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kr=ur(Cr),Lr=ur(Ue({},pr,{data:0})),Er={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Mr={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"},Rr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Tr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Rr[e])&&!!t[e]}function Pr(){return Tr}var Dr=Ue({},vr,{key:function(e){if(e.key){var t=Er[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=lr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Mr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pr,charCode:function(e){return"keypress"===e.type?lr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?lr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Br=ur(Dr),Ar=ur(Ue({},yr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Nr=ur(Ue({},vr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pr})),Ir=ur(Ue({},pr,{propertyName:0,elapsedTime:0,pseudoElement:0})),Or=Ue({},yr,{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}),zr=ur(Or),Fr=[9,13,27,32],jr=ve&&"CompositionEvent"in window,Wr=null;ve&&"documentMode"in document&&(Wr=document.documentMode);var Hr=ve&&"TextEvent"in window&&!Wr,$r=ve&&(!jr||Wr&&8<Wr&&11>=Wr),Ur=String.fromCharCode(32),Kr=!1;function qr(e,t){switch(e){case"keyup":return-1!==Fr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vr(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Yr=!1;var Gr={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 Xr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Gr[e.type]:"textarea"===t}function Qr(e,t,i,r){Bt(r),0<(t=Js(t,"onChange")).length&&(i=new gr("onChange","change",null,i,r),e.push({event:i,listeners:t}))}var Jr=null,Zr=null;function es(e){Us(e,0)}function ts(e){if(et(En(e)))return e}function is(e,t){if("change"===e)return t}var rs=!1;if(ve){var ss;if(ve){var ns="oninput"in document;if(!ns){var os=document.createElement("div");os.setAttribute("oninput","return;"),ns="function"==typeof os.oninput}ss=ns}else ss=!1;rs=ss&&(!document.documentMode||9<document.documentMode)}function as(){Jr&&(Jr.detachEvent("onpropertychange",ls),Zr=Jr=null)}function ls(e){if("value"===e.propertyName&&ts(Zr)){var t=[];Qr(t,Zr,e,Mt(e)),zt(es,t)}}function hs(e,t,i){"focusin"===e?(as(),Zr=i,(Jr=t).attachEvent("onpropertychange",ls)):"focusout"===e&&as()}function cs(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return ts(Zr)}function us(e,t){if("click"===e)return ts(t)}function ds(e,t){if("input"===e||"change"===e)return ts(t)}var fs="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function _s(e,t){if(fs(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)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(!me.call(t,s)||!fs(e[s],t[s]))return!1}return!0}function ps(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function gs(e,t){var i,r=ps(e);for(e=0;r;){if(3===r.nodeType){if(i=e+r.textContent.length,e<=t&&i>=t)return{node:r,offset:t-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ps(r)}}function vs(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?vs(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function ms(){for(var e=window,t=tt();t instanceof e.HTMLIFrameElement;){try{var i="string"==typeof t.contentWindow.location.href}catch(r){i=!1}if(!i)break;t=tt((e=t.contentWindow).document)}return t}function ys(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function bs(e){var t=ms(),i=e.focusedElem,r=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&vs(i.ownerDocument.documentElement,i)){if(null!==r&&ys(i))if(t=r.start,void 0===(e=r.end)&&(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).getSelection){e=e.getSelection();var s=i.textContent.length,n=Math.min(r.start,s);r=void 0===r.end?n:Math.min(r.end,s),!e.extend&&n>r&&(s=r,r=n,n=s),s=gs(i,n);var o=gs(i,r);s&&o&&(1!==e.rangeCount||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).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;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof i.focus&&i.focus(),i=0;i<t.length;i++)(e=t[i]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ss=ve&&"documentMode"in document&&11>=document.documentMode,ws=null,xs=null,Cs=null,ks=!1;function Ls(e,t,i){var r=i.window===i?i.document:9===i.nodeType?i:i.ownerDocument;ks||null==ws||ws!==tt(r)||("selectionStart"in(r=ws)&&ys(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},Cs&&_s(Cs,r)||(Cs=r,0<(r=Js(xs,"onSelect")).length&&(t=new gr("onSelect","select",null,t,i),e.push({event:t,listeners:r}),t.target=ws)))}function Es(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Ms={animationend:Es("Animation","AnimationEnd"),animationiteration:Es("Animation","AnimationIteration"),animationstart:Es("Animation","AnimationStart"),transitionend:Es("Transition","TransitionEnd")},Rs={},Ts={};function Ps(e){if(Rs[e])return Rs[e];if(!Ms[e])return e;var t,i=Ms[e];for(t in i)if(i.hasOwnProperty(t)&&t in Ts)return Rs[e]=i[t];return e}ve&&(Ts=document.createElement("div").style,"AnimationEvent"in window||(delete Ms.animationend.animation,delete Ms.animationiteration.animation,delete Ms.animationstart.animation),"TransitionEvent"in window||delete Ms.transitionend.transition);var Ds=Ps("animationend"),Bs=Ps("animationiteration"),As=Ps("animationstart"),Ns=Ps("transitionend"),Is=new Map,Os="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 zs(e,t){Is.set(e,t),pe(t,[e])}for(var Fs=0;Fs<Os.length;Fs++){var js=Os[Fs];zs(js.toLowerCase(),"on"+(js[0].toUpperCase()+js.slice(1)))}zs(Ds,"onAnimationEnd"),zs(Bs,"onAnimationIteration"),zs(As,"onAnimationStart"),zs("dblclick","onDoubleClick"),zs("focusin","onFocus"),zs("focusout","onBlur"),zs(Ns,"onTransitionEnd"),ge("onMouseEnter",["mouseout","mouseover"]),ge("onMouseLeave",["mouseout","mouseover"]),ge("onPointerEnter",["pointerout","pointerover"]),ge("onPointerLeave",["pointerout","pointerover"]),pe("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pe("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),pe("onBeforeInput",["compositionend","keypress","textInput","paste"]),pe("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pe("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pe("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ws="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(" "),Hs=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ws));function $s(e,t,i){var r=e.type||"unknown-event";e.currentTarget=i,function(e,t,i,r,s,n,o,a,l){if(Yt.apply(this,arguments),$t){if(!$t)throw Error(de(198));var h=Ut;$t=!1,Ut=null,Kt||(Kt=!0,qt=h)}}(r,t,void 0,e),e.currentTarget=null}function Us(e,t){t=!!(4&t);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 a=r[o],l=a.instance,h=a.currentTarget;if(a=a.listener,l!==n&&s.isPropagationStopped())break e;$s(s,a,h),n=l}else for(o=0;o<r.length;o++){if(l=(a=r[o]).instance,h=a.currentTarget,a=a.listener,l!==n&&s.isPropagationStopped())break e;$s(s,a,h),n=l}}}if(Kt)throw e=qt,Kt=!1,qt=null,e}function Ks(e,t){var i=t[wn];void 0===i&&(i=t[wn]=new Set);var r=e+"__bubble";i.has(r)||(Gs(t,e,2,!1),i.add(r))}function qs(e,t,i){var r=0;t&&(r|=4),Gs(i,e,r,t)}var Vs="_reactListening"+Math.random().toString(36).slice(2);function Ys(e){if(!e[Vs]){e[Vs]=!0,fe.forEach(function(t){"selectionchange"!==t&&(Hs.has(t)||qs(t,!1,e),qs(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Vs]||(t[Vs]=!0,qs("selectionchange",!1,t))}}function Gs(e,t,i,r){switch(rr(t)){case 1:var s=Ji;break;case 4:s=Zi;break;default:s=er}i=s.bind(null,t,i,e),s=void 0,!jt||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(s=!0),r?void 0!==s?e.addEventListener(t,i,{capture:!0,passive:s}):e.addEventListener(t,i,!0):void 0!==s?e.addEventListener(t,i,{passive:s}):e.addEventListener(t,i,!1)}function Xs(e,t,i,r,s){var n=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var o=r.tag;if(3===o||4===o){var a=r.stateNode.containerInfo;if(a===s||8===a.nodeType&&a.parentNode===s)break;if(4===o)for(o=r.return;null!==o;){var l=o.tag;if((3===l||4===l)&&((l=o.stateNode.containerInfo)===s||8===l.nodeType&&l.parentNode===s))return;o=o.return}for(;null!==a;){if(null===(o=kn(a)))return;if(5===(l=o.tag)||6===l){r=n=o;continue e}a=a.parentNode}}r=r.return}zt(function(){var r=n,s=Mt(i),o=[];e:{var a=Is.get(e);if(void 0!==a){var l=gr,h=e;switch(e){case"keypress":if(0===lr(i))break e;case"keydown":case"keyup":l=Br;break;case"focusin":h="focus",l=wr;break;case"focusout":h="blur",l=wr;break;case"beforeblur":case"afterblur":l=wr;break;case"click":if(2===i.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=br;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=Sr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Nr;break;case Ds:case Bs:case As:l=xr;break;case Ns:l=Ir;break;case"scroll":l=mr;break;case"wheel":l=zr;break;case"copy":case"cut":case"paste":l=kr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Ar}var c=!!(4&t),u=!c&&"scroll"===e,d=c?null!==a?a+"Capture":null:a;c=[];for(var f,_=r;null!==_;){var p=(f=_).stateNode;if(5===f.tag&&null!==p&&(f=p,null!==d&&(null!=(p=Ft(_,d))&&c.push(Qs(_,p,f)))),u)break;_=_.return}0<c.length&&(a=new l(a,h,null,i,s),o.push({event:a,listeners:c}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||i===Et||!(h=i.relatedTarget||i.fromElement)||!kn(h)&&!h[Sn])&&(l||a)&&(a=s.window===s?s:(a=s.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=r,null!==(h=(h=i.relatedTarget||i.toElement)?kn(h):null)&&(h!==(u=Gt(h))||5!==h.tag&&6!==h.tag)&&(h=null)):(l=null,h=r),l!==h)){if(c=br,p="onMouseLeave",d="onMouseEnter",_="mouse","pointerout"!==e&&"pointerover"!==e||(c=Ar,p="onPointerLeave",d="onPointerEnter",_="pointer"),u=null==l?a:En(l),f=null==h?a:En(h),(a=new c(p,_+"leave",l,i,s)).target=u,a.relatedTarget=f,p=null,kn(s)===r&&((c=new c(d,_+"enter",h,i,s)).target=f,c.relatedTarget=u,p=c),u=p,l&&h)e:{for(d=h,_=0,f=c=l;f;f=Zs(f))_++;for(f=0,p=d;p;p=Zs(p))f++;for(;0<_-f;)c=Zs(c),_--;for(;0<f-_;)d=Zs(d),f--;for(;_--;){if(c===d||null!==d&&c===d.alternate)break e;c=Zs(c),d=Zs(d)}c=null}else c=null;null!==l&&en(o,a,l,c,!1),null!==h&&null!==u&&en(o,u,h,c,!0)}if("select"===(l=(a=r?En(r):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var g=is;else if(Xr(a))if(rs)g=ds;else{g=cs;var v=hs}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(g=us);switch(g&&(g=g(e,r))?Qr(o,g,i,s):(v&&v(e,a,r),"focusout"===e&&(v=a._wrapperState)&&v.controlled&&"number"===a.type&&at(a,"number",a.value)),v=r?En(r):window,e){case"focusin":(Xr(v)||"true"===v.contentEditable)&&(ws=v,xs=r,Cs=null);break;case"focusout":Cs=xs=ws=null;break;case"mousedown":ks=!0;break;case"contextmenu":case"mouseup":case"dragend":ks=!1,Ls(o,i,s);break;case"selectionchange":if(Ss)break;case"keydown":case"keyup":Ls(o,i,s)}var m;if(jr)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Yr?qr(e,i)&&(y="onCompositionEnd"):"keydown"===e&&229===i.keyCode&&(y="onCompositionStart");y&&($r&&"ko"!==i.locale&&(Yr||"onCompositionStart"!==y?"onCompositionEnd"===y&&Yr&&(m=ar()):(nr="value"in(sr=s)?sr.value:sr.textContent,Yr=!0)),0<(v=Js(r,y)).length&&(y=new Lr(y,e,null,i,s),o.push({event:y,listeners:v}),m?y.data=m:null!==(m=Vr(i))&&(y.data=m))),(m=Hr?function(e,t){switch(e){case"compositionend":return Vr(t);case"keypress":return 32!==t.which?null:(Kr=!0,Ur);case"textInput":return(e=t.data)===Ur&&Kr?null:e;default:return null}}(e,i):function(e,t){if(Yr)return"compositionend"===e||!jr&&qr(e,t)?(e=ar(),or=nr=sr=null,Yr=!1,e):null;switch(e){case"paste":default: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 $r&&"ko"!==t.locale?null:t.data}}(e,i))&&(0<(r=Js(r,"onBeforeInput")).length&&(s=new Lr("onBeforeInput","beforeinput",null,i,s),o.push({event:s,listeners:r}),s.data=m))}Us(o,t)})}function Qs(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Js(e,t){for(var i=t+"Capture",r=[];null!==e;){var s=e,n=s.stateNode;5===s.tag&&null!==n&&(s=n,null!=(n=Ft(e,i))&&r.unshift(Qs(e,n,s)),null!=(n=Ft(e,t))&&r.push(Qs(e,n,s))),e=e.return}return r}function Zs(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function en(e,t,i,r,s){for(var n=t._reactName,o=[];null!==i&&i!==r;){var a=i,l=a.alternate,h=a.stateNode;if(null!==l&&l===r)break;5===a.tag&&null!==h&&(a=h,s?null!=(l=Ft(i,n))&&o.unshift(Qs(i,l,a)):s||null!=(l=Ft(i,n))&&o.push(Qs(i,l,a))),i=i.return}0!==o.length&&e.push({event:t,listeners:o})}var tn=/\r\n?/g,rn=/\u0000|\uFFFD/g;function sn(e){return("string"==typeof e?e:""+e).replace(tn,"\n").replace(rn,"")}function nn(e,t,i){if(t=sn(t),sn(e)!==t&&i)throw Error(de(425))}function on(){}var an=null,ln=null;function hn(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var cn="function"==typeof setTimeout?setTimeout:void 0,un="function"==typeof clearTimeout?clearTimeout:void 0,dn="function"==typeof Promise?Promise:void 0,fn="function"==typeof queueMicrotask?queueMicrotask:void 0!==dn?function(e){return dn.resolve(null).then(e).catch(_n)}:cn;function _n(e){setTimeout(function(){throw e})}function pn(e,t){var i=t,r=0;do{var s=i.nextSibling;if(e.removeChild(i),s&&8===s.nodeType)if("/$"===(i=s.data)){if(0===r)return e.removeChild(s),void Gi(t);r--}else"$"!==i&&"$?"!==i&&"$!"!==i||r++;i=s}while(i);Gi(t)}function gn(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function vn(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var i=e.data;if("$"===i||"$!"===i||"$?"===i){if(0===t)return e;t--}else"/$"===i&&t++}e=e.previousSibling}return null}var mn=Math.random().toString(36).slice(2),yn="__reactFiber$"+mn,bn="__reactProps$"+mn,Sn="__reactContainer$"+mn,wn="__reactEvents$"+mn,xn="__reactListeners$"+mn,Cn="__reactHandles$"+mn;function kn(e){var t=e[yn];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Sn]||i[yn]){if(i=t.alternate,null!==t.child||null!==i&&null!==i.child)for(e=vn(e);null!==e;){if(i=e[yn])return i;e=vn(e)}return t}i=(e=i).parentNode}return null}function Ln(e){return!(e=e[yn]||e[Sn])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function En(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(de(33))}function Mn(e){return e[bn]||null}var Rn=[],Tn=-1;function Pn(e){return{current:e}}function Dn(e){0>Tn||(e.current=Rn[Tn],Rn[Tn]=null,Tn--)}function Bn(e,t){Tn++,Rn[Tn]=e.current,e.current=t}var An={},Nn=Pn(An),In=Pn(!1),On=An;function zn(e,t){var i=e.type.contextTypes;if(!i)return An;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s,n={};for(s in i)n[s]=t[s];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function Fn(e){return null!=(e=e.childContextTypes)}function jn(){Dn(In),Dn(Nn)}function Wn(e,t,i){if(Nn.current!==An)throw Error(de(168));Bn(Nn,t),Bn(In,i)}function Hn(e,t,i){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return i;for(var s in r=r.getChildContext())if(!(s in t))throw Error(de(108,Xe(e)||"Unknown",s));return Ue({},i,r)}function $n(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||An,On=Nn.current,Bn(Nn,e),Bn(In,In.current),!0}function Un(e,t,i){var r=e.stateNode;if(!r)throw Error(de(169));i?(e=Hn(e,t,On),r.__reactInternalMemoizedMergedChildContext=e,Dn(In),Dn(Nn),Bn(Nn,e)):Dn(In),Bn(In,i)}var Kn=null,qn=!1,Vn=!1;function Yn(e){null===Kn?Kn=[e]:Kn.push(e)}function Gn(){if(!Vn&&null!==Kn){Vn=!0;var e=0,t=Li;try{var i=Kn;for(Li=1;e<i.length;e++){var r=i[e];do{r=r(!0)}while(null!==r)}Kn=null,qn=!1}catch(F_){throw null!==Kn&&(Kn=Kn.slice(e+1)),ei(oi,Gn),F_}finally{Li=t,Vn=!1}}return null}var Xn=[],Qn=0,Jn=null,Zn=0,eo=[],to=0,io=null,ro=1,so="";function no(e,t){Xn[Qn++]=Zn,Xn[Qn++]=Jn,Jn=e,Zn=t}function oo(e,t,i){eo[to++]=ro,eo[to++]=so,eo[to++]=io,io=e;var r=ro;e=so;var s=32-fi(r)-1;r&=~(1<<s),i+=1;var n=32-fi(t)+s;if(30<n){var o=s-s%5;n=(r&(1<<o)-1).toString(32),r>>=o,s-=o,ro=1<<32-fi(t)+s|i<<s|r,so=n+e}else ro=1<<n|i<<s|r,so=e}function ao(e){null!==e.return&&(no(e,1),oo(e,1,0))}function lo(e){for(;e===Jn;)Jn=Xn[--Qn],Xn[Qn]=null,Zn=Xn[--Qn],Xn[Qn]=null;for(;e===io;)io=eo[--to],eo[to]=null,so=eo[--to],eo[to]=null,ro=eo[--to],eo[to]=null}var ho=null,co=null,uo=!1,fo=null;function _o(e,t){var i=zc(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,null===(t=e.deletions)?(e.deletions=[i],e.flags|=16):t.push(i)}function po(e,t){switch(e.tag){case 5:var i=e.type;return null!==(t=1!==t.nodeType||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ho=e,co=gn(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ho=e,co=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(i=null!==io?{id:ro,overflow:so}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},(i=zc(18,null,null,0)).stateNode=t,i.return=e,e.child=i,ho=e,co=null,!0);default:return!1}}function go(e){return!(!(1&e.mode)||128&e.flags)}function vo(e){if(uo){var t=co;if(t){var i=t;if(!po(e,t)){if(go(e))throw Error(de(418));t=gn(i.nextSibling);var r=ho;t&&po(e,t)?_o(r,i):(e.flags=-4097&e.flags|2,uo=!1,ho=e)}}else{if(go(e))throw Error(de(418));e.flags=-4097&e.flags|2,uo=!1,ho=e}}}function mo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ho=e}function yo(e){if(e!==ho)return!1;if(!uo)return mo(e),uo=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!hn(e.type,e.memoizedProps)),t&&(t=co)){if(go(e))throw bo(),Error(de(418));for(;t;)_o(e,t),t=gn(t.nextSibling)}if(mo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(de(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var i=e.data;if("/$"===i){if(0===t){co=gn(e.nextSibling);break e}t--}else"$"!==i&&"$!"!==i&&"$?"!==i||t++}e=e.nextSibling}co=null}}else co=ho?gn(e.stateNode.nextSibling):null;return!0}function bo(){for(var e=co;e;)e=gn(e.nextSibling)}function So(){co=ho=null,uo=!1}function wo(e){null===fo?fo=[e]:fo.push(e)}var xo=Ee.ReactCurrentBatchConfig;function Co(e,t,i){if(null!==(e=i.ref)&&"function"!=typeof e&&"object"!=typeof e){if(i._owner){if(i=i._owner){if(1!==i.tag)throw Error(de(309));var r=i.stateNode}if(!r)throw Error(de(147,e));var s=r,n=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===n?t.ref:((t=function(e){var t=s.refs;null===e?delete t[n]:t[n]=e})._stringRef=n,t)}if("string"!=typeof e)throw Error(de(284));if(!i._owner)throw Error(de(290,e))}return e}function ko(e,t){throw e=Object.prototype.toString.call(t),Error(de(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Lo(e){return(0,e._init)(e._payload)}function Eo(e){function t(t,i){if(e){var r=t.deletions;null===r?(t.deletions=[i],t.flags|=16):r.push(i)}}function i(i,r){if(!e)return null;for(;null!==r;)t(i,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function s(e,t){return(e=jc(e,t)).index=0,e.sibling=null,e}function n(t,i,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<i?(t.flags|=2,i):r:(t.flags|=2,i):(t.flags|=1048576,i)}function o(t){return e&&null===t.alternate&&(t.flags|=2),t}function a(e,t,i,r){return null===t||6!==t.tag?((t=Uc(i,e.mode,r)).return=e,t):((t=s(t,i)).return=e,t)}function l(e,t,i,r){var n=i.type;return n===Te?c(e,t,i.props.children,r,i.key):null!==t&&(t.elementType===n||"object"==typeof n&&null!==n&&n.$$typeof===Fe&&Lo(n)===t.type)?((r=s(t,i.props)).ref=Co(e,t,i),r.return=e,r):((r=Wc(i.type,i.key,i.props,null,e.mode,r)).ref=Co(e,t,i),r.return=e,r)}function h(e,t,i,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==i.containerInfo||t.stateNode.implementation!==i.implementation?((t=Kc(i,e.mode,r)).return=e,t):((t=s(t,i.children||[])).return=e,t)}function c(e,t,i,r,n){return null===t||7!==t.tag?((t=Hc(i,e.mode,r,n)).return=e,t):((t=s(t,i)).return=e,t)}function u(e,t,i){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Uc(""+t,e.mode,i)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case Me:return(i=Wc(t.type,t.key,t.props,null,e.mode,i)).ref=Co(e,null,t),i.return=e,i;case Re:return(t=Kc(t,e.mode,i)).return=e,t;case Fe:return u(e,(0,t._init)(t._payload),i)}if(lt(t)||He(t))return(t=Hc(t,e.mode,i,null)).return=e,t;ko(e,t)}return null}function d(e,t,i,r){var s=null!==t?t.key:null;if("string"==typeof i&&""!==i||"number"==typeof i)return null!==s?null:a(e,t,""+i,r);if("object"==typeof i&&null!==i){switch(i.$$typeof){case Me:return i.key===s?l(e,t,i,r):null;case Re:return i.key===s?h(e,t,i,r):null;case Fe:return d(e,t,(s=i._init)(i._payload),r)}if(lt(i)||He(i))return null!==s?null:c(e,t,i,r,null);ko(e,i)}return null}function f(e,t,i,r,s){if("string"==typeof r&&""!==r||"number"==typeof r)return a(t,e=e.get(i)||null,""+r,s);if("object"==typeof r&&null!==r){switch(r.$$typeof){case Me:return l(t,e=e.get(null===r.key?i:r.key)||null,r,s);case Re:return h(t,e=e.get(null===r.key?i:r.key)||null,r,s);case Fe:return f(e,t,i,(0,r._init)(r._payload),s)}if(lt(r)||He(r))return c(t,e=e.get(i)||null,r,s,null);ko(t,r)}return null}return function a(l,h,c,_){if("object"==typeof c&&null!==c&&c.type===Te&&null===c.key&&(c=c.props.children),"object"==typeof c&&null!==c){switch(c.$$typeof){case Me:e:{for(var p=c.key,g=h;null!==g;){if(g.key===p){if((p=c.type)===Te){if(7===g.tag){i(l,g.sibling),(h=s(g,c.props.children)).return=l,l=h;break e}}else if(g.elementType===p||"object"==typeof p&&null!==p&&p.$$typeof===Fe&&Lo(p)===g.type){i(l,g.sibling),(h=s(g,c.props)).ref=Co(l,g,c),h.return=l,l=h;break e}i(l,g);break}t(l,g),g=g.sibling}c.type===Te?((h=Hc(c.props.children,l.mode,_,c.key)).return=l,l=h):((_=Wc(c.type,c.key,c.props,null,l.mode,_)).ref=Co(l,h,c),_.return=l,l=_)}return o(l);case Re:e:{for(g=c.key;null!==h;){if(h.key===g){if(4===h.tag&&h.stateNode.containerInfo===c.containerInfo&&h.stateNode.implementation===c.implementation){i(l,h.sibling),(h=s(h,c.children||[])).return=l,l=h;break e}i(l,h);break}t(l,h),h=h.sibling}(h=Kc(c,l.mode,_)).return=l,l=h}return o(l);case Fe:return a(l,h,(g=c._init)(c._payload),_)}if(lt(c))return function(s,o,a,l){for(var h=null,c=null,_=o,p=o=0,g=null;null!==_&&p<a.length;p++){_.index>p?(g=_,_=null):g=_.sibling;var v=d(s,_,a[p],l);if(null===v){null===_&&(_=g);break}e&&_&&null===v.alternate&&t(s,_),o=n(v,o,p),null===c?h=v:c.sibling=v,c=v,_=g}if(p===a.length)return i(s,_),uo&&no(s,p),h;if(null===_){for(;p<a.length;p++)null!==(_=u(s,a[p],l))&&(o=n(_,o,p),null===c?h=_:c.sibling=_,c=_);return uo&&no(s,p),h}for(_=r(s,_);p<a.length;p++)null!==(g=f(_,s,p,a[p],l))&&(e&&null!==g.alternate&&_.delete(null===g.key?p:g.key),o=n(g,o,p),null===c?h=g:c.sibling=g,c=g);return e&&_.forEach(function(e){return t(s,e)}),uo&&no(s,p),h}(l,h,c,_);if(He(c))return function(s,o,a,l){var h=He(a);if("function"!=typeof h)throw Error(de(150));if(null==(a=h.call(a)))throw Error(de(151));for(var c=h=null,_=o,p=o=0,g=null,v=a.next();null!==_&&!v.done;p++,v=a.next()){_.index>p?(g=_,_=null):g=_.sibling;var m=d(s,_,v.value,l);if(null===m){null===_&&(_=g);break}e&&_&&null===m.alternate&&t(s,_),o=n(m,o,p),null===c?h=m:c.sibling=m,c=m,_=g}if(v.done)return i(s,_),uo&&no(s,p),h;if(null===_){for(;!v.done;p++,v=a.next())null!==(v=u(s,v.value,l))&&(o=n(v,o,p),null===c?h=v:c.sibling=v,c=v);return uo&&no(s,p),h}for(_=r(s,_);!v.done;p++,v=a.next())null!==(v=f(_,s,p,v.value,l))&&(e&&null!==v.alternate&&_.delete(null===v.key?p:v.key),o=n(v,o,p),null===c?h=v:c.sibling=v,c=v);return e&&_.forEach(function(e){return t(s,e)}),uo&&no(s,p),h}(l,h,c,_);ko(l,c)}return"string"==typeof c&&""!==c||"number"==typeof c?(c=""+c,null!==h&&6===h.tag?(i(l,h.sibling),(h=s(h,c)).return=l,l=h):(i(l,h),(h=Uc(c,l.mode,_)).return=l,l=h),o(l)):i(l,h)}}var Mo=Eo(!0),Ro=Eo(!1),To=Pn(null),Po=null,Do=null,Bo=null;function Ao(){Bo=Do=Po=null}function No(e){var t=To.current;Dn(To),e._currentValue=t}function Io(e,t,i){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===i)break;e=e.return}}function Oo(e,t){Po=e,Bo=Do=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(Ll=!0),e.firstContext=null)}function zo(e){var t=e._currentValue;if(Bo!==e)if(e={context:e,memoizedValue:t,next:null},null===Do){if(null===Po)throw Error(de(308));Do=e,Po.dependencies={lanes:0,firstContext:e}}else Do=Do.next=e;return t}var Fo=null;function jo(e){null===Fo?Fo=[e]:Fo.push(e)}function Wo(e,t,i,r){var s=t.interleaved;return null===s?(i.next=i,jo(t)):(i.next=s.next,s.next=i),t.interleaved=i,Ho(e,r)}function Ho(e,t){e.lanes|=t;var i=e.alternate;for(null!==i&&(i.lanes|=t),i=e,e=e.return;null!==e;)e.childLanes|=t,null!==(i=e.alternate)&&(i.childLanes|=t),i=e,e=e.return;return 3===i.tag?i.stateNode:null}var $o=!1;function Uo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ko(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 qo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Vo(e,t,i){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&Nh){var s=r.pending;return null===s?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Ho(e,i)}return null===(s=r.interleaved)?(t.next=t,jo(r)):(t.next=s.next,s.next=t),r.interleaved=t,Ho(e,i)}function Yo(e,t,i){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&i)){var r=t.lanes;i|=r&=e.pendingLanes,t.lanes=i,ki(e,i)}}function Go(e,t){var i=e.updateQueue,r=e.alternate;if(null!==r&&i===(r=r.updateQueue)){var s=null,n=null;if(null!==(i=i.firstBaseUpdate)){do{var o={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};null===n?s=n=o:n=n.next=o,i=i.next}while(null!==i);null===n?s=n=t:n=n.next=t}else s=n=t;return i={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:r.shared,effects:r.effects},void(e.updateQueue=i)}null===(e=i.lastBaseUpdate)?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function Xo(e,t,i,r){var s=e.updateQueue;$o=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(null!==a){s.shared.pending=null;var l=a,h=l.next;l.next=null,null===o?n=h:o.next=h,o=l;var c=e.alternate;null!==c&&((a=(c=c.updateQueue).lastBaseUpdate)!==o&&(null===a?c.firstBaseUpdate=h:a.next=h,c.lastBaseUpdate=l))}if(null!==n){var u=s.baseState;for(o=0,c=h=l=null,a=n;;){var d=a.lane,f=a.eventTime;if((r&d)===d){null!==c&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var _=e,p=a;switch(d=t,f=i,p.tag){case 1:if("function"==typeof(_=p.payload)){u=_.call(f,u,d);break e}u=_;break e;case 3:_.flags=-65537&_.flags|128;case 0:if(null==(d="function"==typeof(_=p.payload)?_.call(f,u,d):_))break e;u=Ue({},u,d);break e;case 2:$o=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(d=s.effects)?s.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===c?(h=c=f,l=u):c=c.next=f,o|=d;if(null===(a=a.next)){if(null===(a=s.shared.pending))break;a=(d=a).next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}if(null===c&&(l=u),s.baseState=l,s.firstBaseUpdate=h,s.lastBaseUpdate=c,null!==(t=s.shared.interleaved)){s=t;do{o|=s.lane,s=s.next}while(s!==t)}else null===n&&(s.shared.lanes=0);$h|=o,e.lanes=o,e.memoizedState=u}}function Qo(e,t,i){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(null!==s){if(r.callback=null,r=i,"function"!=typeof s)throw Error(de(191,s));s.call(r)}}}var Jo={},Zo=Pn(Jo),ea=Pn(Jo),ta=Pn(Jo);function ia(e){if(e===Jo)throw Error(de(174));return e}function ra(e,t){switch(Bn(ta,t),Bn(ea,e),Bn(Zo,Jo),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:pt(null,"");break;default:t=pt(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Dn(Zo),Bn(Zo,t)}function sa(){Dn(Zo),Dn(ea),Dn(ta)}function na(e){ia(ta.current);var t=ia(Zo.current),i=pt(t,e.type);t!==i&&(Bn(ea,e),Bn(Zo,i))}function oa(e){ea.current===e&&(Dn(Zo),Dn(ea))}var aa=Pn(0);function la(e){for(var t=e;null!==t;){if(13===t.tag){var i=t.memoizedState;if(null!==i&&(null===(i=i.dehydrated)||"$?"===i.data||"$!"===i.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ha=[];function ca(){for(var e=0;e<ha.length;e++)ha[e]._workInProgressVersionPrimary=null;ha.length=0}var ua=Ee.ReactCurrentDispatcher,da=Ee.ReactCurrentBatchConfig,fa=0,_a=null,pa=null,ga=null,va=!1,ma=!1,ya=0,ba=0;function Sa(){throw Error(de(321))}function wa(e,t){if(null===t)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!fs(e[i],t[i]))return!1;return!0}function xa(e,t,i,r,s,n){if(fa=n,_a=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ua.current=null===e||null===e.memoizedState?ol:al,e=i(r,s),ma){n=0;do{if(ma=!1,ya=0,25<=n)throw Error(de(301));n+=1,ga=pa=null,t.updateQueue=null,ua.current=ll,e=i(r,s)}while(ma)}if(ua.current=nl,t=null!==pa&&null!==pa.next,fa=0,ga=pa=_a=null,va=!1,t)throw Error(de(300));return e}function Ca(){var e=0!==ya;return ya=0,e}function ka(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ga?_a.memoizedState=ga=e:ga=ga.next=e,ga}function La(){if(null===pa){var e=_a.alternate;e=null!==e?e.memoizedState:null}else e=pa.next;var t=null===ga?_a.memoizedState:ga.next;if(null!==t)ga=t,pa=e;else{if(null===e)throw Error(de(310));e={memoizedState:(pa=e).memoizedState,baseState:pa.baseState,baseQueue:pa.baseQueue,queue:pa.queue,next:null},null===ga?_a.memoizedState=ga=e:ga=ga.next=e}return ga}function Ea(e,t){return"function"==typeof t?t(e):t}function Ma(e){var t=La(),i=t.queue;if(null===i)throw Error(de(311));i.lastRenderedReducer=e;var r=pa,s=r.baseQueue,n=i.pending;if(null!==n){if(null!==s){var o=s.next;s.next=n.next,n.next=o}r.baseQueue=s=n,i.pending=null}if(null!==s){n=s.next,r=r.baseState;var a=o=null,l=null,h=n;do{var c=h.lane;if((fa&c)===c)null!==l&&(l=l.next={lane:0,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),r=h.hasEagerState?h.eagerState:e(r,h.action);else{var u={lane:c,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null};null===l?(a=l=u,o=r):l=l.next=u,_a.lanes|=c,$h|=c}h=h.next}while(null!==h&&h!==n);null===l?o=r:l.next=a,fs(r,t.memoizedState)||(Ll=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,i.lastRenderedState=r}if(null!==(e=i.interleaved)){s=e;do{n=s.lane,_a.lanes|=n,$h|=n,s=s.next}while(s!==e)}else null===s&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function Ra(e){var t=La(),i=t.queue;if(null===i)throw Error(de(311));i.lastRenderedReducer=e;var r=i.dispatch,s=i.pending,n=t.memoizedState;if(null!==s){i.pending=null;var o=s=s.next;do{n=e(n,o.action),o=o.next}while(o!==s);fs(n,t.memoizedState)||(Ll=!0),t.memoizedState=n,null===t.baseQueue&&(t.baseState=n),i.lastRenderedState=n}return[n,r]}function Ta(){}function Pa(e,t){var i=_a,r=La(),s=t(),n=!fs(r.memoizedState,s);if(n&&(r.memoizedState=s,Ll=!0),r=r.queue,$a(Aa.bind(null,i,r,e),[e]),r.getSnapshot!==t||n||null!==ga&&1&ga.memoizedState.tag){if(i.flags|=2048,za(9,Ba.bind(null,i,r,s,t),void 0,null),null===Ih)throw Error(de(349));30&fa||Da(i,t,s)}return s}function Da(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},null===(t=_a.updateQueue)?(t={lastEffect:null,stores:null},_a.updateQueue=t,t.stores=[e]):null===(i=t.stores)?t.stores=[e]:i.push(e)}function Ba(e,t,i,r){t.value=i,t.getSnapshot=r,Na(t)&&Ia(e)}function Aa(e,t,i){return i(function(){Na(t)&&Ia(e)})}function Na(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!fs(e,i)}catch(r){return!0}}function Ia(e){var t=Ho(e,1);null!==t&&hc(t,e,1,-1)}function Oa(e){var t=ka();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:e},t.queue=e,e=e.dispatch=tl.bind(null,_a,e),[t.memoizedState,e]}function za(e,t,i,r){return e={tag:e,create:t,destroy:i,deps:r,next:null},null===(t=_a.updateQueue)?(t={lastEffect:null,stores:null},_a.updateQueue=t,t.lastEffect=e.next=e):null===(i=t.lastEffect)?t.lastEffect=e.next=e:(r=i.next,i.next=e,e.next=r,t.lastEffect=e),e}function Fa(){return La().memoizedState}function ja(e,t,i,r){var s=ka();_a.flags|=e,s.memoizedState=za(1|t,i,void 0,void 0===r?null:r)}function Wa(e,t,i,r){var s=La();r=void 0===r?null:r;var n=void 0;if(null!==pa){var o=pa.memoizedState;if(n=o.destroy,null!==r&&wa(r,o.deps))return void(s.memoizedState=za(t,i,n,r))}_a.flags|=e,s.memoizedState=za(1|t,i,n,r)}function Ha(e,t){return ja(8390656,8,e,t)}function $a(e,t){return Wa(2048,8,e,t)}function Ua(e,t){return Wa(4,2,e,t)}function Ka(e,t){return Wa(4,4,e,t)}function qa(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Va(e,t,i){return i=null!=i?i.concat([e]):null,Wa(4,4,qa.bind(null,t,e),i)}function Ya(){}function Ga(e,t){var i=La();t=void 0===t?null:t;var r=i.memoizedState;return null!==r&&null!==t&&wa(t,r[1])?r[0]:(i.memoizedState=[e,t],e)}function Xa(e,t){var i=La();t=void 0===t?null:t;var r=i.memoizedState;return null!==r&&null!==t&&wa(t,r[1])?r[0]:(e=e(),i.memoizedState=[e,t],e)}function Qa(e,t,i){return 21&fa?(fs(i,t)||(i=wi(),_a.lanes|=i,$h|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ll=!0),e.memoizedState=i)}function Ja(e,t){var i=Li;Li=0!==i&&4>i?i:4,e(!0);var r=da.transition;da.transition={};try{e(!1),t()}finally{Li=i,da.transition=r}}function Za(){return La().memoizedState}function el(e,t,i){var r=lc(e);if(i={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null},il(e))rl(t,i);else if(null!==(i=Wo(e,t,i,r))){hc(i,e,r,ac()),sl(i,t,r)}}function tl(e,t,i){var r=lc(e),s={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null};if(il(e))rl(t,s);else{var n=e.alternate;if(0===e.lanes&&(null===n||0===n.lanes)&&null!==(n=t.lastRenderedReducer))try{var o=t.lastRenderedState,a=n(o,i);if(s.hasEagerState=!0,s.eagerState=a,fs(a,o)){var l=t.interleaved;return null===l?(s.next=s,jo(t)):(s.next=l.next,l.next=s),void(t.interleaved=s)}}catch(_f){}null!==(i=Wo(e,t,s,r))&&(hc(i,e,r,s=ac()),sl(i,t,r))}}function il(e){var t=e.alternate;return e===_a||null!==t&&t===_a}function rl(e,t){ma=va=!0;var i=e.pending;null===i?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function sl(e,t,i){if(4194240&i){var r=t.lanes;i|=r&=e.pendingLanes,t.lanes=i,ki(e,i)}}var nl={readContext:zo,useCallback:Sa,useContext:Sa,useEffect:Sa,useImperativeHandle:Sa,useInsertionEffect:Sa,useLayoutEffect:Sa,useMemo:Sa,useReducer:Sa,useRef:Sa,useState:Sa,useDebugValue:Sa,useDeferredValue:Sa,useTransition:Sa,useMutableSource:Sa,useSyncExternalStore:Sa,useId:Sa,unstable_isNewReconciler:!1},ol={readContext:zo,useCallback:function(e,t){return ka().memoizedState=[e,void 0===t?null:t],e},useContext:zo,useEffect:Ha,useImperativeHandle:function(e,t,i){return i=null!=i?i.concat([e]):null,ja(4194308,4,qa.bind(null,t,e),i)},useLayoutEffect:function(e,t){return ja(4194308,4,e,t)},useInsertionEffect:function(e,t){return ja(4,2,e,t)},useMemo:function(e,t){var i=ka();return t=void 0===t?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var r=ka();return t=void 0!==i?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=el.bind(null,_a,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},ka().memoizedState=e},useState:Oa,useDebugValue:Ya,useDeferredValue:function(e){return ka().memoizedState=e},useTransition:function(){var e=Oa(!1),t=e[0];return e=Ja.bind(null,e[1]),ka().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var r=_a,s=ka();if(uo){if(void 0===i)throw Error(de(407));i=i()}else{if(i=t(),null===Ih)throw Error(de(349));30&fa||Da(r,t,i)}s.memoizedState=i;var n={value:i,getSnapshot:t};return s.queue=n,Ha(Aa.bind(null,r,n,e),[e]),r.flags|=2048,za(9,Ba.bind(null,r,n,i,t),void 0,null),i},useId:function(){var e=ka(),t=Ih.identifierPrefix;if(uo){var i=so;t=":"+t+"R"+(i=(ro&~(1<<32-fi(ro)-1)).toString(32)+i),0<(i=ya++)&&(t+="H"+i.toString(32)),t+=":"}else t=":"+t+"r"+(i=ba++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},al={readContext:zo,useCallback:Ga,useContext:zo,useEffect:$a,useImperativeHandle:Va,useInsertionEffect:Ua,useLayoutEffect:Ka,useMemo:Xa,useReducer:Ma,useRef:Fa,useState:function(){return Ma(Ea)},useDebugValue:Ya,useDeferredValue:function(e){return Qa(La(),pa.memoizedState,e)},useTransition:function(){return[Ma(Ea)[0],La().memoizedState]},useMutableSource:Ta,useSyncExternalStore:Pa,useId:Za,unstable_isNewReconciler:!1},ll={readContext:zo,useCallback:Ga,useContext:zo,useEffect:$a,useImperativeHandle:Va,useInsertionEffect:Ua,useLayoutEffect:Ka,useMemo:Xa,useReducer:Ra,useRef:Fa,useState:function(){return Ra(Ea)},useDebugValue:Ya,useDeferredValue:function(e){var t=La();return null===pa?t.memoizedState=e:Qa(t,pa.memoizedState,e)},useTransition:function(){return[Ra(Ea)[0],La().memoizedState]},useMutableSource:Ta,useSyncExternalStore:Pa,useId:Za,unstable_isNewReconciler:!1};function hl(e,t){if(e&&e.defaultProps){for(var i in t=Ue({},t),e=e.defaultProps)void 0===t[i]&&(t[i]=e[i]);return t}return t}function cl(e,t,i,r){i=null==(i=i(r,t=e.memoizedState))?t:Ue({},t,i),e.memoizedState=i,0===e.lanes&&(e.updateQueue.baseState=i)}var ul={isMounted:function(e){return!!(e=e._reactInternals)&&Gt(e)===e},enqueueSetState:function(e,t,i){e=e._reactInternals;var r=ac(),s=lc(e),n=qo(r,s);n.payload=t,null!=i&&(n.callback=i),null!==(t=Vo(e,n,s))&&(hc(t,e,s,r),Yo(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var r=ac(),s=lc(e),n=qo(r,s);n.tag=1,n.payload=t,null!=i&&(n.callback=i),null!==(t=Vo(e,n,s))&&(hc(t,e,s,r),Yo(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=ac(),r=lc(e),s=qo(i,r);s.tag=2,null!=t&&(s.callback=t),null!==(t=Vo(e,s,r))&&(hc(t,e,r,i),Yo(t,e,r))}};function dl(e,t,i,r,s,n,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,n,o):!t.prototype||!t.prototype.isPureReactComponent||(!_s(i,r)||!_s(s,n))}function fl(e,t,i){var r=!1,s=An,n=t.contextType;return"object"==typeof n&&null!==n?n=zo(n):(s=Fn(t)?On:Nn.current,n=(r=null!=(r=t.contextTypes))?zn(e,s):An),t=new t(i,n),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ul,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=n),t}function _l(e,t,i,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(i,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(i,r),t.state!==e&&ul.enqueueReplaceState(t,t.state,null)}function pl(e,t,i,r){var s=e.stateNode;s.props=i,s.state=e.memoizedState,s.refs={},Uo(e);var n=t.contextType;"object"==typeof n&&null!==n?s.context=zo(n):(n=Fn(t)?On:Nn.current,s.context=zn(e,n)),s.state=e.memoizedState,"function"==typeof(n=t.getDerivedStateFromProps)&&(cl(e,t,n,i),s.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof s.getSnapshotBeforeUpdate||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||(t=s.state,"function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount(),t!==s.state&&ul.enqueueReplaceState(s,s.state,null),Xo(e,i,s,r),s.state=e.memoizedState),"function"==typeof s.componentDidMount&&(e.flags|=4194308)}function gl(e,t){try{var i="",r=t;do{i+=Ye(r),r=r.return}while(r);var s=i}catch(n){s="\nError generating stack: "+n.message+"\n"+n.stack}return{value:e,source:t,stack:s,digest:null}}function vl(e,t,i){return{value:e,source:null,stack:null!=i?i:null,digest:null!=t?t:null}}function ml(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var yl="function"==typeof WeakMap?WeakMap:Map;function bl(e,t,i){(i=qo(-1,i)).tag=3,i.payload={element:null};var r=t.value;return i.callback=function(){Qh||(Qh=!0,Jh=r),ml(0,t)},i}function Sl(e,t,i){(i=qo(-1,i)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var s=t.value;i.payload=function(){return r(s)},i.callback=function(){ml(0,t)}}var n=e.stateNode;return null!==n&&"function"==typeof n.componentDidCatch&&(i.callback=function(){ml(0,t),"function"!=typeof r&&(null===Zh?Zh=new Set([this]):Zh.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),i}function wl(e,t,i){var r=e.pingCache;if(null===r){r=e.pingCache=new yl;var s=new Set;r.set(t,s)}else void 0===(s=r.get(t))&&(s=new Set,r.set(t,s));s.has(i)||(s.add(i),e=Dc.bind(null,e,t,i),t.then(e,e))}function xl(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function Cl(e,t,i,r,s){return 1&e.mode?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,1===i.tag&&(null===i.alternate?i.tag=17:((t=qo(-1,1)).tag=2,Vo(i,t,1))),i.lanes|=1),e)}var kl=Ee.ReactCurrentOwner,Ll=!1;function El(e,t,i,r){t.child=null===e?Ro(t,null,i,r):Mo(t,e.child,i,r)}function Ml(e,t,i,r,s){i=i.render;var n=t.ref;return Oo(t,s),r=xa(e,t,i,r,n,s),i=Ca(),null===e||Ll?(uo&&i&&ao(t),t.flags|=1,El(e,t,r,s),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Ql(e,t,s))}function Rl(e,t,i,r,s){if(null===e){var n=i.type;return"function"!=typeof n||Fc(n)||void 0!==n.defaultProps||null!==i.compare||void 0!==i.defaultProps?((e=Wc(i.type,null,r,t,t.mode,s)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=n,Tl(e,t,n,r,s))}if(n=e.child,0===(e.lanes&s)){var o=n.memoizedProps;if((i=null!==(i=i.compare)?i:_s)(o,r)&&e.ref===t.ref)return Ql(e,t,s)}return t.flags|=1,(e=jc(n,r)).ref=t.ref,e.return=t,t.child=e}function Tl(e,t,i,r,s){if(null!==e){var n=e.memoizedProps;if(_s(n,r)&&e.ref===t.ref){if(Ll=!1,t.pendingProps=r=n,0===(e.lanes&s))return t.lanes=e.lanes,Ql(e,t,s);131072&e.flags&&(Ll=!0)}}return Bl(e,t,i,r,s)}function Pl(e,t,i){var r=t.pendingProps,s=r.children,n=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&i))return e=null!==n?n.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Bn(jh,Fh),Fh|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==n?n.baseLanes:i,Bn(jh,Fh),Fh|=r}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Bn(jh,Fh),Fh|=i;else null!==n?(r=n.baseLanes|i,t.memoizedState=null):r=i,Bn(jh,Fh),Fh|=r;return El(e,t,s,i),t.child}function Dl(e,t){var i=t.ref;(null===e&&null!==i||null!==e&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function Bl(e,t,i,r,s){var n=Fn(i)?On:Nn.current;return n=zn(t,n),Oo(t,s),i=xa(e,t,i,r,n,s),r=Ca(),null===e||Ll?(uo&&r&&ao(t),t.flags|=1,El(e,t,i,s),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Ql(e,t,s))}function Al(e,t,i,r,s){if(Fn(i)){var n=!0;$n(t)}else n=!1;if(Oo(t,s),null===t.stateNode)Xl(e,t),fl(t,i,r),pl(t,i,r,s),r=!0;else if(null===e){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,h=i.contextType;"object"==typeof h&&null!==h?h=zo(h):h=zn(t,h=Fn(i)?On:Nn.current);var c=i.getDerivedStateFromProps,u="function"==typeof c||"function"==typeof o.getSnapshotBeforeUpdate;u||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==r||l!==h)&&_l(t,o,r,h),$o=!1;var d=t.memoizedState;o.state=d,Xo(t,r,o,s),l=t.memoizedState,a!==r||d!==l||In.current||$o?("function"==typeof c&&(cl(t,i,c,r),l=t.memoizedState),(a=$o||dl(t,i,a,r,d,l,h))?(u||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=h,r=a):("function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Ko(e,t),a=t.memoizedProps,h=t.type===t.elementType?a:hl(t.type,a),o.props=h,u=t.pendingProps,d=o.context,"object"==typeof(l=i.contextType)&&null!==l?l=zo(l):l=zn(t,l=Fn(i)?On:Nn.current);var f=i.getDerivedStateFromProps;(c="function"==typeof f||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==u||d!==l)&&_l(t,o,r,l),$o=!1,d=t.memoizedState,o.state=d,Xo(t,r,o,s);var _=t.memoizedState;a!==u||d!==_||In.current||$o?("function"==typeof f&&(cl(t,i,f,r),_=t.memoizedState),(h=$o||dl(t,i,h,r,d,_,l)||!1)?(c||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(r,_,l),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,_,l)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=_),o.props=r,o.state=_,o.context=l,r=h):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return Nl(e,t,i,r,n,s)}function Nl(e,t,i,r,s,n){Dl(e,t);var o=!!(128&t.flags);if(!r&&!o)return s&&Un(t,i,!1),Ql(e,t,n);r=t.stateNode,kl.current=t;var a=o&&"function"!=typeof i.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&o?(t.child=Mo(t,e.child,null,n),t.child=Mo(t,null,a,n)):El(e,t,a,n),t.memoizedState=r.state,s&&Un(t,i,!0),t.child}function Il(e){var t=e.stateNode;t.pendingContext?Wn(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Wn(0,t.context,!1),ra(e,t.containerInfo)}function Ol(e,t,i,r,s){return So(),wo(s),t.flags|=256,El(e,t,i,r),t.child}var zl,Fl,jl,Wl,Hl={dehydrated:null,treeContext:null,retryLane:0};function $l(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ul(e,t,i){var r,s=t.pendingProps,n=aa.current,o=!1,a=!!(128&t.flags);if((r=a)||(r=(null===e||null!==e.memoizedState)&&!!(2&n)),r?(o=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(n|=1),Bn(aa,1&n),null===e)return vo(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=s.children,e=s.fallback,o?(s=t.mode,o=t.child,a={mode:"hidden",children:a},1&s||null===o?o=$c(a,s,0,null):(o.childLanes=0,o.pendingProps=a),e=Hc(e,s,i,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=$l(i),t.memoizedState=Hl,e):Kl(t,a));if(null!==(n=e.memoizedState)&&null!==(r=n.dehydrated))return function(e,t,i,r,s,n,o){if(i)return 256&t.flags?(t.flags&=-257,ql(e,t,o,r=vl(Error(de(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(n=r.fallback,s=t.mode,r=$c({mode:"visible",children:r.children},s,0,null),(n=Hc(n,s,o,null)).flags|=2,r.return=t,n.return=t,r.sibling=n,t.child=r,1&t.mode&&Mo(t,e.child,null,o),t.child.memoizedState=$l(o),t.memoizedState=Hl,n);if(!(1&t.mode))return ql(e,t,o,null);if("$!"===s.data){if(r=s.nextSibling&&s.nextSibling.dataset)var a=r.dgst;return r=a,ql(e,t,o,r=vl(n=Error(de(419)),r,void 0))}if(a=0!==(o&e.childLanes),Ll||a){if(null!==(r=Ih)){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}0!==(s=0!==(s&(r.suspendedLanes|o))?0:s)&&s!==n.retryLane&&(n.retryLane=s,Ho(e,s),hc(r,e,s,-1))}return wc(),ql(e,t,o,r=vl(Error(de(421))))}return"$?"===s.data?(t.flags|=128,t.child=e.child,t=Ac.bind(null,e),s._reactRetry=t,null):(e=n.treeContext,co=gn(s.nextSibling),ho=t,uo=!0,fo=null,null!==e&&(eo[to++]=ro,eo[to++]=so,eo[to++]=io,ro=e.id,so=e.overflow,io=t),t=Kl(t,r.children),t.flags|=4096,t)}(e,t,a,s,r,n,i);if(o){o=s.fallback,a=t.mode,r=(n=e.child).sibling;var l={mode:"hidden",children:s.children};return 1&a||t.child===n?(s=jc(n,l)).subtreeFlags=14680064&n.subtreeFlags:((s=t.child).childLanes=0,s.pendingProps=l,t.deletions=null),null!==r?o=jc(r,o):(o=Hc(o,a,i,null)).flags|=2,o.return=t,s.return=t,s.sibling=o,t.child=s,s=o,o=t.child,a=null===(a=e.child.memoizedState)?$l(i):{baseLanes:a.baseLanes|i,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~i,t.memoizedState=Hl,s}return e=(o=e.child).sibling,s=jc(o,{mode:"visible",children:s.children}),!(1&t.mode)&&(s.lanes=i),s.return=t,s.sibling=null,null!==e&&(null===(i=t.deletions)?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=s,t.memoizedState=null,s}function Kl(e,t){return(t=$c({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function ql(e,t,i,r){return null!==r&&wo(r),Mo(t,e.child,null,i),(e=Kl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Vl(e,t,i){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Io(e.return,t,i)}function Yl(e,t,i,r,s){var n=e.memoizedState;null===n?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 Gl(e,t,i){var r=t.pendingProps,s=r.revealOrder,n=r.tail;if(El(e,t,r.children,i),2&(r=aa.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Vl(e,i,t);else if(19===e.tag)Vl(e,i,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Bn(aa,r),1&t.mode)switch(s){case"forwards":for(i=t.child,s=null;null!==i;)null!==(e=i.alternate)&&null===la(e)&&(s=i),i=i.sibling;null===(i=s)?(s=t.child,t.child=null):(s=i.sibling,i.sibling=null),Yl(t,!1,s,i,n);break;case"backwards":for(i=null,s=t.child,t.child=null;null!==s;){if(null!==(e=s.alternate)&&null===la(e)){t.child=s;break}e=s.sibling,s.sibling=i,i=s,s=e}Yl(t,!0,i,null,n);break;case"together":Yl(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Xl(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ql(e,t,i){if(null!==e&&(t.dependencies=e.dependencies),$h|=t.lanes,0===(i&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(de(153));if(null!==t.child){for(i=jc(e=t.child,e.pendingProps),t.child=i,i.return=t;null!==e.sibling;)e=e.sibling,(i=i.sibling=jc(e,e.pendingProps)).return=t;i.sibling=null}return t.child}function Jl(e,t){if(!uo)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;null!==t;)null!==t.alternate&&(i=t),t=t.sibling;null===i?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var r=null;null!==i;)null!==i.alternate&&(r=i),i=i.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Zl(e){var t=null!==e.alternate&&e.alternate.child===e.child,i=0,r=0;if(t)for(var s=e.child;null!==s;)i|=s.lanes|s.childLanes,r|=14680064&s.subtreeFlags,r|=14680064&s.flags,s.return=e,s=s.sibling;else for(s=e.child;null!==s;)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 eh(e,t,i){var r=t.pendingProps;switch(lo(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zl(t),null;case 1:case 17:return Fn(t.type)&&jn(),Zl(t),null;case 3:return r=t.stateNode,sa(),Dn(In),Dn(Nn),ca(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(yo(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==fo&&(fc(fo),fo=null))),Fl(e,t),Zl(t),null;case 5:oa(t);var s=ia(ta.current);if(i=t.type,null!==e&&null!=t.stateNode)jl(e,t,i,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(de(166));return Zl(t),null}if(e=ia(Zo.current),yo(t)){r=t.stateNode,i=t.type;var n=t.memoizedProps;switch(r[yn]=t,r[bn]=n,e=!!(1&t.mode),i){case"dialog":Ks("cancel",r),Ks("close",r);break;case"iframe":case"object":case"embed":Ks("load",r);break;case"video":case"audio":for(s=0;s<Ws.length;s++)Ks(Ws[s],r);break;case"source":Ks("error",r);break;case"img":case"image":case"link":Ks("error",r),Ks("load",r);break;case"details":Ks("toggle",r);break;case"input":rt(r,n),Ks("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!n.multiple},Ks("invalid",r);break;case"textarea":ut(r,n),Ks("invalid",r)}for(var o in kt(i,n),s=null,n)if(n.hasOwnProperty(o)){var a=n[o];"children"===o?"string"==typeof a?r.textContent!==a&&(!0!==n.suppressHydrationWarning&&nn(r.textContent,a,e),s=["children",a]):"number"==typeof a&&r.textContent!==""+a&&(!0!==n.suppressHydrationWarning&&nn(r.textContent,a,e),s=["children",""+a]):_e.hasOwnProperty(o)&&null!=a&&"onScroll"===o&&Ks("scroll",r)}switch(i){case"input":Ze(r),ot(r,n,!0);break;case"textarea":Ze(r),ft(r);break;case"select":case"option":break;default:"function"==typeof n.onClick&&(r.onclick=on)}r=s,t.updateQueue=r,null!==r&&(t.flags|=4)}else{o=9===s.nodeType?s:s.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=_t(i)),"http://www.w3.org/1999/xhtml"===e?"script"===i?((e=o.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=o.createElement(i,{is:r.is}):(e=o.createElement(i),"select"===i&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,i),e[yn]=t,e[bn]=r,zl(e,t,!1,!1),t.stateNode=e;e:{switch(o=Lt(i,r),i){case"dialog":Ks("cancel",e),Ks("close",e),s=r;break;case"iframe":case"object":case"embed":Ks("load",e),s=r;break;case"video":case"audio":for(s=0;s<Ws.length;s++)Ks(Ws[s],e);s=r;break;case"source":Ks("error",e),s=r;break;case"img":case"image":case"link":Ks("error",e),Ks("load",e),s=r;break;case"details":Ks("toggle",e),s=r;break;case"input":rt(e,r),s=it(e,r),Ks("invalid",e);break;case"option":default:s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Ue({},r,{value:void 0}),Ks("invalid",e);break;case"textarea":ut(e,r),s=ct(e,r),Ks("invalid",e)}for(n in kt(i,s),a=s)if(a.hasOwnProperty(n)){var l=a[n];"style"===n?xt(e,l):"dangerouslySetInnerHTML"===n?null!=(l=l?l.__html:void 0)&&mt(e,l):"children"===n?"string"==typeof l?("textarea"!==i||""!==l)&&yt(e,l):"number"==typeof l&&yt(e,""+l):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&"autoFocus"!==n&&(_e.hasOwnProperty(n)?null!=l&&"onScroll"===n&&Ks("scroll",e):null!=l&&Le(e,n,l,o))}switch(i){case"input":Ze(e),ot(e,r,!1);break;case"textarea":Ze(e),ft(e);break;case"option":null!=r.value&&e.setAttribute("value",""+Qe(r.value));break;case"select":e.multiple=!!r.multiple,null!=(n=r.value)?ht(e,!!r.multiple,n,!1):null!=r.defaultValue&&ht(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof s.onClick&&(e.onclick=on)}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)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Zl(t),null;case 6:if(e&&null!=t.stateNode)Wl(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(de(166));if(i=ia(ta.current),ia(Zo.current),yo(t)){if(r=t.stateNode,i=t.memoizedProps,r[yn]=t,(n=r.nodeValue!==i)&&null!==(e=ho))switch(e.tag){case 3:nn(r.nodeValue,i,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&nn(r.nodeValue,i,!!(1&e.mode))}n&&(t.flags|=4)}else(r=(9===i.nodeType?i:i.ownerDocument).createTextNode(r))[yn]=t,t.stateNode=r}return Zl(t),null;case 13:if(Dn(aa),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(uo&&null!==co&&1&t.mode&&!(128&t.flags))bo(),So(),t.flags|=98560,n=!1;else if(n=yo(t),null!==r&&null!==r.dehydrated){if(null===e){if(!n)throw Error(de(318));if(!(n=null!==(n=t.memoizedState)?n.dehydrated:null))throw Error(de(317));n[yn]=t}else So(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Zl(t),n=!1}else null!==fo&&(fc(fo),fo=null),n=!0;if(!n)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=i,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,1&t.mode&&(null===e||1&aa.current?0===Wh&&(Wh=3):wc())),null!==t.updateQueue&&(t.flags|=4),Zl(t),null);case 4:return sa(),Fl(e,t),null===e&&Ys(t.stateNode.containerInfo),Zl(t),null;case 10:return No(t.type._context),Zl(t),null;case 19:if(Dn(aa),null===(n=t.memoizedState))return Zl(t),null;if(r=!!(128&t.flags),null===(o=n.rendering))if(r)Jl(n,!1);else{if(0!==Wh||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=la(e))){for(t.flags|=128,Jl(n,!1),null!==(r=o.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=i,i=t.child;null!==i;)e=r,(n=i).flags&=14680066,null===(o=n.alternate)?(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=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return Bn(aa,1&aa.current|2),t.child}e=e.sibling}null!==n.tail&&si()>Gh&&(t.flags|=128,r=!0,Jl(n,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=la(o))){if(t.flags|=128,r=!0,null!==(i=e.updateQueue)&&(t.updateQueue=i,t.flags|=4),Jl(n,!0),null===n.tail&&"hidden"===n.tailMode&&!o.alternate&&!uo)return Zl(t),null}else 2*si()-n.renderingStartTime>Gh&&1073741824!==i&&(t.flags|=128,r=!0,Jl(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(null!==(i=n.last)?i.sibling=o:t.child=o,n.last=o)}return null!==n.tail?(t=n.tail,n.rendering=t,n.tail=t.sibling,n.renderingStartTime=si(),t.sibling=null,i=aa.current,Bn(aa,r?1&i|2:1&i),t):(Zl(t),null);case 22:case 23:return mc(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&1&t.mode?!!(1073741824&Fh)&&(Zl(t),6&t.subtreeFlags&&(t.flags|=8192)):Zl(t),null;case 24:case 25:return null}throw Error(de(156,t.tag))}function th(e,t){switch(lo(t),t.tag){case 1:return Fn(t.type)&&jn(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return sa(),Dn(In),Dn(Nn),ca(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return oa(t),null;case 13:if(Dn(aa),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(de(340));So()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Dn(aa),null;case 4:return sa(),null;case 10:return No(t.type._context),null;case 22:case 23:return mc(),null;default:return null}}zl=function(e,t){for(var i=t.child;null!==i;){if(5===i.tag||6===i.tag)e.appendChild(i.stateNode);else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},Fl=function(){},jl=function(e,t,i,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,ia(Zo.current);var n,o=null;switch(i){case"input":s=it(e,s),r=it(e,r),o=[];break;case"select":s=Ue({},s,{value:void 0}),r=Ue({},r,{value:void 0}),o=[];break;case"textarea":s=ct(e,s),r=ct(e,r),o=[];break;default:"function"!=typeof s.onClick&&"function"==typeof r.onClick&&(e.onclick=on)}for(h in kt(i,r),i=null,s)if(!r.hasOwnProperty(h)&&s.hasOwnProperty(h)&&null!=s[h])if("style"===h){var a=s[h];for(n in a)a.hasOwnProperty(n)&&(i||(i={}),i[n]="")}else"dangerouslySetInnerHTML"!==h&&"children"!==h&&"suppressContentEditableWarning"!==h&&"suppressHydrationWarning"!==h&&"autoFocus"!==h&&(_e.hasOwnProperty(h)?o||(o=[]):(o=o||[]).push(h,null));for(h in r){var l=r[h];if(a=null!=s?s[h]:void 0,r.hasOwnProperty(h)&&l!==a&&(null!=l||null!=a))if("style"===h)if(a){for(n in a)!a.hasOwnProperty(n)||l&&l.hasOwnProperty(n)||(i||(i={}),i[n]="");for(n in l)l.hasOwnProperty(n)&&a[n]!==l[n]&&(i||(i={}),i[n]=l[n])}else i||(o||(o=[]),o.push(h,i)),i=l;else"dangerouslySetInnerHTML"===h?(l=l?l.__html:void 0,a=a?a.__html:void 0,null!=l&&a!==l&&(o=o||[]).push(h,l)):"children"===h?"string"!=typeof l&&"number"!=typeof l||(o=o||[]).push(h,""+l):"suppressContentEditableWarning"!==h&&"suppressHydrationWarning"!==h&&(_e.hasOwnProperty(h)?(null!=l&&"onScroll"===h&&Ks("scroll",e),o||a===l||(o=[])):(o=o||[]).push(h,l))}i&&(o=o||[]).push("style",i);var h=o;(t.updateQueue=h)&&(t.flags|=4)}},Wl=function(e,t,i,r){i!==r&&(t.flags|=4)};var ih=!1,rh=!1,sh="function"==typeof WeakSet?WeakSet:Set,nh=null;function oh(e,t){var i=e.ref;if(null!==i)if("function"==typeof i)try{i(null)}catch(r){Pc(e,t,r)}else i.current=null}function ah(e,t,i){try{i()}catch(r){Pc(e,t,r)}}var lh=!1;function hh(e,t,i){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var s=r=r.next;do{if((s.tag&e)===e){var n=s.destroy;s.destroy=void 0,void 0!==n&&ah(t,i,n)}s=s.next}while(s!==r)}}function ch(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect: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 uh(e){var t=e.ref;if(null!==t){var i=e.stateNode;e.tag,e=i,"function"==typeof t?t(e):t.current=e}}function dh(e){var t=e.alternate;null!==t&&(e.alternate=null,dh(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[yn],delete t[bn],delete t[wn],delete t[xn],delete t[Cn])),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 fh(e){return 5===e.tag||3===e.tag||4===e.tag}function _h(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||fh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function ph(e,t,i){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===i.nodeType?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(8===i.nodeType?(t=i.parentNode).insertBefore(e,i):(t=i).appendChild(e),null!=(i=i._reactRootContainer)||null!==t.onclick||(t.onclick=on));else if(4!==r&&null!==(e=e.child))for(ph(e,t,i),e=e.sibling;null!==e;)ph(e,t,i),e=e.sibling}function gh(e,t,i){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(4!==r&&null!==(e=e.child))for(gh(e,t,i),e=e.sibling;null!==e;)gh(e,t,i),e=e.sibling}var vh=null,mh=!1;function yh(e,t,i){for(i=i.child;null!==i;)bh(e,t,i),i=i.sibling}function bh(e,t,i){if(di&&"function"==typeof di.onCommitFiberUnmount)try{di.onCommitFiberUnmount(ui,i)}catch(Xm){}switch(i.tag){case 5:rh||oh(i,t);case 6:var r=vh,s=mh;vh=null,yh(e,t,i),mh=s,null!==(vh=r)&&(mh?(e=vh,i=i.stateNode,8===e.nodeType?e.parentNode.removeChild(i):e.removeChild(i)):vh.removeChild(i.stateNode));break;case 18:null!==vh&&(mh?(e=vh,i=i.stateNode,8===e.nodeType?pn(e.parentNode,i):1===e.nodeType&&pn(e,i),Gi(e)):pn(vh,i.stateNode));break;case 4:r=vh,s=mh,vh=i.stateNode.containerInfo,mh=!0,yh(e,t,i),vh=r,mh=s;break;case 0:case 11:case 14:case 15:if(!rh&&(null!==(r=i.updateQueue)&&null!==(r=r.lastEffect))){s=r=r.next;do{var n=s,o=n.destroy;n=n.tag,void 0!==o&&(2&n||4&n)&&ah(i,t,o),s=s.next}while(s!==r)}yh(e,t,i);break;case 1:if(!rh&&(oh(i,t),"function"==typeof(r=i.stateNode).componentWillUnmount))try{r.props=i.memoizedProps,r.state=i.memoizedState,r.componentWillUnmount()}catch(Xm){Pc(i,t,Xm)}yh(e,t,i);break;case 21:yh(e,t,i);break;case 22:1&i.mode?(rh=(r=rh)||null!==i.memoizedState,yh(e,t,i),rh=r):yh(e,t,i);break;default:yh(e,t,i)}}function Sh(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var i=e.stateNode;null===i&&(i=e.stateNode=new sh),t.forEach(function(t){var r=Nc.bind(null,e,t);i.has(t)||(i.add(t),t.then(r,r))})}}function wh(e,t){var i=t.deletions;if(null!==i)for(var r=0;r<i.length;r++){var s=i[r];try{var n=e,o=t,a=o;e:for(;null!==a;){switch(a.tag){case 5:vh=a.stateNode,mh=!1;break e;case 3:case 4:vh=a.stateNode.containerInfo,mh=!0;break e}a=a.return}if(null===vh)throw Error(de(160));bh(n,o,s),vh=null,mh=!1;var l=s.alternate;null!==l&&(l.return=null),s.return=null}catch(_f){Pc(s,t,_f)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)xh(t,e),t=t.sibling}function xh(e,t){var i=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(wh(t,e),Ch(e),4&r){try{hh(3,e,e.return),ch(3,e)}catch(Iy){Pc(e,e.return,Iy)}try{hh(5,e,e.return)}catch(Iy){Pc(e,e.return,Iy)}}break;case 1:wh(t,e),Ch(e),512&r&&null!==i&&oh(i,i.return);break;case 5:if(wh(t,e),Ch(e),512&r&&null!==i&&oh(i,i.return),32&e.flags){var s=e.stateNode;try{yt(s,"")}catch(Iy){Pc(e,e.return,Iy)}}if(4&r&&null!=(s=e.stateNode)){var n=e.memoizedProps,o=null!==i?i.memoizedProps:n,a=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===a&&"radio"===n.type&&null!=n.name&&st(s,n),Lt(a,o);var h=Lt(a,n);for(o=0;o<l.length;o+=2){var c=l[o],u=l[o+1];"style"===c?xt(s,u):"dangerouslySetInnerHTML"===c?mt(s,u):"children"===c?yt(s,u):Le(s,c,u,h)}switch(a){case"input":nt(s,n);break;case"textarea":dt(s,n);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!n.multiple;var f=n.value;null!=f?ht(s,!!n.multiple,f,!1):d!==!!n.multiple&&(null!=n.defaultValue?ht(s,!!n.multiple,n.defaultValue,!0):ht(s,!!n.multiple,n.multiple?[]:"",!1))}s[bn]=n}catch(Iy){Pc(e,e.return,Iy)}}break;case 6:if(wh(t,e),Ch(e),4&r){if(null===e.stateNode)throw Error(de(162));s=e.stateNode,n=e.memoizedProps;try{s.nodeValue=n}catch(Iy){Pc(e,e.return,Iy)}}break;case 3:if(wh(t,e),Ch(e),4&r&&null!==i&&i.memoizedState.isDehydrated)try{Gi(t.containerInfo)}catch(Iy){Pc(e,e.return,Iy)}break;case 4:default:wh(t,e),Ch(e);break;case 13:wh(t,e),Ch(e),8192&(s=e.child).flags&&(n=null!==s.memoizedState,s.stateNode.isHidden=n,!n||null!==s.alternate&&null!==s.alternate.memoizedState||(Yh=si())),4&r&&Sh(e);break;case 22:if(c=null!==i&&null!==i.memoizedState,1&e.mode?(rh=(h=rh)||c,wh(t,e),rh=h):wh(t,e),Ch(e),8192&r){if(h=null!==e.memoizedState,(e.stateNode.isHidden=h)&&!c&&1&e.mode)for(nh=e,c=e.child;null!==c;){for(u=nh=c;null!==nh;){switch(f=(d=nh).child,d.tag){case 0:case 11:case 14:case 15:hh(4,d,d.return);break;case 1:oh(d,d.return);var _=d.stateNode;if("function"==typeof _.componentWillUnmount){r=d,i=d.return;try{t=r,_.props=t.memoizedProps,_.state=t.memoizedState,_.componentWillUnmount()}catch(Iy){Pc(r,i,Iy)}}break;case 5:oh(d,d.return);break;case 22:if(null!==d.memoizedState){Mh(u);continue}}null!==f?(f.return=d,nh=f):Mh(u)}c=c.sibling}e:for(c=null,u=e;;){if(5===u.tag){if(null===c){c=u;try{s=u.stateNode,h?"function"==typeof(n=s.style).setProperty?n.setProperty("display","none","important"):n.display="none":(a=u.stateNode,o=null!=(l=u.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,a.style.display=wt("display",o))}catch(Iy){Pc(e,e.return,Iy)}}}else if(6===u.tag){if(null===c)try{u.stateNode.nodeValue=h?"":u.memoizedProps}catch(Iy){Pc(e,e.return,Iy)}}else if((22!==u.tag&&23!==u.tag||null===u.memoizedState||u===e)&&null!==u.child){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;null===u.sibling;){if(null===u.return||u.return===e)break e;c===u&&(c=null),u=u.return}c===u&&(c=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:wh(t,e),Ch(e),4&r&&Sh(e);case 21:}}function Ch(e){var t=e.flags;if(2&t){try{e:{for(var i=e.return;null!==i;){if(fh(i)){var r=i;break e}i=i.return}throw Error(de(160))}switch(r.tag){case 5:var s=r.stateNode;32&r.flags&&(yt(s,""),r.flags&=-33),gh(e,_h(e),s);break;case 3:case 4:var n=r.stateNode.containerInfo;ph(e,_h(e),n);break;default:throw Error(de(161))}}catch(o){Pc(e,e.return,o)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function kh(e,t,i){nh=e,Lh(e)}function Lh(e,t,i){for(var r=!!(1&e.mode);null!==nh;){var s=nh,n=s.child;if(22===s.tag&&r){var o=null!==s.memoizedState||ih;if(!o){var a=s.alternate,l=null!==a&&null!==a.memoizedState||rh;a=ih;var h=rh;if(ih=o,(rh=l)&&!h)for(nh=s;null!==nh;)l=(o=nh).child,22===o.tag&&null!==o.memoizedState?Rh(s):null!==l?(l.return=o,nh=l):Rh(s);for(;null!==n;)nh=n,Lh(n),n=n.sibling;nh=s,ih=a,rh=h}Eh(e)}else 8772&s.subtreeFlags&&null!==n?(n.return=s,nh=n):Eh(e)}}function Eh(e){for(;null!==nh;){var t=nh;if(8772&t.flags){var i=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:rh||ch(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!rh)if(null===i)r.componentDidMount();else{var s=t.elementType===t.type?i.memoizedProps:hl(t.type,i.memoizedProps);r.componentDidUpdate(s,i.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var n=t.updateQueue;null!==n&&Qo(t,n,r);break;case 3:var o=t.updateQueue;if(null!==o){if(i=null,null!==t.child)switch(t.child.tag){case 5:case 1:i=t.child.stateNode}Qo(t,o,i)}break;case 5:var a=t.stateNode;if(null===i&&4&t.flags){i=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break;case"img":l.src&&(i.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var h=t.alternate;if(null!==h){var c=h.memoizedState;if(null!==c){var u=c.dehydrated;null!==u&&Gi(u)}}}break;default:throw Error(de(163))}rh||512&t.flags&&uh(t)}catch(mw){Pc(t,t.return,mw)}}if(t===e){nh=null;break}if(null!==(i=t.sibling)){i.return=t.return,nh=i;break}nh=t.return}}function Mh(e){for(;null!==nh;){var t=nh;if(t===e){nh=null;break}var i=t.sibling;if(null!==i){i.return=t.return,nh=i;break}nh=t.return}}function Rh(e){for(;null!==nh;){var t=nh;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{ch(4,t)}catch(l){Pc(t,i,l)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var s=t.return;try{r.componentDidMount()}catch(l){Pc(t,s,l)}}var n=t.return;try{uh(t)}catch(l){Pc(t,n,l)}break;case 5:var o=t.return;try{uh(t)}catch(l){Pc(t,o,l)}}}catch(l){Pc(t,t.return,l)}if(t===e){nh=null;break}var a=t.sibling;if(null!==a){a.return=t.return,nh=a;break}nh=t.return}}var Th,Ph=Math.ceil,Dh=Ee.ReactCurrentDispatcher,Bh=Ee.ReactCurrentOwner,Ah=Ee.ReactCurrentBatchConfig,Nh=0,Ih=null,Oh=null,zh=0,Fh=0,jh=Pn(0),Wh=0,Hh=null,$h=0,Uh=0,Kh=0,qh=null,Vh=null,Yh=0,Gh=1/0,Xh=null,Qh=!1,Jh=null,Zh=null,ec=!1,tc=null,ic=0,rc=0,sc=null,nc=-1,oc=0;function ac(){return 6&Nh?si():-1!==nc?nc:nc=si()}function lc(e){return 1&e.mode?2&Nh&&0!==zh?zh&-zh:null!==xo.transition?(0===oc&&(oc=wi()),oc):0!==(e=Li)?e:e=void 0===(e=window.event)?16:rr(e.type):1}function hc(e,t,i,r){if(50<rc)throw rc=0,sc=null,Error(de(185));Ci(e,i,r),2&Nh&&e===Ih||(e===Ih&&(!(2&Nh)&&(Uh|=i),4===Wh&&_c(e,zh)),cc(e,r),1===i&&0===Nh&&!(1&t.mode)&&(Gh=si()+500,qn&&Gn()))}function cc(e,t){var i=e.callbackNode;!function(e,t){for(var i=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,n=e.pendingLanes;0<n;){var o=31-fi(n),a=1<<o,l=s[o];-1===l?0!==(a&i)&&0===(a&r)||(s[o]=bi(a,t)):l<=t&&(e.expiredLanes|=a),n&=~a}}(e,t);var r=yi(e,e===Ih?zh:0);if(0===r)null!==i&&ti(i),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=i&&ti(i),1===t)0===e.tag?function(e){qn=!0,Yn(e)}(pc.bind(null,e)):Yn(pc.bind(null,e)),fn(function(){!(6&Nh)&&Gn()}),i=null;else{switch(Ei(r)){case 1:i=oi;break;case 4:i=ai;break;case 16:default:i=li;break;case 536870912:i=ci}i=Ic(i,uc.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function uc(e,t){if(nc=-1,oc=0,6&Nh)throw Error(de(327));var i=e.callbackNode;if(Rc()&&e.callbackNode!==i)return null;var r=yi(e,e===Ih?zh:0);if(0===r)return null;if(30&r||0!==(r&e.expiredLanes)||t)t=xc(e,r);else{t=r;var s=Nh;Nh|=2;var n=Sc();for(Ih===e&&zh===t||(Xh=null,Gh=si()+500,yc(e,t));;)try{kc();break}catch(Xm){bc(e,Xm)}Ao(),Dh.current=n,Nh=s,null!==Oh?t=0:(Ih=null,zh=0,t=Wh)}if(0!==t){if(2===t&&(0!==(s=Si(e))&&(r=s,t=dc(e,s))),1===t)throw i=Hh,yc(e,0),_c(e,r),cc(e,si()),i;if(6===t)_c(e,r);else{if(s=e.current.alternate,!(30&r||function(e){for(var t=e;;){if(16384&t.flags){var i=t.updateQueue;if(null!==i&&null!==(i=i.stores))for(var r=0;r<i.length;r++){var s=i[r],n=s.getSnapshot;s=s.value;try{if(!fs(n(),s))return!1}catch(o){return!1}}}if(i=t.child,16384&t.subtreeFlags&&null!==i)i.return=t,t=i;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(s)||(t=xc(e,r),2===t&&(n=Si(e),0!==n&&(r=n,t=dc(e,n))),1!==t)))throw i=Hh,yc(e,0),_c(e,r),cc(e,si()),i;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(de(345));case 2:case 5:Mc(e,Vh,Xh);break;case 3:if(_c(e,r),(130023424&r)===r&&10<(t=Yh+500-si())){if(0!==yi(e,0))break;if(((s=e.suspendedLanes)&r)!==r){ac(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=cn(Mc.bind(null,e,Vh,Xh),t);break}Mc(e,Vh,Xh);break;case 4:if(_c(e,r),(4194240&r)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-fi(r);n=1<<o,(o=t[o])>s&&(s=o),r&=~n}if(r=s,10<(r=(120>(r=si()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ph(r/1960))-r)){e.timeoutHandle=cn(Mc.bind(null,e,Vh,Xh),r);break}Mc(e,Vh,Xh);break;default:throw Error(de(329))}}}return cc(e,si()),e.callbackNode===i?uc.bind(null,e):null}function dc(e,t){var i=qh;return e.current.memoizedState.isDehydrated&&(yc(e,t).flags|=256),2!==(e=xc(e,t))&&(t=Vh,Vh=i,null!==t&&fc(t)),e}function fc(e){null===Vh?Vh=e:Vh.push.apply(Vh,e)}function _c(e,t){for(t&=~Kh,t&=~Uh,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-fi(t),r=1<<i;e[i]=-1,t&=~r}}function pc(e){if(6&Nh)throw Error(de(327));Rc();var t=yi(e,0);if(!(1&t))return cc(e,si()),null;var i=xc(e,t);if(0!==e.tag&&2===i){var r=Si(e);0!==r&&(t=r,i=dc(e,r))}if(1===i)throw i=Hh,yc(e,0),_c(e,t),cc(e,si()),i;if(6===i)throw Error(de(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Mc(e,Vh,Xh),cc(e,si()),null}function gc(e,t){var i=Nh;Nh|=1;try{return e(t)}finally{0===(Nh=i)&&(Gh=si()+500,qn&&Gn())}}function vc(e){null!==tc&&0===tc.tag&&!(6&Nh)&&Rc();var t=Nh;Nh|=1;var i=Ah.transition,r=Li;try{if(Ah.transition=null,Li=1,e)return e()}finally{Li=r,Ah.transition=i,!(6&(Nh=t))&&Gn()}}function mc(){Fh=jh.current,Dn(jh)}function yc(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(-1!==i&&(e.timeoutHandle=-1,un(i)),null!==Oh)for(i=Oh.return;null!==i;){var r=i;switch(lo(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&jn();break;case 3:sa(),Dn(In),Dn(Nn),ca();break;case 5:oa(r);break;case 4:sa();break;case 13:case 19:Dn(aa);break;case 10:No(r.type._context);break;case 22:case 23:mc()}i=i.return}if(Ih=e,Oh=e=jc(e.current,null),zh=Fh=t,Wh=0,Hh=null,Kh=Uh=$h=0,Vh=qh=null,null!==Fo){for(t=0;t<Fo.length;t++)if(null!==(r=(i=Fo[t]).interleaved)){i.interleaved=null;var s=r.next,n=i.pending;if(null!==n){var o=n.next;n.next=s,r.next=o}i.pending=r}Fo=null}return e}function bc(e,t){for(;;){var i=Oh;try{if(Ao(),ua.current=nl,va){for(var r=_a.memoizedState;null!==r;){var s=r.queue;null!==s&&(s.pending=null),r=r.next}va=!1}if(fa=0,ga=pa=_a=null,ma=!1,ya=0,Bh.current=null,null===i||null===i.return){Wh=1,Hh=t,Oh=null;break}e:{var n=e,o=i.return,a=i,l=t;if(t=zh,a.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var h=l,c=a,u=c.tag;if(!(1&c.mode||0!==u&&11!==u&&15!==u)){var d=c.alternate;d?(c.updateQueue=d.updateQueue,c.memoizedState=d.memoizedState,c.lanes=d.lanes):(c.updateQueue=null,c.memoizedState=null)}var f=xl(o);if(null!==f){f.flags&=-257,Cl(f,o,a,0,t),1&f.mode&&wl(n,h,t),l=h;var _=(t=f).updateQueue;if(null===_){var p=new Set;p.add(l),t.updateQueue=p}else _.add(l);break e}if(!(1&t)){wl(n,h,t),wc();break e}l=Error(de(426))}else if(uo&&1&a.mode){var g=xl(o);if(null!==g){!(65536&g.flags)&&(g.flags|=256),Cl(g,o,a,0,t),wo(gl(l,a));break e}}n=l=gl(l,a),4!==Wh&&(Wh=2),null===qh?qh=[n]:qh.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,t&=-t,n.lanes|=t,Go(n,bl(0,l,t));break e;case 1:a=l;var v=n.type,m=n.stateNode;if(!(128&n.flags||"function"!=typeof v.getDerivedStateFromError&&(null===m||"function"!=typeof m.componentDidCatch||null!==Zh&&Zh.has(m)))){n.flags|=65536,t&=-t,n.lanes|=t,Go(n,Sl(n,a,t));break e}}n=n.return}while(null!==n)}Ec(i)}catch(y){t=y,Oh===i&&null!==i&&(Oh=i=i.return);continue}break}}function Sc(){var e=Dh.current;return Dh.current=nl,null===e?nl:e}function wc(){0!==Wh&&3!==Wh&&2!==Wh||(Wh=4),null===Ih||!(268435455&$h)&&!(268435455&Uh)||_c(Ih,zh)}function xc(e,t){var i=Nh;Nh|=2;var r=Sc();for(Ih===e&&zh===t||(Xh=null,yc(e,t));;)try{Cc();break}catch(F_){bc(e,F_)}if(Ao(),Nh=i,Dh.current=r,null!==Oh)throw Error(de(261));return Ih=null,zh=0,Wh}function Cc(){for(;null!==Oh;)Lc(Oh)}function kc(){for(;null!==Oh&&!ii();)Lc(Oh)}function Lc(e){var t=Th(e.alternate,e,Fh);e.memoizedProps=e.pendingProps,null===t?Ec(e):Oh=t,Bh.current=null}function Ec(e){var t=e;do{var i=t.alternate;if(e=t.return,32768&t.flags){if(null!==(i=th(i,t)))return i.flags&=32767,void(Oh=i);if(null===e)return Wh=6,void(Oh=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(i=eh(i,t,Fh)))return void(Oh=i);if(null!==(t=t.sibling))return void(Oh=t);Oh=t=e}while(null!==t);0===Wh&&(Wh=5)}function Mc(e,t,i){var r=Li,s=Ah.transition;try{Ah.transition=null,Li=1,function(e,t,i,r){do{Rc()}while(null!==tc);if(6&Nh)throw Error(de(327));i=e.finishedWork;var s=e.finishedLanes;if(null===i)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(de(177));e.callbackNode=null,e.callbackPriority=0;var n=i.lanes|i.childLanes;if(function(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-fi(i),n=1<<s;t[s]=0,r[s]=-1,e[s]=-1,i&=~n}}(e,n),e===Ih&&(Oh=Ih=null,zh=0),!(2064&i.subtreeFlags)&&!(2064&i.flags)||ec||(ec=!0,Ic(li,function(){return Rc(),null})),n=!!(15990&i.flags),!!(15990&i.subtreeFlags)||n){n=Ah.transition,Ah.transition=null;var o=Li;Li=1;var a=Nh;Nh|=4,Bh.current=null,function(e,t){if(an=Qi,ys(e=ms())){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(i=(i=e.ownerDocument)&&i.defaultView||window).getSelection&&i.getSelection();if(r&&0!==r.rangeCount){i=r.anchorNode;var s=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{i.nodeType,n.nodeType}catch(b){i=null;break e}var o=0,a=-1,l=-1,h=0,c=0,u=e,d=null;t:for(;;){for(var f;u!==i||0!==s&&3!==u.nodeType||(a=o+s),u!==n||0!==r&&3!==u.nodeType||(l=o+r),3===u.nodeType&&(o+=u.nodeValue.length),null!==(f=u.firstChild);)d=u,u=f;for(;;){if(u===e)break t;if(d===i&&++h===s&&(a=o),d===n&&++c===r&&(l=o),null!==(f=u.nextSibling))break;d=(u=d).parentNode}u=f}i=-1===a||-1===l?null:{start:a,end:l}}else i=null}i=i||{start:0,end:0}}else i=null;for(ln={focusedElem:e,selectionRange:i},Qi=!1,nh=t;null!==nh;)if(e=(t=nh).child,1028&t.subtreeFlags&&null!==e)e.return=t,nh=e;else for(;null!==nh;){t=nh;try{var _=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==_){var p=_.memoizedProps,g=_.memoizedState,v=t.stateNode,m=v.getSnapshotBeforeUpdate(t.elementType===t.type?p:hl(t.type,p),g);v.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var y=t.stateNode.containerInfo;1===y.nodeType?y.textContent="":9===y.nodeType&&y.documentElement&&y.removeChild(y.documentElement);break;default:throw Error(de(163))}}catch(b){Pc(t,t.return,b)}if(null!==(e=t.sibling)){e.return=t.return,nh=e;break}nh=t.return}_=lh,lh=!1}(e,i),xh(i,e),bs(ln),Qi=!!an,ln=an=null,e.current=i,kh(i),ri(),Nh=a,Li=o,Ah.transition=n}else e.current=i;if(ec&&(ec=!1,tc=e,ic=s),n=e.pendingLanes,0===n&&(Zh=null),function(e){if(di&&"function"==typeof di.onCommitFiberRoot)try{di.onCommitFiberRoot(ui,e,void 0,!(128&~e.current.flags))}catch(t){}}(i.stateNode),cc(e,si()),null!==t)for(r=e.onRecoverableError,i=0;i<t.length;i++)s=t[i],r(s.value,{componentStack:s.stack,digest:s.digest});if(Qh)throw Qh=!1,e=Jh,Jh=null,e;!!(1&ic)&&0!==e.tag&&Rc(),n=e.pendingLanes,1&n?e===sc?rc++:(rc=0,sc=e):rc=0,Gn()}(e,t,i,r)}finally{Ah.transition=s,Li=r}return null}function Rc(){if(null!==tc){var e=Ei(ic),t=Ah.transition,i=Li;try{if(Ah.transition=null,Li=16>e?16:e,null===tc)var r=!1;else{if(e=tc,tc=null,ic=0,6&Nh)throw Error(de(331));var s=Nh;for(Nh|=4,nh=e.current;null!==nh;){var n=nh,o=n.child;if(16&nh.flags){var a=n.deletions;if(null!==a){for(var l=0;l<a.length;l++){var h=a[l];for(nh=h;null!==nh;){var c=nh;switch(c.tag){case 0:case 11:case 15:hh(8,c,n)}var u=c.child;if(null!==u)u.return=c,nh=u;else for(;null!==nh;){var d=(c=nh).sibling,f=c.return;if(dh(c),c===h){nh=null;break}if(null!==d){d.return=f,nh=d;break}nh=f}}}var _=n.alternate;if(null!==_){var p=_.child;if(null!==p){_.child=null;do{var g=p.sibling;p.sibling=null,p=g}while(null!==p)}}nh=n}}if(2064&n.subtreeFlags&&null!==o)o.return=n,nh=o;else e:for(;null!==nh;){if(2048&(n=nh).flags)switch(n.tag){case 0:case 11:case 15:hh(9,n,n.return)}var v=n.sibling;if(null!==v){v.return=n.return,nh=v;break e}nh=n.return}}var m=e.current;for(nh=m;null!==nh;){var y=(o=nh).child;if(2064&o.subtreeFlags&&null!==y)y.return=o,nh=y;else e:for(o=m;null!==nh;){if(2048&(a=nh).flags)try{switch(a.tag){case 0:case 11:case 15:ch(9,a)}}catch(S){Pc(a,a.return,S)}if(a===o){nh=null;break e}var b=a.sibling;if(null!==b){b.return=a.return,nh=b;break e}nh=a.return}}if(Nh=s,Gn(),di&&"function"==typeof di.onPostCommitFiberRoot)try{di.onPostCommitFiberRoot(ui,e)}catch(S){}r=!0}return r}finally{Li=i,Ah.transition=t}}return!1}function Tc(e,t,i){e=Vo(e,t=bl(0,t=gl(i,t),1),1),t=ac(),null!==e&&(Ci(e,1,t),cc(e,t))}function Pc(e,t,i){if(3===e.tag)Tc(e,e,i);else for(;null!==t;){if(3===t.tag){Tc(t,e,i);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Zh||!Zh.has(r))){t=Vo(t,e=Sl(t,e=gl(i,e),1),1),e=ac(),null!==t&&(Ci(t,1,e),cc(t,e));break}}t=t.return}}function Dc(e,t,i){var r=e.pingCache;null!==r&&r.delete(t),t=ac(),e.pingedLanes|=e.suspendedLanes&i,Ih===e&&(zh&i)===i&&(4===Wh||3===Wh&&(130023424&zh)===zh&&500>si()-Yh?yc(e,0):Kh|=i),cc(e,t)}function Bc(e,t){0===t&&(1&e.mode?(t=vi,!(130023424&(vi<<=1))&&(vi=4194304)):t=1);var i=ac();null!==(e=Ho(e,t))&&(Ci(e,t,i),cc(e,i))}function Ac(e){var t=e.memoizedState,i=0;null!==t&&(i=t.retryLane),Bc(e,i)}function Nc(e,t){var i=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;null!==s&&(i=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(de(314))}null!==r&&r.delete(t),Bc(e,i)}function Ic(e,t){return ei(e,t)}function Oc(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 zc(e,t,i,r){return new Oc(e,t,i,r)}function Fc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function jc(e,t){var i=e.alternate;return null===i?((i=zc(e.tag,t,e.key,e.mode)).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=14680064&e.flags,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=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Wc(e,t,i,r,s,n){var o=2;if(r=e,"function"==typeof e)Fc(e)&&(o=1);else if("string"==typeof e)o=5;else e:switch(e){case Te:return Hc(i.children,s,n,t);case Pe:o=8,s|=8;break;case De:return(e=zc(12,i,t,2|s)).elementType=De,e.lanes=n,e;case Ie:return(e=zc(13,i,t,s)).elementType=Ie,e.lanes=n,e;case Oe:return(e=zc(19,i,t,s)).elementType=Oe,e.lanes=n,e;case je:return $c(i,s,n,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case Be:o=10;break e;case Ae:o=9;break e;case Ne:o=11;break e;case ze:o=14;break e;case Fe:o=16,r=null;break e}throw Error(de(130,null==e?e:typeof e,""))}return(t=zc(o,i,t,s)).elementType=e,t.type=r,t.lanes=n,t}function Hc(e,t,i,r){return(e=zc(7,e,r,t)).lanes=i,e}function $c(e,t,i,r){return(e=zc(22,e,r,t)).elementType=je,e.lanes=i,e.stateNode={isHidden:!1},e}function Uc(e,t,i){return(e=zc(6,e,null,t)).lanes=i,e}function Kc(e,t,i){return(t=zc(4,null!==e.children?e.children:[],e.key,t)).lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function qc(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=xi(0),this.expirationTimes=xi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xi(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Vc(e,t,i,r,s,n,o,a,l){return e=new qc(e,t,i,a,l),1===t?(t=1,!0===n&&(t|=8)):t=0,n=zc(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:r,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Uo(n),e}function Yc(e){if(!e)return An;e:{if(Gt(e=e._reactInternals)!==e||1!==e.tag)throw Error(de(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Fn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(de(171))}if(1===e.tag){var i=e.type;if(Fn(i))return Hn(e,i,t)}return t}function Gc(e,t,i,r,s,n,o,a,l){return(e=Vc(i,r,!0,e,0,n,0,a,l)).context=Yc(null),i=e.current,(n=qo(r=ac(),s=lc(i))).callback=null!=t?t:null,Vo(i,n,s),e.current.lanes=s,Ci(e,s,r),cc(e,r),e}function Xc(e,t,i,r){var s=t.current,n=ac(),o=lc(s);return i=Yc(i),null===t.context?t.context=i:t.pendingContext=i,(t=qo(n,o)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Vo(s,t,o))&&(hc(e,s,o,n),Yo(e,s,o)),o}function Qc(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Jc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var i=e.retryLane;e.retryLane=0!==i&&i<t?i:t}}function Zc(e,t){Jc(e,t),(e=e.alternate)&&Jc(e,t)}Th=function(e,t,i){if(null!==e)if(e.memoizedProps!==t.pendingProps||In.current)Ll=!0;else{if(0===(e.lanes&i)&&!(128&t.flags))return Ll=!1,function(e,t,i){switch(t.tag){case 3:Il(t),So();break;case 5:na(t);break;case 1:Fn(t.type)&&$n(t);break;case 4:ra(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Bn(To,r._currentValue),r._currentValue=s;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(Bn(aa,1&aa.current),t.flags|=128,null):0!==(i&t.child.childLanes)?Ul(e,t,i):(Bn(aa,1&aa.current),null!==(e=Ql(e,t,i))?e.sibling:null);Bn(aa,1&aa.current);break;case 19:if(r=0!==(i&t.childLanes),128&e.flags){if(r)return Gl(e,t,i);t.flags|=128}if(null!==(s=t.memoizedState)&&(s.rendering=null,s.tail=null,s.lastEffect=null),Bn(aa,aa.current),r)break;return null;case 22:case 23:return t.lanes=0,Pl(e,t,i)}return Ql(e,t,i)}(e,t,i);Ll=!!(131072&e.flags)}else Ll=!1,uo&&1048576&t.flags&&oo(t,Zn,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Xl(e,t),e=t.pendingProps;var s=zn(t,Nn.current);Oo(t,i),s=xa(null,t,r,e,s,i);var n=Ca();return t.flags|=1,"object"==typeof s&&null!==s&&"function"==typeof s.render&&void 0===s.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Fn(r)?(n=!0,$n(t)):n=!1,t.memoizedState=null!==s.state&&void 0!==s.state?s.state:null,Uo(t),s.updater=ul,t.stateNode=s,s._reactInternals=t,pl(t,r,e,i),t=Nl(null,t,r,!0,n,i)):(t.tag=0,uo&&n&&ao(t),El(null,t,s,i),t=t.child),t;case 16:r=t.elementType;e:{switch(Xl(e,t),e=t.pendingProps,r=(s=r._init)(r._payload),t.type=r,s=t.tag=function(e){if("function"==typeof e)return Fc(e)?1:0;if(null!=e){if((e=e.$$typeof)===Ne)return 11;if(e===ze)return 14}return 2}(r),e=hl(r,e),s){case 0:t=Bl(null,t,r,e,i);break e;case 1:t=Al(null,t,r,e,i);break e;case 11:t=Ml(null,t,r,e,i);break e;case 14:t=Rl(null,t,r,hl(r.type,e),i);break e}throw Error(de(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,Bl(e,t,r,s=t.elementType===r?s:hl(r,s),i);case 1:return r=t.type,s=t.pendingProps,Al(e,t,r,s=t.elementType===r?s:hl(r,s),i);case 3:e:{if(Il(t),null===e)throw Error(de(387));r=t.pendingProps,s=(n=t.memoizedState).element,Ko(e,t),Xo(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,256&t.flags){t=Ol(e,t,r,i,s=gl(Error(de(423)),t));break e}if(r!==s){t=Ol(e,t,r,i,s=gl(Error(de(424)),t));break e}for(co=gn(t.stateNode.containerInfo.firstChild),ho=t,uo=!0,fo=null,i=Ro(t,null,r,i),t.child=i;i;)i.flags=-3&i.flags|4096,i=i.sibling}else{if(So(),r===s){t=Ql(e,t,i);break e}El(e,t,r,i)}t=t.child}return t;case 5:return na(t),null===e&&vo(t),r=t.type,s=t.pendingProps,n=null!==e?e.memoizedProps:null,o=s.children,hn(r,s)?o=null:null!==n&&hn(r,n)&&(t.flags|=32),Dl(e,t),El(e,t,o,i),t.child;case 6:return null===e&&vo(t),null;case 13:return Ul(e,t,i);case 4:return ra(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Mo(t,null,r,i):El(e,t,r,i),t.child;case 11:return r=t.type,s=t.pendingProps,Ml(e,t,r,s=t.elementType===r?s:hl(r,s),i);case 7:return El(e,t,t.pendingProps,i),t.child;case 8:case 12:return El(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,Bn(To,r._currentValue),r._currentValue=o,null!==n)if(fs(n.value,o)){if(n.children===s.children&&!In.current){t=Ql(e,t,i);break e}}else for(null!==(n=t.child)&&(n.return=t);null!==n;){var a=n.dependencies;if(null!==a){o=n.child;for(var l=a.firstContext;null!==l;){if(l.context===r){if(1===n.tag){(l=qo(-1,i&-i)).tag=2;var h=n.updateQueue;if(null!==h){var c=(h=h.shared).pending;null===c?l.next=l:(l.next=c.next,c.next=l),h.pending=l}}n.lanes|=i,null!==(l=n.alternate)&&(l.lanes|=i),Io(n.return,i,t),a.lanes|=i;break}l=l.next}}else if(10===n.tag)o=n.type===t.type?null:n.child;else if(18===n.tag){if(null===(o=n.return))throw Error(de(341));o.lanes|=i,null!==(a=o.alternate)&&(a.lanes|=i),Io(o,i,t),o=n.sibling}else o=n.child;if(null!==o)o.return=n;else for(o=n;null!==o;){if(o===t){o=null;break}if(null!==(n=o.sibling)){n.return=o.return,o=n;break}o=o.return}n=o}El(e,t,s.children,i),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Oo(t,i),r=r(s=zo(s)),t.flags|=1,El(e,t,r,i),t.child;case 14:return s=hl(r=t.type,t.pendingProps),Rl(e,t,r,s=hl(r.type,s),i);case 15:return Tl(e,t,t.type,t.pendingProps,i);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:hl(r,s),Xl(e,t),t.tag=1,Fn(r)?(e=!0,$n(t)):e=!1,Oo(t,i),fl(t,r,s),pl(t,r,s,i),Nl(null,t,r,!0,e,i);case 19:return Gl(e,t,i);case 22:return Pl(e,t,i)}throw Error(de(156,t.tag))};var eu="function"==typeof reportError?reportError:function(e){console.error(e)};function tu(e){this._internalRoot=e}function iu(e){this._internalRoot=e}function ru(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function su(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function nu(){}function ou(e,t,i,r,s){var n=i._reactRootContainer;if(n){var o=n;if("function"==typeof s){var a=s;s=function(){var e=Qc(o);a.call(e)}}Xc(t,o,e,s)}else o=function(e,t,i,r,s){if(s){if("function"==typeof r){var n=r;r=function(){var e=Qc(o);n.call(e)}}var o=Gc(t,r,e,0,null,!1,0,"",nu);return e._reactRootContainer=o,e[Sn]=o.current,Ys(8===e.nodeType?e.parentNode:e),vc(),o}for(;s=e.lastChild;)e.removeChild(s);if("function"==typeof r){var a=r;r=function(){var e=Qc(l);a.call(e)}}var l=Vc(e,0,!1,null,0,!1,0,"",nu);return e._reactRootContainer=l,e[Sn]=l.current,Ys(8===e.nodeType?e.parentNode:e),vc(function(){Xc(t,l,i,r)}),l}(i,t,e,s,r);return Qc(o)}iu.prototype.render=tu.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(de(409));Xc(e,t,null,null)},iu.prototype.unmount=tu.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;vc(function(){Xc(null,e,null,null)}),t[Sn]=null}},iu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Pi();e={blockedOn:null,target:e,priority:t};for(var i=0;i<ji.length&&0!==t&&t<ji[i].priority;i++);ji.splice(i,0,e),0===i&&Ui(e)}},Mi=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=mi(t.pendingLanes);0!==i&&(ki(t,1|i),cc(t,si()),!(6&Nh)&&(Gh=si()+500,Gn()))}break;case 13:vc(function(){var t=Ho(e,1);if(null!==t){var i=ac();hc(t,e,1,i)}}),Zc(e,1)}},Ri=function(e){if(13===e.tag){var t=Ho(e,134217728);if(null!==t)hc(t,e,134217728,ac());Zc(e,134217728)}},Ti=function(e){if(13===e.tag){var t=lc(e),i=Ho(e,t);if(null!==i)hc(i,e,t,ac());Zc(e,t)}},Pi=function(){return Li},Di=function(e,t){var i=Li;try{return Li=e,t()}finally{Li=i}},Rt=function(e,t,i){switch(t){case"input":if(nt(e,i),t=i.name,"radio"===i.type&&null!=t){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=Mn(r);if(!s)throw Error(de(90));et(r),nt(r,s)}}}break;case"textarea":dt(e,i);break;case"select":null!=(t=i.value)&&ht(e,!!i.multiple,t,!1)}},Nt=gc,It=vc;var au={usingClientEntryPoint:!1,Events:[Ln,En,Mn,Bt,At,gc]},lu={findFiberByHostInstance:kn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hu={bundleType:lu.bundleType,version:lu.version,rendererPackageName:lu.rendererPackageName,rendererConfig:lu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ee.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Jt(e))?null:e.stateNode},findFiberByHostInstance:lu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var cu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cu.isDisabled&&cu.supportsFiber)try{ui=cu.inject(hu),di=cu}catch(vt){}}oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=au,oe.createPortal=function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!ru(t))throw Error(de(200));return function(e,t,i){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:Re,key:null==r?null:""+r,children:e,containerInfo:t,implementation:i}}(e,t,null,i)},oe.createRoot=function(e,t){if(!ru(e))throw Error(de(299));var i=!1,r="",s=eu;return null!=t&&(!0===t.unstable_strictMode&&(i=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(s=t.onRecoverableError)),t=Vc(e,1,!1,null,0,i,0,r,s),e[Sn]=t.current,Ys(8===e.nodeType?e.parentNode:e),new tu(t)},oe.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(de(188));throw e=Object.keys(e).join(","),Error(de(268,e))}return e=null===(e=Jt(t))?null:e.stateNode},oe.flushSync=function(e){return vc(e)},oe.hydrate=function(e,t,i){if(!su(t))throw Error(de(200));return ou(null,e,t,!0,i)},oe.hydrateRoot=function(e,t,i){if(!ru(e))throw Error(de(405));var r=null!=i&&i.hydratedSources||null,s=!1,n="",o=eu;if(null!=i&&(!0===i.unstable_strictMode&&(s=!0),void 0!==i.identifierPrefix&&(n=i.identifierPrefix),void 0!==i.onRecoverableError&&(o=i.onRecoverableError)),t=Gc(t,null,e,1,null!=i?i:null,s,0,n,o),e[Sn]=t.current,Ys(e),r)for(e=0;e<r.length;e++)s=(s=(i=r[e])._getVersion)(i._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[i,s]:t.mutableSourceEagerHydrationData.push(i,s);return new iu(t)},oe.render=function(e,t,i){if(!su(t))throw Error(de(200));return ou(null,e,t,!1,i)},oe.unmountComponentAtNode=function(e){if(!su(e))throw Error(de(40));return!!e._reactRootContainer&&(vc(function(){ou(null,null,e,!1,function(){e._reactRootContainer=null,e[Sn]=null})}),!0)},oe.unstable_batchedUpdates=gc,oe.unstable_renderSubtreeIntoContainer=function(e,t,i,r){if(!su(i))throw Error(de(200));if(null==e||void 0===e._reactInternals)throw Error(de(38));return ou(e,t,i,!1,r)},oe.version="18.3.1-next-f1338f8080-20240426",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),ne.exports=oe;var uu=ne.exports;se.createRoot=uu.createRoot,se.hydrateRoot=uu.hydrateRoot;const du={},fu=e=>{let t;const i=new Set,r=(e,r)=>{const s="function"==typeof e?e(t):e;if(!Object.is(s,t)){const e=t;t=(null!=r?r:"object"!=typeof s||null===s)?s:Object.assign({},t,s),i.forEach(i=>i(t,e))}},s=()=>t,n={setState:r,getState:s,getInitialState:()=>o,subscribe:e=>(i.add(e),()=>i.delete(e)),destroy:()=>{"production"!==(du?"production":void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},o=t=e(r,s,n);return n};var _u={exports:{}},pu={},gu={exports:{}},vu={},mu=Y;var yu="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},bu=mu.useState,Su=mu.useEffect,wu=mu.useLayoutEffect,xu=mu.useDebugValue;function Cu(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!yu(e,i)}catch(r){return!0}}var ku="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var i=t(),r=bu({inst:{value:i,getSnapshot:t}}),s=r[0].inst,n=r[1];return wu(function(){s.value=i,s.getSnapshot=t,Cu(s)&&n({inst:s})},[e,i,t]),Su(function(){return Cu(s)&&n({inst:s}),e(function(){Cu(s)&&n({inst:s})})},[e]),xu(i),i};vu.useSyncExternalStore=void 0!==mu.useSyncExternalStore?mu.useSyncExternalStore:ku,gu.exports=vu;var Lu=gu.exports,Eu=Y,Mu=Lu;
30
+ /**
31
+ * @license React
32
+ * use-sync-external-store-shim/with-selector.production.js
33
+ *
34
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */var Ru="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Tu=Mu.useSyncExternalStore,Pu=Eu.useRef,Du=Eu.useEffect,Bu=Eu.useMemo,Au=Eu.useDebugValue;pu.useSyncExternalStoreWithSelector=function(e,t,i,r,s){var n=Pu(null);if(null===n.current){var o={hasValue:!1,value:null};n.current=o}else o=n.current;n=Bu(function(){function e(e){if(!l){if(l=!0,n=e,e=r(e),void 0!==s&&o.hasValue){var t=o.value;if(s(t,e))return a=t}return a=e}if(t=a,Ru(n,e))return t;var i=r(e);return void 0!==s&&s(t,i)?(n=e,t):(n=e,a=i)}var n,a,l=!1,h=void 0===i?null:i;return[function(){return e(t())},null===h?void 0:function(){return e(h())}]},[t,i,r,s]);var a=Tu(e,n[0],n[1]);return Du(function(){o.hasValue=!0,o.value=a},[a]),Au(a),a},_u.exports=pu;const Nu=h(_u.exports),Iu={},{useDebugValue:Ou}=G,{useSyncExternalStoreWithSelector:zu}=Nu;let Fu=!1;const ju=e=>e;const Wu=e=>{"production"!==(Iu?"production":void 0)&&"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?(e=>e?fu(e):fu)(e):e,i=(e,i)=>function(e,t=ju,i){"production"!==(Iu?"production":void 0)&&i&&!Fu&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Fu=!0);const r=zu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,i);return Ou(r),r}(t,e,i);return Object.assign(i,t),i},Hu=e=>e?Wu(e):Wu,$u=Hu((e,t)=>({sessions:{},activePorts:{},claudeStatus:{},gitBranches:{},editorNeedsAccessibility:!1,createSession:(t,i)=>e(e=>({sessions:{...e.sessions,[t]:{terminalId:t,projectId:i,terminal:null,title:"Terminal",alive:!0}}})),setTerminalInstance:(t,i)=>e(e=>{const r=e.sessions[t];return r?{sessions:{...e.sessions,[t]:{...r,terminal:i}}}:e}),setTitle:(t,i)=>e(e=>{const r=e.sessions[t];return r?{sessions:{...e.sessions,[t]:{...r,title:i}}}:e}),markDead:t=>e(e=>{const i=e.sessions[t];return i?{sessions:{...e.sessions,[t]:{...i,alive:!1}}}:e}),removeSession:t=>e(e=>{const{[t]:i,...r}=e.sessions;return{sessions:r}}),getSession:e=>t().sessions[e],getProjectSessions:e=>Object.values(t().sessions).filter(t=>t.projectId===e),setActivePorts:t=>e({activePorts:t}),setClaudeStatus:t=>e({claudeStatus:t}),setGitBranches:t=>e({gitBranches:t}),setEditorNeedsAccessibility:t=>e({editorNeedsAccessibility:t})}));let Uu=null,Ku=null;function qu(e){Ku=Ku?{...Ku,...e}:{...e},Uu&&clearTimeout(Uu),Uu=setTimeout(()=>{const e=Ku;Ku=null,Uu=null,fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(()=>{})},300)}const Vu=Hu()((e,t)=>({projects:{},activeProjectId:null,setActiveProject:t=>{e({activeProjectId:t}),qu({activeProjectId:t})},addProject:t=>e(e=>({projects:{...e.projects,[t.id]:t},activeProjectId:e.activeProjectId??t.id})),removeProject:t=>e(e=>{const{[t]:i,...r}=e.projects;return{projects:r,activeProjectId:e.activeProjectId===t?Object.keys(r)[0]??null:e.activeProjectId}}),addTerminalToProject:(t,i)=>e(e=>{const r=e.projects[t];return r?r.terminalIds.includes(i)?e:{projects:{...e.projects,[t]:{...r,terminalIds:[...r.terminalIds,i]}}}:e}),removeTerminalFromProject:(t,i)=>e(e=>{const r=e.projects[t];return r?{projects:{...e.projects,[t]:{...r,terminalIds:r.terminalIds.filter(e=>e!==i)}}}:e}),clearProjectTerminals:t=>e(e=>{const i=e.projects[t];return i?{projects:{...e.projects,[t]:{...i,terminalIds:[]}}}:e}),getActiveProject:()=>{const{projects:e,activeProjectId:i}=t();return i?e[i]??null:null},hydrateFromServer:async()=>{try{const[t,i]=await Promise.all([fetch("/api/projects"),fetch("/api/settings")]),r=await t.json(),s=await i.json(),n={};for(const e of r)n[e.id]={id:e.id,name:e.name,cwd:e.cwd,terminalIds:[]};const o=s.activeProjectId&&n[s.activeProjectId]?s.activeProjectId:Object.keys(n)[0]??null;e({projects:n,activeProjectId:o})}catch{}}})),Yu={background:"#0a0a0f",foreground:"#ececf1",cursor:"#ececf1",cursorAccent:"#0a0a0f",selectionBackground:"#5b5bd640",selectionForeground:"#ececf1",black:"#1a1a24",red:"#e5484d",green:"#30a46c",yellow:"#f5d90a",blue:"#5b5bd6",magenta:"#ab4aba",cyan:"#12a594",white:"#ececf1",brightBlack:"#6b6b80",brightRed:"#ff6369",brightGreen:"#3dd68c",brightYellow:"#ffef5c",brightBlue:"#849dff",brightMagenta:"#d19dff",brightCyan:"#0ac5b3",brightWhite:"#ffffff"},Gu={background:"#ffffff",foreground:"#1a1a2e",cursor:"#1a1a2e",cursorAccent:"#ffffff",selectionBackground:"#5b5bd630",selectionForeground:"#1a1a2e",black:"#1a1a2e",red:"#dc3545",green:"#1a8f5c",yellow:"#b58900",blue:"#5b5bd6",magenta:"#9b3bb0",cyan:"#0f8a7e",white:"#d0d0d8",brightBlack:"#8888a0",brightRed:"#e5484d",brightGreen:"#30a46c",brightYellow:"#d4a017",brightBlue:"#6e6ee6",brightMagenta:"#ab4aba",brightCyan:"#12a594",brightWhite:"#d0d0d8"};function Xu(e){return e?"leaf"===e.type?[e.terminalId]:[...Xu(e.first),...Xu(e.second)]:[]}function Qu(e,t){if("leaf"===e.type)return null;const i=Xu(e.first),r=Xu(e.second);return i.includes(t)||r.includes(t)?e.direction:Qu(e.first,t)??Qu(e.second,t)}function Ju(e,t,i,r){if(!e)return{type:"leaf",terminalId:i};return Zu(e,t,i,r??("vertical"===Qu(e,t)?"horizontal":"vertical"))}function Zu(e,t,i,r){return"leaf"===e.type?e.terminalId===t?{type:"split",direction:r,ratio:.5,first:e,second:{type:"leaf",terminalId:i}}:e:{...e,first:Zu(e.first,t,i,r),second:Zu(e.second,t,i,r)}}function ed(e,t){if(!e)return null;if("leaf"===e.type)return e.terminalId===t?null:e;const i=Xu(e.first),r=Xu(e.second);if("leaf"===e.first.type&&e.first.terminalId===t)return e.second;if("leaf"===e.second.type&&e.second.terminalId===t)return e.first;if(i.includes(t)){const i=ed(e.first,t);return i?{...e,first:i}:e.second}if(r.includes(t)){const i=ed(e.second,t);return i?{...e,second:i}:e.first}return e}function td(e,t,i){const r=Math.max(.1,Math.min(.9,i));if(0===t.length)return"split"===e.type?{...e,ratio:r}:e;if("leaf"===e.type)return e;const[s,...n]=t;return 0===s?{...e,first:td(e.first,n,r)}:{...e,second:td(e.second,n,r)}}function id(e,t,i){return"leaf"===e.type?e.terminalId===t?{...e,terminalId:i}:e.terminalId===i?{...e,terminalId:t}:e:{...e,first:id(e.first,t,i),second:id(e.second,t,i)}}function rd(e,t,i,r){const s=ed(e,t);if(!s)return null;return sd(s,i,t,"left"===r||"right"===r?"vertical":"horizontal","left"===r||"top"===r)}function sd(e,t,i,r,s){if("leaf"===e.type){if(e.terminalId===t){const t={type:"leaf",terminalId:i};return{type:"split",direction:r,ratio:.5,first:s?t:e,second:s?e:t}}return e}return{...e,first:sd(e.first,t,i,r,s),second:sd(e.second,t,i,r,s)}}const nd=["even-horizontal","even-vertical","main-left","main-top","grid"];function od(e,t){if(0===e.length)return null;if(1===e.length)return{type:"leaf",terminalId:e[0]};switch(t){case"even-horizontal":return ad(e,"horizontal");case"even-vertical":return ad(e,"vertical");case"main-left":return ld(e,"vertical");case"main-top":return ld(e,"horizontal");case"grid":return function(e){if(e.length<=2)return ad(e,"vertical");const t=Math.ceil(e.length/2),i=e.slice(0,t),r=e.slice(t);return{type:"split",direction:"horizontal",ratio:.5,first:ad(i,"vertical"),second:r.length>0?ad(r,"vertical"):{type:"leaf",terminalId:i[i.length-1]}}}(e)}}function ad(e,t){if(1===e.length)return{type:"leaf",terminalId:e[0]};if(2===e.length)return{type:"split",direction:t,ratio:.5,first:{type:"leaf",terminalId:e[0]},second:{type:"leaf",terminalId:e[1]}};return{type:"split",direction:t,ratio:1/e.length,first:{type:"leaf",terminalId:e[0]},second:ad(e.slice(1),t)}}function ld(e,t,i){const[r,...s]=e;return{type:"split",direction:t,ratio:.6,first:{type:"leaf",terminalId:r},second:ad(s,"vertical"===t?"horizontal":"vertical")}}function hd(e,t,i){const r=Xu(e),s=r.indexOf(t);return-1===s?null:"left"===i||"up"===i?s>0?r[s-1]:null:s<r.length-1?r[s+1]:null}const cd=Hu((e,t)=>({layouts:{},currentPresetIndex:0,getLayout:e=>t().layouts[e]??null,setLayout:(t,i)=>e(e=>({layouts:{...e.layouts,[t]:i}})),addPaneToProject:(t,i,r,s)=>e(e=>{const n=Ju(e.layouts[t]??null,i,r,s);return{layouts:{...e.layouts,[t]:n}}}),removePaneFromProject:(t,i)=>e(e=>{const r=e.layouts[t];if(!r)return e;const s=ed(r,i);return{layouts:{...e.layouts,[t]:s}}}),resizePaneInProject:(t,i,r)=>e(e=>{const s=e.layouts[t];if(!s)return e;const n=td(s,i,r);return{layouts:{...e.layouts,[t]:n}}}),swapPanesInProject:(t,i,r)=>e(e=>{const s=e.layouts[t];if(!s)return e;const n=id(s,i,r);return{layouts:{...e.layouts,[t]:n}}}),movePaneInProject:(t,i,r,s)=>e(e=>{const n=e.layouts[t];if(!n)return e;const o=rd(n,i,r,s);return{layouts:{...e.layouts,[t]:o}}}),applyPresetToProject:(t,i)=>e(e=>{const r=nd[e.currentPresetIndex],s=od(i,r);return{layouts:{...e.layouts,[t]:s}}}),cyclePreset:(t,i)=>e(e=>{const r=(e.currentPresetIndex+1)%nd.length,s=nd[r],n=od(i,s);return{currentPresetIndex:r,layouts:{...e.layouts,[t]:n}}}),removeProjectLayout:t=>e(e=>{const{[t]:i,...r}=e.layouts;return{layouts:r}})}));function ud(e){document.documentElement.setAttribute("data-theme",e)}function dd(e){return"system"===e?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":e}function fd(e){document.cookie=`paneful_theme=${e};path=/;max-age=31536000;SameSite=Lax`}const _d=function(){const e=document.cookie.match(/(?:^|; )paneful_theme=(system|dark|light)/);return(null==e?void 0:e[1])??"system"}();function pd(e){const{theme:t,sidebarWidth:i,editorSyncEnabled:r,gpuRendering:s}=e();qu({ui:{theme:t,sidebarWidth:i,editorSyncEnabled:r,gpuRendering:s}})}ud(_d);const gd=Hu((e,t)=>({focusedTerminalId:null,sidebarOpen:!0,sidebarWidth:224,draggingTerminalId:null,dropTarget:null,connectionStatus:"connecting",editorSyncEnabled:!0,gpuRendering:!0,theme:_d,syncToast:null,searchTerminalId:null,commandPaletteOpen:!1,pendingFavouriteLaunchId:null,setFocusedTerminal:t=>e({focusedTerminalId:t}),toggleSidebar:()=>e(e=>({sidebarOpen:!e.sidebarOpen})),setSidebarOpen:t=>e({sidebarOpen:t}),setSidebarWidth:i=>{const r=Math.min(700,Math.max(160,i));e({sidebarWidth:r}),pd(t)},setDragging:t=>e({draggingTerminalId:t}),setDropTarget:t=>e({dropTarget:t}),setConnectionStatus:t=>e({connectionStatus:t}),toggleEditorSync:()=>{e(e=>({editorSyncEnabled:!e.editorSyncEnabled})),pd(t)},toggleGpuRendering:()=>{e(e=>({gpuRendering:!e.gpuRendering})),pd(t)},setTheme:i=>{fd(i),ud(i),e({theme:i}),pd(t)},cycleTheme:()=>{const i=["system","light","dark"],r=t().theme,s=i[(i.indexOf(r)+1)%i.length];fd(s),ud(s),e({theme:s}),pd(t)},openSearch:t=>e({searchTerminalId:t}),closeSearch:()=>e({searchTerminalId:null}),toggleCommandPalette:()=>e(e=>({commandPaletteOpen:!e.commandPaletteOpen})),closeCommandPalette:()=>e({commandPaletteOpen:!1}),requestFavouriteLaunch:t=>e({pendingFavouriteLaunchId:t}),clearPendingFavouriteLaunch:()=>e({pendingFavouriteLaunchId:null}),showSyncToast:t=>{e({syncToast:{projectName:t,id:Date.now()}})},dismissSyncToast:()=>e({syncToast:null}),hydrateFromServer:async()=>{try{const t=await fetch("/api/settings"),i=await t.json();if(i.ui){const{theme:t,sidebarWidth:r,editorSyncEnabled:s,gpuRendering:n}=i.ui;t&&(fd(t),ud(t)),e({...t?{theme:t}:{},...void 0!==r?{sidebarWidth:r}:{},...void 0!==s?{editorSyncEnabled:s}:{},...void 0!==n?{gpuRendering:n}:{}})}}catch{}}}));
39
+ /**
40
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
41
+ * @license MIT
42
+ *
43
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
44
+ * @license MIT
45
+ *
46
+ * Originally forked from (with the author's permission):
47
+ * Fabrice Bellard's javascript vt100 for jslinux:
48
+ * http://bellard.org/jslinux/
49
+ * Copyright (c) 2011 Fabrice Bellard
50
+ */var vd=Object.defineProperty,md=Object.getOwnPropertyDescriptor,yd=(e,t,i,r)=>{for(var s,n=r>1?void 0:r?md(t,i):t,o=e.length-1;o>=0;o--)(s=e[o])&&(n=(r?s(t,i,n):s(n))||n);return r&&n&&vd(t,i,n),n},bd=(e,t)=>(i,r)=>t(i,r,e),Sd="Terminal input",wd=()=>Sd,xd=e=>Sd=e,Cd="Too much output to announce, navigate to rows manually to read",kd=()=>Cd,Ld=e=>Cd=e;function Ed(e,t,i,r){e=function(e,t){return t?"[200~"+e+"[201~":e}(e=function(e){return e.replace(/\r?\n/g,"\r")}(e),i.decPrivateModes.bracketedPasteMode&&!0!==r.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function Md(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 Rd(e,t,i,r,s){Md(e,t,i),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Td(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Pd(e,t=0,i=e.length){let r="";for(let s=t;s<i;++s){let t=e[s];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Dd=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 i=e.charCodeAt(s++);56320<=i&&i<=57343?t[r++]=1024*(this._interim-55296)+i-56320+65536:(t[r++]=this._interim,t[r++]=i),this._interim=0}for(let n=s;n<i;++n){let s=e.charCodeAt(n);if(55296<=s&&s<=56319){if(++n>=i)return this._interim=s,r;let o=e.charCodeAt(n);56320<=o&&o<=57343?t[r++]=1024*(s-55296)+o-56320+65536:(t[r++]=s,t[r++]=o);continue}65279!==s&&(t[r++]=s)}return r}},Bd=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,s,n,o,a=0,l=0,h=0;if(this.interim[0]){let r=!1,s=this.interim[0];s&=192==(224&s)?31:224==(240&s)?15:7;let n,o=0;for(;(n=63&this.interim[++o])&&o<4;)s<<=6,s|=n;let l=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,c=l-o;for(;h<c;){if(h>=i)return 0;if(n=e[h++],128!=(192&n)){h--,r=!0;break}this.interim[o++]=n,s<<=6,s|=63&n}r||(2===l?s<128?h--:t[a++]=s:3===l?s<2048||s>=55296&&s<=57343||65279===s||(t[a++]=s):s<65536||s>1114111||(t[a++]=s)),this.interim.fill(0)}let c=i-4,u=h;for(;u<i;){for(;!(!(u<c)||128&(r=e[u])||128&(s=e[u+1])||128&(n=e[u+2])||128&(o=e[u+3]));)t[a++]=r,t[a++]=s,t[a++]=n,t[a++]=o,u+=4;if(r=e[u++],r<128)t[a++]=r;else if(192==(224&r)){if(u>=i)return this.interim[0]=r,a;if(s=e[u++],128!=(192&s)){u--;continue}if(l=(31&r)<<6|63&s,l<128){u--;continue}t[a++]=l}else if(224==(240&r)){if(u>=i)return this.interim[0]=r,a;if(s=e[u++],128!=(192&s)){u--;continue}if(u>=i)return this.interim[0]=r,this.interim[1]=s,a;if(n=e[u++],128!=(192&n)){u--;continue}if(l=(15&r)<<12|(63&s)<<6|63&n,l<2048||l>=55296&&l<=57343||65279===l)continue;t[a++]=l}else if(240==(248&r)){if(u>=i)return this.interim[0]=r,a;if(s=e[u++],128!=(192&s)){u--;continue}if(u>=i)return this.interim[0]=r,this.interim[1]=s,a;if(n=e[u++],128!=(192&n)){u--;continue}if(u>=i)return this.interim[0]=r,this.interim[1]=s,this.interim[2]=n,a;if(o=e[u++],128!=(192&o)){u--;continue}if(l=(7&r)<<18|(63&s)<<12|(63&n)<<6|63&o,l<65536||l>1114111)continue;t[a++]=l}}return a}},Ad=" ",Nd=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Id}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&~this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Id=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},Od=class e extends Nd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Id,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?Td(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(2===e[1].length){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(i-55296)+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},zd="di$target",Fd="di$dependencies",jd=new Map;function Wd(e){if(jd.has(e))return jd.get(e);let t=function(e,i,r){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,i){t[zd]===t?t[Fd].push({id:e,index:i}):(t[Fd]=[{id:e,index:i}],t[zd]=t)}(t,e,r)};return t._id=e,jd.set(e,t),t}var Hd=Wd("BufferService"),$d=Wd("CoreMouseService"),Ud=Wd("CoreService"),Kd=Wd("CharsetService"),qd=Wd("InstantiationService"),Vd=Wd("LogService"),Yd=Wd("OptionsService"),Gd=Wd("OscLinkService"),Xd=Wd("UnicodeService"),Qd=Wd("DecorationService"),Jd=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var i;let r=this._bufferService.buffer.lines.get(e-1);if(!r)return void t(void 0);let s=[],n=this._optionsService.rawOptions.linkHandler,o=new Od,a=r.getTrimmedLength(),l=-1,h=-1,c=!1;for(let u=0;u<a;u++)if(-1!==h||r.hasContent(u)){if(r.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId){if(-1===h){h=u,l=o.extended.urlId;continue}c=o.extended.urlId!==l}else-1!==h&&(c=!0);if(c||-1!==h&&u===a-1){let t=null==(i=this._oscLinkService.getLinkData(l))?void 0:i.uri;if(t){let i={start:{x:h+1,y:e},end:{x:u+(c||u!==a-1?0:1),y:e}},r=!1;if(!(null==n?void 0:n.allowNonHttpProtocols))try{let e=new URL(t);["http:","https:"].includes(e.protocol)||(r=!0)}catch{r=!0}r||s.push({text:t,range:i,activate:(e,t)=>n?n.activate(e,t,i):Zd(e,t),hover:(e,t)=>{var r;return null==(r=null==n?void 0:n.hover)?void 0:r.call(n,e,t,i)},leave:(e,t)=>{var r;return null==(r=null==n?void 0:n.leave)?void 0:r.call(n,e,t,i)}})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=u,l=o.extended.urlId):(h=-1,l=-1)}}t(s)}};function Zd(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}Jd=yd([bd(0,Hd),bd(1,Yd),bd(2,Gd)],Jd);var ef=Wd("CharSizeService"),tf=Wd("CoreBrowserService"),rf=Wd("MouseService"),sf=Wd("RenderService"),nf=Wd("SelectionService"),of=Wd("CharacterJoinerService"),af=Wd("ThemeService"),lf=Wd("LinkProviderService"),hf=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?gf.isErrorNoTelemetry(e)?new gf(e.message+"\n\n"+e.stack):new Error(e.message+"\n\n"+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)}};function cf(e){(function(e){return e instanceof df||e instanceof Error&&e.name===uf&&e.message===uf})(e)||hf.onUnexpectedError(e)}var uf="Canceled";var df=class extends Error{constructor(){super(uf),this.name=this.message}};var ff,_f,pf,gf=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}},vf=class e extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,e.prototype)}};function mf(e,t=0){return e[e.length-(1+t)]}function yf(e,t){let i,r=this,s=!1;return function(){return s||(s=!0,t||(i=e.apply(r,arguments))),i}}function bf(e){if(pf.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(h_){t.push(h_)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function Sf(e){return{dispose:yf(()=>{e()})}}(_f=ff||(ff={})).isLessThan=function(e){return e<0},_f.isLessThanOrEqual=function(e){return e<=0},_f.isGreaterThan=function(e){return e>0},_f.isNeitherLessOrGreaterThan=function(e){return 0===e},_f.greaterThan=1,_f.lessThan=-1,_f.neitherLessOrGreaterThan=0,(e=>{function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;let i=Object.freeze([]);function*r(e){yield e}e.empty=function(){return i},e.single=r,e.wrap=function(e){return t(e)?e:r(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(let r of e)if(t(r,i++))return!0;return!1},e.find=function(e,t){for(let i of e)if(t(i))return i},e.filter=function*(e,t){for(let i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(let r of e)yield t(r,i++)},e.flatMap=function*(e,t){let i=0;for(let r of e)yield*t(r,i++)},e.concat=function*(...e){for(let t of e)yield*t},e.reduce=function(e,t,i){let r=i;for(let s of e)r=t(r,s);return r},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);t<i;t++)yield e[t]},e.consume=function(t,i=Number.POSITIVE_INFINITY){let r=[];if(0===i)return[r,t];let s=t[Symbol.iterator]();for(let n=0;n<i;n++){let t=s.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator]:()=>s}]},e.asyncToArray=async function(e){let t=[];for await(let i of e)t.push(i);return Promise.resolve(t)}})(pf||(pf={}));var wf=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{bf(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?e.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(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&this._toDispose.delete(e)}};wf.DISABLE_DISPOSED_WARNING=!1;var xf=wf,Cf=class{constructor(){this._store=new xf,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)}};Cf.None=Object.freeze({dispose(){}});var kf=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null==(t=this._value)||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null==(e=this._value)||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Lf="object"==typeof window?window:globalThis,Ef=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Ef.Undefined=new Ef(void 0);var Mf,Rf=Ef,Tf=class{constructor(){this._first=Rf.Undefined,this._last=Rf.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Rf.Undefined}clear(){let e=this._first;for(;e!==Rf.Undefined;){let t=e.next;e.prev=Rf.Undefined,e.next=Rf.Undefined,e=t}this._first=Rf.Undefined,this._last=Rf.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new Rf(e);if(this._first===Rf.Undefined)this._first=i,this._last=i;else if(t){let e=this._last;this._last=i,i.prev=e,e.next=i}else{let e=this._first;this._first=i,i.next=e,e.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==Rf.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Rf.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Rf.Undefined&&e.next!==Rf.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Rf.Undefined&&e.next===Rf.Undefined?(this._first=Rf.Undefined,this._last=Rf.Undefined):e.next===Rf.Undefined?(this._last=this._last.prev,this._last.next=Rf.Undefined):e.prev===Rf.Undefined&&(this._first=this._first.next,this._first.prev=Rf.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Rf.Undefined;)yield e.element,e=e.next}},Pf=globalThis.performance&&"function"==typeof globalThis.performance.now,Df=class e{static create(t){return new e(t)}constructor(e){this._now=Pf&&!1===e?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-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function t(e){return(t,i=null,r)=>{let s,n=!1;return s=e(e=>{if(!n)return s?s.dispose():n=!0,t.call(i,e)},null,r),n&&s.dispose(),s}}function i(e,t,i){return s((i,r=null,s)=>e(e=>i.call(r,t(e)),null,s),i)}function r(e,t,i){return s((i,r=null,s)=>e(e=>t(e)&&i.call(r,e),null,s),i)}function s(e,t){let i,r=new Hf({onWillAddFirstListener(){i=e(r.fire,r)},onDidRemoveLastListener(){null==i||i.dispose()}});return null==t||t.add(r),r.event}function n(e,t,i=100,r=!1,s=!1,n,o){let a,l,h,c,u=0,d=new Hf({leakWarningThreshold:n,onWillAddFirstListener(){a=e(e=>{u++,l=t(l,e),r&&!h&&(d.fire(l),l=void 0),c=()=>{let e=l;l=void 0,h=void 0,(!r||u>1)&&d.fire(e),u=0},"number"==typeof i?(clearTimeout(h),h=setTimeout(c,i)):void 0===h&&(h=0,queueMicrotask(c))})},onWillRemoveListener(){s&&u>0&&(null==c||c())},onDidRemoveLastListener(){c=void 0,a.dispose()}});return null==o||o.add(d),d.event}e.None=()=>Cf.None,e.defer=function(e,t){return n(e,()=>{},0,void 0,!0,void 0,t)},e.once=t,e.map=i,e.forEach=function(e,t,i){return s((i,r=null,s)=>e(e=>{t(e),i.call(r,e)},null,s),i)},e.filter=r,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,r)=>function(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}(function(...e){return Sf(()=>bf(e))}(...e.map(e=>e(e=>t.call(i,e)))),r)},e.reduce=function(e,t,r,s){let n=r;return i(e,e=>(n=t(n,e),n),s)},e.debounce=n,e.accumulate=function(t,i=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,r)},e.latch=function(e,t=(e,t)=>e===t,i){let s,n=!0;return r(e,e=>{let i=n||!t(e,s);return n=!1,s=e,i},i)},e.split=function(t,i,r){return[e.filter(t,i,r),e.filter(t,e=>!i(e),r)]},e.buffer=function(e,t=!1,i=[],r){let s=i.slice(),n=e(e=>{s?s.push(e):a.fire(e)});r&&r.add(n);let o=()=>{null==s||s.forEach(e=>a.fire(e)),s=null},a=new Hf({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),r&&r.add(n))},onDidAddFirstListener(){s&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return r&&r.add(a),a.event},e.chain=function(e,t){return(i,r,s)=>{let n=t(new a);return e(function(e){let t=n.evaluate(e);t!==o&&i.call(r,t)},void 0,s)}};let o=Symbol("HaltChainable");class a{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:o),this}reduce(e,t){let i=t;return this.steps.push(t=>(i=e(i,t),i)),this}latch(e=(e,t)=>e===t){let t,i=!0;return this.steps.push(r=>{let s=i||!e(r,t);return i=!1,t=r,s?r:o}),this}evaluate(e){for(let t of this.steps)if((e=t(e))===o)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new Hf({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return s.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new Hf({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return s.event},e.toPromise=function(e){return new Promise(i=>t(e)(i))},e.fromPromise=function(e){let t=new Hf;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class l{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let i={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Hf(i),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new l(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,r)=>{let s=0,n=!1,o={beginUpdate(){s++},endUpdate(){s--,0===s&&(e.reportChanges(),n&&(n=!1,t.call(i)))},handlePossibleChange(){},handleChange(){n=!0}};e.addObserver(o),e.reportChanges();let a={dispose(){e.removeObserver(o)}};return r instanceof xf?r.add(a):Array.isArray(r)&&r.push(a),a}}})(Mf||(Mf={}));var Bf=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Df,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Bf.all=new Set,Bf._idPool=0;var Af=Bf,Nf=class e{constructor(t,i,r=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;null==(e=this._stacks)||e.clear()}check(e,t){let i=this.threshold;if(i<=0||t<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*i;let[e,r]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(s),console.warn(e);let n=new zf(s,e);this._errorHandler(n)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[i,r]of this._stacks)(!e||t<r)&&(e=[i,r],t=r);return e}};Nf._idPool=1;var If=Nf,Of=class e{constructor(e){this.value=e}static create(){let t=new Error;return new e(t.stack??"")}print(){console.warn(this.value.split("\n").slice(2).join("\n"))}},zf=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Ff=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},jf=0,Wf=class{constructor(e){this.value=e,this.id=jf++}},Hf=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(null==(t=this._options)?void 0:t.leakWarningThreshold)?new If((null==e?void 0:e.onListenerError)??cf,(null==(i=this._options)?void 0:i.leakWarningThreshold)??-1):void 0,this._perfMon=(null==(r=this._options)?void 0:r._profName)?new Af(this._options._profName):void 0,this._deliveryQueue=null==(s=this._options)?void 0:s.deliveryQueue}dispose(){var e,t,i,r;this._disposed||(this._disposed=!0,(null==(e=this._deliveryQueue)?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),null==(i=null==(t=this._options)?void 0:t.onDidRemoveLastListener)||i.call(t),null==(r=this._leakageMon)||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var r,s,n,o,a;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new Ff(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return((null==(r=this._options)?void 0:r.onListenerError)||cf)(i),Cf.None}if(this._disposed)return Cf.None;t&&(e=e.bind(t));let l,h=new Wf(e);this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(h.stack=Of.create(),l=this._leakageMon.check(h.stack,this._size+1)),this._listeners?this._listeners instanceof Wf?(this._deliveryQueue??(this._deliveryQueue=new $f),this._listeners=[this._listeners,h]):this._listeners.push(h):(null==(n=null==(s=this._options)?void 0:s.onWillAddFirstListener)||n.call(s,this),this._listeners=h,null==(a=null==(o=this._options)?void 0:o.onDidAddFirstListener)||a.call(o,this)),this._size++;let c=Sf(()=>{null==l||l(),this._removeListener(h)});return i instanceof xf?i.add(c):Array.isArray(i)&&i.push(c),c}),this._event}_removeListener(e){var t,i,r,s;if(null==(i=null==(t=this._options)?void 0:t.onWillRemoveListener)||i.call(t,this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,null==(s=null==(r=this._options)?void 0:r.onDidRemoveLastListener)||s.call(r,this),void(this._size=0);let n=this._listeners,o=n.indexOf(e);if(-1===o)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--,n[o]=void 0;let a=this._deliveryQueue.current===this;if(2*this._size<=n.length){let e=0;for(let t=0;t<n.length;t++)n[t]?n[e++]=n[t]:a&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=e}}_deliver(e,t){var i;if(!e)return;let r=(null==(i=this._options)?void 0:i.onListenerError)||cf;if(r)try{e.value(t)}catch(mw){r(mw)}else e.value(t)}_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((null==(t=this._deliveryQueue)?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),null==(i=this._perfMon)||i.stop()),null==(r=this._perfMon)||r.start(this._size),this._listeners)if(this._listeners instanceof Wf)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}null==(s=this._perfMon)||s.stop()}hasListeners(){return this._size>0}},$f=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}},Uf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Hf,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Hf,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(i,e),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToFullScreen.set(i,e),this._onDidChangeFullscreen.fire(i)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Uf.INSTANCE=new Uf;var Kf=Uf;Kf.INSTANCE.onDidChangeZoomLevel,Kf.INSTANCE.onDidChangeFullscreen;var qf="object"==typeof navigator?navigator.userAgent:"",Vf=qf.indexOf("Firefox")>=0,Yf=qf.indexOf("AppleWebKit")>=0,Gf=qf.indexOf("Chrome")>=0,Xf=!Gf&&qf.indexOf("Safari")>=0;qf.indexOf("Electron/"),qf.indexOf("Android");var Qf=!1;if("function"==typeof Lf.matchMedia){let e=Lf.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Lf.matchMedia("(display-mode: fullscreen)");Qf=e.matches,function(e,t,i){"string"==typeof t&&(t=e.matchMedia(t)),t.addEventListener("change",i)}(Lf,e,({matches:e})=>{Qf&&t.matches||(Qf=e)})}var Jf,Zf,e_="en",t_=!1,i_=!1,r_=!1,s_=!1,n_=e_,o_=globalThis;typeof o_.vscode<"u"&&typeof o_.vscode.process<"u"?Zf=o_.vscode.process:typeof process<"u"&&"string"==typeof(null==(e=null==process?void 0:process.versions)?void 0:e.node)&&(Zf=process);var a_="string"==typeof(null==(t=null==Zf?void 0:Zf.versions)?void 0:t.electron)&&"renderer"===(null==Zf?void 0:Zf.type);if("object"==typeof Zf){t_="win32"===Zf.platform,i_="darwin"===Zf.platform,(r_="linux"===Zf.platform)&&!!Zf.env.SNAP&&Zf.env.SNAP_REVISION,!!Zf.env.CI||Zf.env.BUILD_ARTIFACTSTAGINGDIRECTORY,n_=e_;let e=Zf.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,n_=t.resolvedLanguage||e_,null==(i=t.languagePack)?void 0:i.translationsConfigFile}catch{}s_=!0}else"object"!=typeof navigator||a_?console.error("Unable to resolve platform."):(t_=(Jf=navigator.userAgent).indexOf("Windows")>=0,i_=Jf.indexOf("Macintosh")>=0,(Jf.indexOf("Macintosh")>=0||Jf.indexOf("iPad")>=0||Jf.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints,r_=Jf.indexOf("Linux")>=0,null==Jf||Jf.indexOf("Mobi"),n_=globalThis._VSCODE_NLS_LANGUAGE||e_,navigator.language.toLowerCase());var l_,h_,c_=t_,u_=i_,d_=r_,f_=s_,__=Jf,p_=n_;(h_=l_||(l_={})).value=function(){return p_},h_.isDefaultVariant=function(){return 2===p_.length?"en"===p_:p_.length>=3&&"e"===p_[0]&&"n"===p_[1]&&"-"===p_[2]},h_.isDefault=function(){return"en"===p_};var g_="function"==typeof o_.postMessage&&!o_.importScripts;(()=>{if(g_){let e=[];o_.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let r=e[i];if(r.id===t.data.vscodeScheduleAsyncWork)return e.splice(i,1),void r.callback()}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),o_.postMessage({vscodeScheduleAsyncWork:r},"*")}}})();var v_=!!(__&&__.indexOf("Chrome")>=0);__&&__.indexOf("Firefox"),!v_&&__&&__.indexOf("Safari"),__&&__.indexOf("Edg/"),__&&__.indexOf("Android");var m_="object"==typeof navigator?navigator:{};f_||document.queryCommandSupported&&document.queryCommandSupported("copy")||m_&&m_.clipboard&&m_.clipboard.writeText,f_||m_&&m_.clipboard&&m_.clipboard.readText;var y_,b_,S_=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}},w_=new S_,x_=new S_,C_=new S_,k_=new Array(230);(b_=y_||(y_={})).toString=function(e){return w_.keyCodeToStr(e)},b_.fromString=function(e){return w_.strToKeyCode(e)},b_.toUserSettingsUS=function(e){return x_.keyCodeToStr(e)},b_.toUserSettingsGeneral=function(e){return C_.keyCodeToStr(e)},b_.fromUserSettings=function(e){return x_.strToKeyCode(e)||C_.strToKeyCode(e)},b_.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return w_.keyCodeToStr(e)};var L_=class e{constructor(e,t,i,r,s){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=r,this.keyCode=s}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?"1":"0"}${this.shiftKey?"1":"0"}${this.altKey?"1":"0"}${this.metaKey?"1":"0"}${this.keyCode}`}isModifierKey(){return 0===this.keyCode||5===this.keyCode||57===this.keyCode||6===this.keyCode||4===this.keyCode}toKeybinding(){return new E_([this])}isDuplicateModifierCase(){return this.ctrlKey&&5===this.keyCode||this.shiftKey&&4===this.keyCode||this.altKey&&6===this.keyCode||this.metaKey&&57===this.keyCode}},E_=class{constructor(e){if(0===e.length)throw new Error(`Illegal argument: ${"chords"}`);this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;t++)0!==t&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(null===e||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}};var M_=u_?256:2048,R_=u_?2048:256,T_=class{constructor(e){var t;this._standardKeyboardEventBrand=!0;let i=e;this.browserEvent=i,this.target=i.target,this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,this.altGraphKey=null==(t=i.getModifierState)?void 0:t.call(i,"AltGraph"),this.keyCode=function(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return y_.fromString(t)}let t=e.keyCode;if(3===t)return 7;if(Vf)switch(t){case 59:return 85;case 60:if(d_)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(u_)return 57}else if(Yf){if(u_&&93===t)return 57;if(!u_&&92===t)return 57}return k_[t]||0}(i),this.code=i.code,this.ctrlKey=this.ctrlKey||5===this.keyCode,this.altKey=this.altKey||6===this.keyCode,this.shiftKey=this.shiftKey||4===this.keyCode,this.metaKey=this.metaKey||57===this.keyCode,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;5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=M_),this.altKey&&(t|=512),this.shiftKey&&(t|=1024),this.metaKey&&(t|=R_),t|=e,t}_computeKeyCodeChord(){let e=0;return 5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode),new L_(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},P_=new WeakMap;function D_(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if("null"!==t.origin&&"null"!==i.origin&&t.origin!==i.origin)return null}catch{return null}return e.parent}var B_,A_=class{static getSameOriginWindowChain(e){let t=P_.get(e);if(!t){t=[],P_.set(e,t);let i,r=e;do{i=D_(r),i?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=i}while(r)}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 e=n.window.deref();if(i+=(null==e?void 0:e.scrollY)??0,r+=(null==e?void 0:e.scrollX)??0,e===t||!n.iframeElement)break;let s=n.iframeElement.getBoundingClientRect();i+=s.top,r+=s.left}return{top:i,left:r}}},N_=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=0===t.button,this.middleButton=1===t.button,this.rightButton=2===t.button,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,"dblclick"===t.type&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,"number"==typeof t.pageX?(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=A_.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},I_=class{constructor(e,t=0,i=0){var r;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let s=!1;if(Gf){let e=navigator.userAgent.match(/Chrome\/(\d+)/);s=(e?parseInt(e[1]):123)<=122}if(e){let t=e,i=e,n=(null==(r=e.view)?void 0:r.devicePixelRatio)||1;if(typeof t.wheelDeltaY<"u")this.deltaY=s?t.wheelDeltaY/(120*n):t.wheelDeltaY/120;else if(typeof i.VERTICAL_AXIS<"u"&&i.axis===i.VERTICAL_AXIS)this.deltaY=-i.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaY=Vf&&!u_?-e.deltaY/3:-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<"u")this.deltaX=Xf&&c_?-t.wheelDeltaX/120:s?t.wheelDeltaX/(120*n):t.wheelDeltaX/120;else if(typeof i.HORIZONTAL_AXIS<"u"&&i.axis===i.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaX=Vf&&!u_?-e.deltaX/3:-e.deltaX:this.deltaX=-e.deltaX/40}0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(this.deltaY=s?e.wheelDelta/(120*n):e.wheelDelta/120)}}preventDefault(){var e;null==(e=this.browserEvent)||e.preventDefault()}stopPropagation(){var e;null==(e=this.browserEvent)||e.stopPropagation()}},O_=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(e=>{e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof j_||!(!t||"object"!=typeof t)&&("boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested)},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Mf.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:O_})})(B_||(B_={}));var z_,F_,j_=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?O_:(this._emitter||(this._emitter=new Hf),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},W_=class{constructor(e,t){this._isDisposed=!1,this._token=-1,"function"==typeof e&&"number"==typeof t&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new vf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new vf("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},H_=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;null==(e=this.disposable)||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new vf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=Sf(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(F_=z_||(z_={})).settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if(typeof t<"u")throw t;return i},F_.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(b_){i(b_)}})};var $_=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Hf,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(mw){this.reject(mw)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await Mf.toPromise(this._onStateChanged.event)}},return:async()=>{var e;return null==(e=this._onReturn)||e.call(this),{done:!0,value:void 0}}}}static map(t,i){return new e(async e=>{for await(let r of t)e.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let r of t)i(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};$_.EMPTY=$_.fromArray([]);var{getWindow:U_,getWindowId:K_,onDidRegisterWindow:q_}=function(){let e=new Map,t={window:Lf,disposables:new xf};e.set(Lf.vscodeWindowId,t);let i=new Hf,r=new Hf,s=new Hf;return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Cf.None;let n=new xf,o={window:t,disposables:n.add(new xf)};return e.set(t.vscodeWindowId,o),n.add(Sf(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),n.add(Y_(t,Z_.BEFORE_UNLOAD,()=>{s.fire(t)})),i.fire(o),n},getWindows:()=>e.values(),getWindowsCount:()=>e.size,getWindowId:e=>e.vscodeWindowId,hasWindow:t=>e.has(t),getWindowById:function(i,r){return("number"==typeof i?e.get(i):void 0)??(r?t:void 0)},getWindow(e){var t;let i=e;if(null==(t=null==i?void 0:i.ownerDocument)?void 0:t.defaultView)return i.ownerDocument.defaultView.window;let r=e;return(null==r?void 0:r.view)?r.view.window:Lf},getDocument:e=>U_(e).document}}(),V_=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 Y_(e,t,i,r){return new V_(e,t,i,r)}var G_,X_=function(e,t,i,r){return Y_(e,t,i,r)},Q_=class extends H_{constructor(e){super(),this.defaultTarget=e&&U_(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},J_=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(Iy){cf(Iy)}}static sort(e,t){return t.priority-e.priority}};!function(){let e=new Map,t=new Map,i=new Map,r=new Map;G_=(s,n,o=0)=>{let a=K_(s),l=new J_(n,o),h=e.get(a);return h||(h=[],e.set(a,h)),h.push(l),i.get(a)||(i.set(a,!0),s.requestAnimationFrame(()=>(s=>{i.set(s,!1);let n=e.get(s)??[];for(t.set(s,n),e.set(s,[]),r.set(s,!0);n.length>0;)n.sort(J_.sort),n.shift().execute();r.set(s,!1)})(a))),l}}();var Z_={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"},ep=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=tp(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=tp(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=tp(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=tp(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=tp(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=tp(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=tp(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=tp(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=tp(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=tp(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=tp(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=tp(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=tp(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=tp(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 tp(e){return"number"==typeof e?`${e}px`:e}function ip(e){return new ep(e)}var rp,sp,np=class{constructor(){this._hooks=new xf,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(Sf(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=U_(e)}this._hooks.add(Y_(n,Z_.POINTER_MOVE,e=>{e.buttons===i?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)})),this._hooks.add(Y_(n,Z_.POINTER_UP,e=>this.stopMonitoring(!0)))}};(sp=rp||(rp={})).Tap="-xterm-gesturetap",sp.Change="-xterm-gesturechange",sp.Start="-xterm-gesturestart",sp.End="-xterm-gesturesend",sp.Contextmenu="-xterm-gesturecontextmenu";var op=class e extends Cf{constructor(){super(),this.dispatched=!1,this.targets=new Tf,this.ignoreTargets=new Tf,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Mf.runAndSubscribe(q_,({window:e,disposables:t})=>{t.add(Y_(e.document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),t.add(Y_(e.document,"touchend",t=>this.onTouchEnd(e,t))),t.add(Y_(e.document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))},{window:Lf,disposables:this._store}))}static addTarget(t){if(!e.isTouchDevice())return Cf.None;return e.INSTANCE||(e.INSTANCE=new e),Sf(e.INSTANCE.targets.push(t))}static ignoreTarget(t){if(!e.isTouchDevice())return Cf.None;return e.INSTANCE||(e.INSTANCE=new e),Sf(e.INSTANCE.ignoreTargets.push(t))}static isTouchDevice(){return"ontouchstart"in Lf||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=e.targetTouches.length;i<r;i++){let r=e.targetTouches.item(i);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let s=this.newGestureEvent(rp.Start,r.target);s.pageX=r.pageX,s.pageY=r.pageY,this.dispatchEvent(s)}this.dispatched&&(e.preventDefault(),e.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 o=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("move of an UNKNOWN touch",o);continue}let a=this.activeTouches[o.identifier],l=Date.now()-a.initialTimeStamp;if(l<e.HOLD_DELAY&&Math.abs(a.initialPageX-mf(a.rollingPageX))<30&&Math.abs(a.initialPageY-mf(a.rollingPageY))<30){let e=this.newGestureEvent(rp.Tap,a.initialTarget);e.pageX=mf(a.rollingPageX),e.pageY=mf(a.rollingPageY),this.dispatchEvent(e)}else if(l>=e.HOLD_DELAY&&Math.abs(a.initialPageX-mf(a.rollingPageX))<30&&Math.abs(a.initialPageY-mf(a.rollingPageY))<30){let e=this.newGestureEvent(rp.Contextmenu,a.initialTarget);e.pageX=mf(a.rollingPageX),e.pageY=mf(a.rollingPageY),this.dispatchEvent(e)}else if(1===s){let e=mf(a.rollingPageX),i=mf(a.rollingPageY),s=mf(a.rollingTimestamps)-a.rollingTimestamps[0],n=e-a.rollingPageX[0],o=i-a.rollingPageY[0],l=[...this.targets].filter(e=>a.initialTarget instanceof Node&&e.contains(a.initialTarget));this.inertia(t,l,r,Math.abs(n)/s,n>0?1:-1,e,Math.abs(o)/s,o>0?1:-1,i)}this.dispatchEvent(this.newGestureEvent(rp.End,a.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(t){if(t.type===rp.Tap){let i=(new Date).getTime(),r=0;r=i-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=i,t.tapCount=r}else(t.type===rp.Change||t.type===rp.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let e=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let r=0,s=t.initialTarget;for(;s&&s!==i;)r++,s=s.parentElement;e.push([r,i])}e.sort((e,t)=>e[0]-t[0]);for(let[i,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,r,s,n,o,a,l,h){this.handle=G_(t,()=>{let c=Date.now(),u=c-r,d=0,f=0,_=!0;s+=e.SCROLL_FRICTION*u,a+=e.SCROLL_FRICTION*u,s>0&&(_=!1,d=n*s*u),a>0&&(_=!1,f=l*a*u);let p=this.newGestureEvent(rp.Change);p.translationX=d,p.translationY=f,i.forEach(e=>e.dispatchEvent(p)),_||this.inertia(t,i,c,s,n,o+d,a,l,h+f)})}onTouchMove(e){let t=Date.now();for(let i=0,r=e.changedTouches.length;i<r;i++){let r=e.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn("end of an UNKNOWN touch",r);continue}let s=this.activeTouches[r.identifier],n=this.newGestureEvent(rp.Change,s.initialTarget);n.translationX=r.pageX-mf(s.rollingPageX),n.translationY=r.pageY-mf(s.rollingPageY),n.pageX=r.pageX,n.pageY=r.pageY,this.dispatchEvent(n),s.rollingPageX.length>3&&(s.rollingPageX.shift(),s.rollingPageY.shift(),s.rollingTimestamps.shift()),s.rollingPageX.push(r.pageX),s.rollingPageY.push(r.pageY),s.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};op.SCROLL_FRICTION=-.005,op.HOLD_DELAY=700,op.CLEAR_TAP_COUNT_TIME=400,yd([function(e,t,i){let r=null,s=null;if("function"==typeof i.value?(r="value",s=i.value,0!==s.length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof i.get&&(r="get",s=i.get),!s)throw new Error("not supported");let n=`$memoize$${t}`;i[r]=function(...e){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,e)}),this[n]}}],op,"isTouchDevice",1);var ap=op,lp=class extends Cf{onclick(e,t){this._register(Y_(e,Z_.CLICK,i=>t(new N_(U_(e),i))))}onmousedown(e,t){this._register(Y_(e,Z_.MOUSE_DOWN,i=>t(new N_(U_(e),i))))}onmouseover(e,t){this._register(Y_(e,Z_.MOUSE_OVER,i=>t(new N_(U_(e),i))))}onmouseleave(e,t){this._register(Y_(e,Z_.MOUSE_LEAVE,i=>t(new N_(U_(e),i))))}onkeydown(e,t){this._register(Y_(e,Z_.KEY_DOWN,e=>t(new T_(e))))}onkeyup(e,t){this._register(Y_(e,Z_.KEY_UP,e=>t(new T_(e))))}oninput(e,t){this._register(Y_(e,Z_.INPUT,t))}onblur(e,t){this._register(Y_(e,Z_.BLUR,t))}onfocus(e,t){this._register(Y_(e,Z_.FOCUS,t))}onchange(e,t){this._register(Y_(e,Z_.CHANGE,t))}ignoreGesture(e){return ap.ignoreTarget(e)}},hp=class extends lp{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="11px",this.domNode.style.height="11px",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 np),this._register(X_(this.bgDomNode,Z_.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(X_(this.domNode,Z_.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Q_),this._pointerdownScheduleRepeatTimer=this._register(new W_)}_arrowPointerDown(e){if(!(e.target&&e.target instanceof Element))return;this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,U_(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},cp=class e{constructor(e,t,i,r,s,n,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,i|=0,r|=0,s|=0,n|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>i&&(r=i-t),r<0&&(r=0),s<0&&(s=0),o+s>n&&(o=n-s),o<0&&(o=0),this.width=t,this.scrollWidth=i,this.scrollLeft=r,this.height=s,this.scrollHeight=n,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,i){return new e(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 e(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(e,t){let i=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,n=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,a=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:s,heightChanged:n,scrollHeightChanged:o,scrollTopChanged:a}}},up=class extends Cf{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Hf),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new cp(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 i;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),null==(i=this._smoothScrolling)||i.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(0===this._smoothScrollDuration)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,r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;i=t?new _p(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=_p.start(this._state,t,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)return this._smoothScrolling.dispose(),void(this._smoothScrolling=null);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)))}},dp=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function fp(e,t){let i=t-e;return function(t){return e+i*function(e){return 1-function(e){return Math.pow(e,3)}(1-e)}(t)}}var _p=class e{constructor(e,t,i,r){this.from=e,this.to=t,this.duration=r,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,i){if(Math.abs(e-t)>2.5*i){let r,s;return e<t?(r=e+.75*i,s=t-.75*i):(r=e-.75*i,s=t+.75*i),function(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}(fp(e,r),fp(s,t),.33)}return fp(e,t)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;if(t<1){let e=this.scrollLeft(t),i=this.scrollTop(t);return new dp(e,i,!1)}return new dp(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return e.start(t,i,r)}static start(t,i,r){r+=10;let s=Date.now()-10;return new e(t,i,s,r)}};var pp=class extends Cf{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 W_)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||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(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;null==(e=this._domNode)||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,null==(t=this._domNode)||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},gp=class extends lp{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 pp(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new np),this._shouldRender=!0,this.domNode=ip(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Y_(this.domNode.domNode,Z_.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new hp(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=ip(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof i&&this.slider.setWidth(i),"number"==typeof r&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Y_(this.slider.domNode,Z_.POINTER_DOWN,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.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?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)t=e.offsetX,i=e.offsetY;else{let r=function(e){let t=e.getBoundingClientRect(),i=U_(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),0===e.button&&(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,e=>{let s=this._sliderOrthogonalPointerPosition(e),n=Math.abs(s-i);if(c_&&n>140)return void this._setDesiredScrollPositionNow(r.getScrollPosition());let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{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()}},vp=class e{constructor(e,t,i,r,s,n){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=s,this._scrollPosition=n,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,r,s){let n=Math.max(0,i-e),o=Math.max(0,n-2*t),a=r>0&&r>i;if(!a)return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(i*o/r))),h=(o-l)/(r-i),c=s*h;return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:h,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){let t=e._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(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,i=this._scrollPosition;return t<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},mp=class extends gp{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new vp(t.horizontalHasArrows?t.arrowSize:0,2===t.horizontal?0:t.horizontalScrollbarSize,2===t.vertical?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(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},yp=class extends gp{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new vp(t.verticalHasArrows?t.arrowSize:0,2===t.vertical?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(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},bp=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Sp=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,t=0,i=1,r=this._rear;for(;;){let s=r===this._front?e:Math.pow(2,-i);if(e-=s,t+=this._memory[r].score*s,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}return t<=.5}acceptStandardWheelEvent(e){if(Gf){let i=U_(e.browserEvent),r=(t=i,Kf.INSTANCE.getZoomFactor(t));this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY);var t}accept(e,t,i){let r=null,s=new bp(e,t,i);-1===this._front&&-1===this._rear?(this._memory[0]=s,this._front=0,this._rear=0):(r=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]=s),s.score=this._computeScore(s,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),t){let r=Math.abs(e.deltaX),s=Math.abs(e.deltaY),n=Math.abs(t.deltaX),o=Math.abs(t.deltaY),a=Math.max(Math.min(r,n),1),l=Math.max(Math.min(s,o),1),h=Math.max(r,n),c=Math.max(s,o);h%a===0&&c%l===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Sp.INSTANCE=new Sp;var wp=Sp,xp=class extends lp{constructor(e,t,i){super(),this._onScroll=this._register(new Hf),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Hf),this.onWillScroll=this._onWillScroll.event,this._options=function(e){let t={lazyRender:typeof e.lazyRender<"u"&&e.lazyRender,className:typeof e.className<"u"?e.className:"",useShadows:!(typeof e.useShadows<"u")||e.useShadows,handleMouseWheel:!(typeof e.handleMouseWheel<"u")||e.handleMouseWheel,flipAxes:typeof e.flipAxes<"u"&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<"u"&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:!(typeof e.scrollPredominantAxis<"u")||e.scrollPredominantAxis,mouseWheelSmoothScroll:!(typeof e.mouseWheelSmoothScroll<"u")||e.mouseWheelSmoothScroll,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,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,u_&&(t.className+=" mac"),t}(t),this._scrollable=i,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new yp(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new mp(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=ip(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ip(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ip(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new W_),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=bf(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,u_&&(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 I_(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=bf(this._mouseWheelToDispose),e)){let e=e=>{this._onMouseWheel(new I_(e))};this._mouseWheelToDispose.push(Y_(this._listenOnDomNode,Z_.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){var t;if(null==(t=e.browserEvent)?void 0:t.defaultPrevented)return;let i=wp.INSTANCE;i.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let t=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+t===0?s=t=0:Math.abs(t)>=Math.abs(s)?s=0:t=0),this._options.flipAxes&&([t,s]=[s,t]);let n=!u_&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||n)&&!s&&(s=t,t=0),e.browserEvent&&e.browserEvent.altKey&&(s*=this._options.fastScrollSensitivity,t*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),a={};if(t){let e=50*t,i=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,i)}if(s){let e=50*s,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,t)}a=this._scrollable.validateScrollPosition(a),(o.scrollLeft!==a.scrollLeft||o.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),r=!0)}let s=r;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(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(),500)}},Cp=class extends xp{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()}};var kp=class extends Cf{constructor(e,t,i,r,s,n,o,a){super(),this._bufferService=i,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new Hf),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new up({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>G_(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Cp(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Mf.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Sf(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Sf(()=>this._styleElement.remove())),this._register(Mf.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("\n")})),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(e=>this._handleScroll(e)))}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:(null==(e=this._optionsService.rawOptions.overviewRuler)?void 0:e.width)||14}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(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;0!==i&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};kp=yd([bd(2,Hd),bd(3,tf),bd(4,$d),bd(5,af),bd(6,Yd),bd(7,sf)],kp);var Lp=class extends Cf{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(e=>this._removeDecoration(e))),this._register(Sf(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(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 t;let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer","top"===(null==(t=null==e?void 0:e.options)?void 0:t.layer)),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let 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;"right"===(e.options.anchor||"left")?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;null==(t=this._decorationElements.get(e))||t.remove(),this._decorationElements.delete(e),e.dispose()}};Lp=yd([bd(1,Hd),bd(2,tf),bd(3,Qd),bd(4,sf)],Lp);var Ep,Mp,Rp,Tp,Pp,Dp=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))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return 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,void this._zones.push(this._zonePool[this._zonePoolIndex++]);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)}},Bp={full:0,left:0,center:0,right:0},Ap={full:0,left:0,center:0,right:0},Np={full:0,left:0,center:0,right:0},Ip=class extends Cf{constructor(e,t,i,r,s,n,o,a){var l;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=r,this._renderService=s,this._optionsService=n,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new Dp,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(),null==(l=this._viewportElement.parentElement)||l.insertBefore(this._canvas,this._viewportElement),this._register(Sf(()=>{var e;return null==(e=this._canvas)?void 0:e.remove()}));let h=this._canvas.getContext("2d");if(!h)throw new Error("Ctx cannot be null");this._ctx=h,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(null==(e=this._optionsService.options.overviewRuler)?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ap.full=this._canvas.width,Ap.left=e,Ap.center=t,Ap.right=e,this._refreshDrawHeightConstants(),Np.full=1,Np.left=1,Np.center=1+Ap.left,Np.right=1+Ap.left+Ap.center}_refreshDrawHeightConstants(){Bp.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);Bp.left=t,Bp.center=t,Bp.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Bp.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Bp.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Bp.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Bp.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)"full"!==t.position&&this._renderColorZone(t);for(let t of e)"full"===t.position&&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(Np[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Bp[e.position||"full"]/2),Ap[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Bp[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Ip=yd([bd(2,Hd),bd(3,Qd),bd(4,sf),bd(5,Yd),bd(6,af),bd(7,tf)],Ip),(Mp=Ep||(Ep={})).NUL="\0",Mp.SOH="",Mp.STX="",Mp.ETX="",Mp.EOT="",Mp.ENQ="",Mp.ACK="",Mp.BEL="",Mp.BS="\b",Mp.HT="\t",Mp.LF="\n",Mp.VT="\v",Mp.FF="\f",Mp.CR="\r",Mp.SO="",Mp.SI="",Mp.DLE="",Mp.DC1="",Mp.DC2="",Mp.DC3="",Mp.DC4="",Mp.NAK="",Mp.SYN="",Mp.ETB="",Mp.CAN="",Mp.EM="",Mp.SUB="",Mp.ESC="",Mp.FS="",Mp.GS="",Mp.RS="",Mp.US="",Mp.SP=" ",Mp.DEL="",(Tp=Rp||(Rp={})).PAD="€",Tp.HOP="",Tp.BPH="‚",Tp.NBH="ƒ",Tp.IND="„",Tp.NEL="…",Tp.SSA="†",Tp.ESA="‡",Tp.HTS="ˆ",Tp.HTJ="‰",Tp.VTS="Š",Tp.PLD="‹",Tp.PLU="Œ",Tp.RI="",Tp.SS2="Ž",Tp.SS3="",Tp.DCS="",Tp.PU1="‘",Tp.PU2="’",Tp.STS="“",Tp.CCH="”",Tp.MW="•",Tp.SPA="–",Tp.EPA="—",Tp.SOS="˜",Tp.SGCI="™",Tp.SCI="š",Tp.CSI="›",Tp.ST="œ",Tp.OSC="",Tp.PM="ž",Tp.APC="Ÿ",(Pp||(Pp={})).ST=`${Ep.ESC}\\`;var Op=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(20===e.keyCode||229===e.keyCode||16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!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(`${Ep.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 e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Op=yd([bd(2,Hd),bd(3,Yd),bd(4,Ud),bd(5,sf)],Op);var zp,Fp,jp,Wp,Hp,$p=0,Up=0,Kp=0,qp=0,Vp={css:"#00000000",rgba:0};function Yp(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Gp(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}(e=>{e.toCss=function(e,t,i,r){return void 0!==r?`#${Yp(e)}${Yp(t)}${Yp(i)}${Yp(r)}`:`#${Yp(e)}${Yp(t)}${Yp(i)}`},e.toRgba=function(e,t,i,r=255){return(e<<24|t<<16|i<<8|r)>>>0},e.toColor=function(t,i,r,s){return{css:e.toCss(t,i,r,s),rgba:e.toRgba(t,i,r,s)}}})(zp||(zp={})),(e=>{function t(e,t){return qp=Math.round(255*t),[$p,Up,Kp]=Hp.toChannels(e.rgba),{css:zp.toCss($p,Up,Kp,qp),rgba:zp.toRgba($p,Up,Kp,qp)}}e.blend=function(e,t){if(1===(qp=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let i=t.rgba>>24&255,r=t.rgba>>16&255,s=t.rgba>>8&255,n=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return $p=n+Math.round((i-n)*qp),Up=o+Math.round((r-o)*qp),Kp=a+Math.round((s-a)*qp),{css:zp.toCss($p,Up,Kp),rgba:zp.toRgba($p,Up,Kp)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){let r=Hp.ensureContrastRatio(e.rgba,t.rgba,i);if(r)return zp.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[$p,Up,Kp]=Hp.toChannels(t),{css:zp.toCss($p,Up,Kp),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return t(e,(qp=255&e.rgba)*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}})(Fp||(Fp={})),(e=>{let t,i;try{let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d",{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return $p=parseInt(e.slice(1,2).repeat(2),16),Up=parseInt(e.slice(2,3).repeat(2),16),Kp=parseInt(e.slice(3,4).repeat(2),16),zp.toColor($p,Up,Kp);case 5:return $p=parseInt(e.slice(1,2).repeat(2),16),Up=parseInt(e.slice(2,3).repeat(2),16),Kp=parseInt(e.slice(3,4).repeat(2),16),qp=parseInt(e.slice(4,5).repeat(2),16),zp.toColor($p,Up,Kp,qp);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return $p=parseInt(r[1]),Up=parseInt(r[2]),Kp=parseInt(r[3]),qp=Math.round(255*(void 0===r[5]?1:parseFloat(r[5]))),zp.toColor($p,Up,Kp,qp);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[$p,Up,Kp,qp]=t.getImageData(0,0,1,1).data,255!==qp)throw new Error("css.toColor: Unsupported css format");return{rgba:zp.toRgba($p,Up,Kp,qp),css:e}}})(jp||(jp={})),(e=>{function t(e,t,i){let r=e/255,s=t/255,n=i/255;return.2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t})(Wp||(Wp={})),(e=>{function t(e,t,i){let r=e>>24&255,s=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,h=Gp(Wp.relativeLuminance2(o,a,l),Wp.relativeLuminance2(r,s,n));for(;h<i&&(o>0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),h=Gp(Wp.relativeLuminance2(o,a,l),Wp.relativeLuminance2(r,s,n));return(o<<24|a<<16|l<<8|255)>>>0}function i(e,t,i){let r=e>>24&255,s=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,h=Gp(Wp.relativeLuminance2(o,a,l),Wp.relativeLuminance2(r,s,n));for(;h<i&&(o<255||a<255||l<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),h=Gp(Wp.relativeLuminance2(o,a,l),Wp.relativeLuminance2(r,s,n));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(1===(qp=(255&t)/255))return t;let i=t>>24&255,r=t>>16&255,s=t>>8&255,n=e>>24&255,o=e>>16&255,a=e>>8&255;return $p=n+Math.round((i-n)*qp),Up=o+Math.round((r-o)*qp),Kp=a+Math.round((s-a)*qp),zp.toRgba($p,Up,Kp)},e.ensureContrastRatio=function(e,r,s){let n=Wp.relativeLuminance(e>>8),o=Wp.relativeLuminance(r>>8);if(Gp(n,o)<s){if(o<n){let o=t(e,r,s),a=Gp(n,Wp.relativeLuminance(o>>8));if(a<s){let t=i(e,r,s);return a>Gp(n,Wp.relativeLuminance(t>>8))?o:t}return o}let a=i(e,r,s),l=Gp(n,Wp.relativeLuminance(a>>8));if(l<s){let i=t(e,r,s);return l>Gp(n,Wp.relativeLuminance(i>>8))?a:i}return a}},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}})(Hp||(Hp={}));var Xp=class extends Nd{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()]}},Qp=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Od}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(0===this._characterJoiners.length)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];let i=[],r=t.translateToString(!0),s=0,n=0,o=0,a=t.getFg(0),l=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==a||this._workCell.bg!==l){if(h-s>1){let e=this._getJoinedRanges(r,o,n,t,s);for(let t=0;t<e.length;t++)i.push(e[t])}s=h,o=n,a=this._workCell.fg,l=this._workCell.bg}n+=this._workCell.getChars().length||1}if(this._bufferService.cols-s>1){let e=this._getJoinedRanges(r,o,n,t,s);for(let t=0;t<e.length;t++)i.push(e[t])}return i}_getJoinedRanges(e,t,i,r,s){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(vt){console.error(vt)}for(let l=1;l<this._characterJoiners.length;l++)try{let e=this._characterJoiners[l].handler(n);for(let t=0;t<e.length;t++)Qp._mergeRanges(o,e[t])}catch(a){console.error(a)}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 a=i;a<this._bufferService.cols;a++){let i=t.getWidth(a),l=t.getString(a).length||1;if(0!==i){if(!s&&o[0]<=n&&(o[0]=a,s=!0),o[1]<=n){if(o[1]=a,o=e[++r],!o)break;o[0]<=n?(o[0]=a,s=!0):s=!1}n+=l}}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)}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Qp=yd([bd(0,Hd)],Qp);var Jp=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 Od,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,a,l,h,c){let u=[],d=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,_=e.getNoBgTrimmedLength();i&&_<n+1&&(_=n+1);let p,g=0,v="",m=0,y=0,b=0,S=0,w=!1,x=0,C=!1,k=0,L=0,E=[],M=-1!==h&&-1!==c;for(let R=0;R<_;R++){e.loadCell(R,this._workCell);let _=this._workCell.getWidth();if(0===_)continue;let T=!1,P=R>=L,D=R,B=this._workCell;if(d.length>0&&R===d[0][0]&&P){let r=d.shift(),s=this._isCellInSelection(r[0],t);for(m=r[0]+1;m<r[1];m++)P&&(P=s===this._isCellInSelection(m,t));P&&(P=!i||n<r[0]||n>=r[1]),P?(T=!0,B=new Xp(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),D=r[1]-1,_=B.getWidth()):L=r[1]}let A=this._isCellInSelection(R,t),N=i&&R===n,I=M&&R>=h&&R<=c,O=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,e=>{O=!0});let z=B.getChars()||Ad;if(" "===z&&(B.isUnderline()||B.isOverline())&&(z=" "),k=_*a-l.get(z,B.isBold(),B.isItalic()),p){if(g&&(A&&C||!A&&!C&&B.bg===y)&&(A&&C&&f.selectionForeground||B.fg===b)&&B.extended.ext===S&&I===w&&k===x&&!N&&!T&&!O&&P){B.isInvisible()?v+=Ad:v+=z,g++;continue}g&&(p.textContent=v),p=this._document.createElement("span"),g=0,v=""}else p=this._document.createElement("span");if(y=B.bg,b=B.fg,S=B.extended.ext,w=I,x=k,C=A,T&&n>=R&&n<=D&&(n=R),!this._coreService.isCursorHidden&&N&&this._coreService.isCursorInitialized)if(E.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&E.push("xterm-cursor-blink"),E.push("bar"===r?"xterm-cursor-bar":"underline"===r?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":E.push("xterm-cursor-outline");break;case"block":E.push("xterm-cursor-block");break;case"bar":E.push("xterm-cursor-bar");break;case"underline":E.push("xterm-cursor-underline")}if(B.isBold()&&E.push("xterm-bold"),B.isItalic()&&E.push("xterm-italic"),B.isDim()&&E.push("xterm-dim"),v=B.isInvisible()?Ad:B.getChars()||Ad,B.isUnderline()&&(E.push(`xterm-underline-${B.extended.underlineStyle}`)," "===v&&(v=" "),!B.isUnderlineColorDefault()))if(B.isUnderlineColorRGB())p.style.textDecorationColor=`rgb(${Nd.toColorRGB(B.getUnderlineColor()).join(",")})`;else{let e=B.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&B.isBold()&&e<8&&(e+=8),p.style.textDecorationColor=f.ansi[e].css}B.isOverline()&&(E.push("xterm-overline")," "===v&&(v=" ")),B.isStrikethrough()&&E.push("xterm-strikethrough"),I&&(p.style.textDecoration="underline");let F=B.getFgColor(),j=B.getFgColorMode(),W=B.getBgColor(),H=B.getBgColorMode(),$=!!B.isInverse();if($){let e=F;F=W,W=e;let t=j;j=H,H=t}let U,K,q,V=!1;switch(this._decorationService.forEachDecorationAtCell(R,t,void 0,e=>{"top"!==e.options.layer&&V||(e.backgroundColorRGB&&(H=50331648,W=e.backgroundColorRGB.rgba>>8&16777215,U=e.backgroundColorRGB),e.foregroundColorRGB&&(j=50331648,F=e.foregroundColorRGB.rgba>>8&16777215,K=e.foregroundColorRGB),V="top"===e.options.layer)}),!V&&A&&(U=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,W=U.rgba>>8&16777215,H=50331648,V=!0,f.selectionForeground&&(j=50331648,F=f.selectionForeground.rgba>>8&16777215,K=f.selectionForeground)),V&&E.push("xterm-decoration-top"),H){case 16777216:case 33554432:q=f.ansi[W],E.push(`xterm-bg-${W}`);break;case 50331648:q=zp.toColor(W>>16,W>>8&255,255&W),this._addStyle(p,`background-color:#${Zp((W>>>0).toString(16),"0",6)}`);break;default:$?(q=f.foreground,E.push("xterm-bg-257")):q=f.background}switch(U||B.isDim()&&(U=Fp.multiplyOpacity(q,.5)),j){case 16777216:case 33554432:B.isBold()&&F<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(F+=8),this._applyMinimumContrast(p,q,f.ansi[F],B,U,void 0)||E.push(`xterm-fg-${F}`);break;case 50331648:let e=zp.toColor(F>>16&255,F>>8&255,255&F);this._applyMinimumContrast(p,q,e,B,U,K)||this._addStyle(p,`color:#${Zp(F.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(p,q,f.foreground,B,U,K)||$&&E.push("xterm-fg-257")}E.length&&(p.className=E.join(" "),E.length=0),N||T||O||!P?p.textContent=v:g++,k!==this.defaultSpacing&&(p.style.letterSpacing=`${k}px`),u.push(p),R=D}return p&&g&&(p.textContent=v),u}_applyMinimumContrast(e,t,i,r,s,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(function(e){return 57508<=e&&e<=57558}(o=r.getCode())||function(e){return 9472<=e&&e<=9631}(o)))return!1;var o;let a,l=this._getContrastCache(r);if(!s&&!n&&(a=l.getColor(t.rgba,i.rgba)),void 0===a){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=Fp.ensureContrastRatio(s||t,n||i,e),l.setColor((s||t).rgba,(n||i).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_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)&&(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])}};function Zp(e,t,i){for(;e.length<i;)e=t+e;return e}Jp=yd([bd(1,of),bd(2,Yd),bd(3,tf),bd(4,Ud),bd(5,Qd),bd(6,af)],Jp);var eg=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&&1===e.length&&(r=e.charCodeAt(0))<256){if(-9999!==this._flat[r])return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let s=e;t&&(s+="B"),i&&(s+="I");let n=this._holey.get(s);if(void 0===n){let r=0;t&&(r|=1),i&&(r|=2),n=this._measure(e,r),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}},tg=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])return void this.clear();let s=e.buffers.active.ydisp,n=t[1]-s,o=i[1]-s,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,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)}};var ig="xterm-dom-renderer-owner-",rg="xterm-rows",sg="xterm-fg-",ng="xterm-bg-",og="xterm-focus",ag="xterm-selection",lg=1,hg=class extends Cf{constructor(e,t,i,r,s,n,o,a,l,h,c,u,d,f){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=r,this._viewportElement=s,this._helperContainer=n,this._linkifier2=o,this._charSizeService=l,this._optionsService=h,this._bufferService=c,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=lg++,this._rowElements=[],this._selectionRenderModel=new tg,this.onRequestRedraw=this._register(new Hf).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(rg),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(ag),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}},this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(Jp,document),this._element.classList.add(ig+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(Sf(()=>{this._element.classList.remove(ig+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new eg(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} .${rg} 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} .${rg} { 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} .${rg} .xterm-dim { color: ${Fp.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} .${rg}.${og} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${rg}.${og} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${rg}.${og} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${rg} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${rg} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${rg} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${rg} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${rg} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ag} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ag} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ag} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${sg}${n} { color: ${o.css}; }${this._terminalSelector} .${sg}${n}.xterm-dim { color: ${Fp.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${ng}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${sg}257 { color: ${Fp.opaque(e.background).css}; }${this._terminalSelector} .${sg}257.xterm-dim { color: ${Fp.multiplyOpacity(Fp.opaque(e.background),.5).css}; }${this._terminalSelector} .${ng}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 e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}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(og),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(og),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,a=this._document.createDocumentFragment();if(i){let i=e[0]>t[0];a.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],o-n+1))}else{let i=r===n?e[0]:0,l=n===s?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,i,l));let h=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,h)),n!==o){let e=s===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(a)}_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,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let e=l+i.ydisp,t=this._rowElements[l],h=i.lines.get(e);if(!t||!h)break;t.replaceChildren(...this._rowFactory.createRow(h,e,e===r,o,a,s,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ig}${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 a=this._bufferService.buffer,l=a.ybase+a.y,h=Math.min(a.x,s-1),c=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=i;f<=r;++f){let o=f+a.ydisp,_=this._rowElements[f],p=a.lines.get(o);if(!_||!p)break;_.replaceChildren(...this._rowFactory.createRow(p,o,o===l,u,d,h,c,this.dimensions.css.cell.width,this._widthCache,n?f===i?e:0:-1,n?(f===r?t:s)-1:-1))}}};hg=yd([bd(7,qd),bd(8,ef),bd(9,Yd),bd(10,Hd),bd(11,Ud),bd(12,tf),bd(13,af)],hg);var cg=class extends Cf{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Hf),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new fg(this._optionsService))}catch{this._measureStrategy=this._register(new dg(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())}};cg=yd([bd(2,Yd)],cg);var ug=class extends Cf{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){void 0!==e&&e>0&&void 0!==t&&t>0&&(this._result.width=e,this._result.height=t)}},dg=class extends ug{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}},fg=class extends ug{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}},_g=class extends Cf{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 pg(this._window)),this._onDprChange=this._register(new Hf),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Hf),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Mf.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Y_(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Y_(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},pg=class extends Cf{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new kf),this._onDprChange=this._register(new Hf),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Sf(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Y_(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&(null==(e=this._resolutionMediaMatchList)||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)}},gg=class extends Cf{constructor(){super(),this.linkProviders=[],this._register(Sf(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);-1!==t&&this.linkProviders.splice(t,1)}}}};function vg(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]}var mg=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,s){return function(e,t,i,r,s,n,o,a,l){if(!n)return;let h=vg(e,t,i);return h?(h[0]=Math.ceil((h[0]+(l?o/2:0))/o),h[1]=Math.ceil(h[1]/a),h[0]=Math.min(Math.max(h[0],1),r+(l?1:0)),h[1]=Math.min(Math.max(h[1],1),s),h):void 0}(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=vg(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])}}};mg=yd([bd(0,sf),bd(1,ef)],mg);var yg=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=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();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=[]}},bg={};((e,t)=>{for(var i in t)vd(e,i,{get:t[i],enumerable:!0})})(bg,{getSafariVersion:()=>Eg,isChromeOS:()=>Bg,isFirefox:()=>Cg,isIpad:()=>Rg,isIphone:()=>Tg,isLegacyEdge:()=>kg,isLinux:()=>Dg,isMac:()=>Mg,isNode:()=>Sg,isSafari:()=>Lg,isWindows:()=>Pg});var Sg=typeof process<"u"&&"title"in process,wg=Sg?"node":navigator.userAgent,xg=Sg?"node":navigator.platform,Cg=wg.includes("Firefox"),kg=wg.includes("Edge"),Lg=/^((?!chrome|android).)*safari/i.test(wg);function Eg(){if(!Lg)return 0;let e=wg.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}var Mg=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(xg),Rg="iPad"===xg,Tg="iPhone"===xg,Pg=["Windows","Win16","Win32","WinCE"].includes(xg),Dg=xg.indexOf("Linux")>=0,Bg=/\bCrOS\b/.test(wg),Ag=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(),1.5*i>s)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=s}this.clear()}},Ng=!Sg&&"requestIdleCallback"in window?class extends Ag{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:class extends Ag{_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())}}},Ig=class{constructor(){this._queue=new Ng}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Og=class extends Cf{constructor(e,t,i,r,s,n,o,a,l){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=r,this._coreService=s,this._coreBrowserService=a,this._renderer=this._register(new kf),this._pausedResizeTask=new Ig,this._observerDisposable=this._register(new kf),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 Hf),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Hf),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Hf),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Hf),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new yg((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new zg(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Sf(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var e;return null==(e=this._renderer.value)?void 0:e.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(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=Sf(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!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)return void(this._needsFullRefresh=!0);if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);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)return void this._syncOutputHandler.bufferRows(e,t);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(e=>this.refreshRows(e.start,e.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&&(null==(t=(e=this._renderer.value).clearTextureAtlas)||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 null==(i=this._renderer.value)?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null==(e=this._renderer.value)||e.handleCharSizeChanged()}handleBlur(){var e;null==(e=this._renderer.value)||e.handleBlur()}handleFocus(){var e;null==(e=this._renderer.value)||e.handleFocus()}handleSelectionChanged(e,t,i){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,null==(r=this._renderer.value)||r.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;null==(e=this._renderer.value)||e.handleCursorMove()}clear(){var e;null==(e=this._renderer.value)||e.clear()}};Og=yd([bd(2,Yd),bd(3,ef),bd(4,Ud),bd(5,Qd),bd(6,Hd),bd(7,tf),bd(8,af)],Og);var zg=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),void 0===this._timeout&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(void 0!==this._timeout&&(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(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Fg(e,t,i,r){let s,n=i.buffer.x,o=i.buffer.y;if(!i.buffer.hasScrollback)return function(e,t,i,r,s,n){return 0===jg(t,r,s,n).length?"":Kg($g(e,t,e,t-Wg(t,s),!1,s).length,Ug("D",n))}(n,o,0,t,i,r)+jg(o,t,i,r)+function(e,t,i,r,s,n){let o;o=jg(t,r,s,n).length>0?r-Wg(r,s):t;let a=r,l=function(e,t,i,r,s,n){let o;return o=jg(i,r,s,n).length>0?r-Wg(r,s):t,e<i&&o<=r||e>=i&&o<r?"C":"D"}(e,t,i,r,s,n);return Kg($g(e,o,i,a,"C"===l,s).length,Ug(l,n))}(n,o,e,t,i,r);if(o===t)return s=n>e?"D":"C",Kg(Math.abs(n-e),Ug(s,r));s=o>t?"D":"C";let a=Math.abs(o-t),l=function(e,t){return t.cols-e}(o>t?e:n,i)+(a-1)*i.cols+1+function(e){return e-1}(o>t?n:e);return Kg(l,Ug(s,r))}function jg(e,t,i,r){let s=e-Wg(e,i),n=t-Wg(t,i),o=Math.abs(s-n)-function(e,t,i){var r;let s=0,n=e-Wg(e,i),o=t-Wg(t,i);for(let a=0;a<Math.abs(n-o);a++){let o="A"===Hg(e,t)?-1:1;(null==(r=i.buffer.lines.get(n+o*a))?void 0:r.isWrapped)&&s++}return s}(e,t,i);return Kg(o,Ug(Hg(e,t),r))}function Wg(e,t){let i=0,r=t.buffer.lines.get(e),s=null==r?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)i++,r=t.buffer.lines.get(--e),s=null==r?void 0:r.isWrapped;return i}function Hg(e,t){return e>t?"A":"B"}function $g(e,t,i,r,s,n){let o=e,a=t,l="";for(;(o!==i||a!==r)&&a>=0&&a<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!s&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,e,o)}function Ug(e,t){let i=t?"O":"[";return Ep.ESC+i+e}function Kg(e,t){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=t;return i}var qg=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.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)&&(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 Vg(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 Yg=new RegExp(" ","g"),Gg=class extends Cf{constructor(e,t,i,r,s,n,o,a,l){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=r,this._coreService=s,this._mouseService=n,this._optionsService=o,this._renderService=a,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Od,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Hf),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Hf),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Hf),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Hf),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new qg(this._bufferService),this._activeSelectionMode=0,this._register(Sf(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.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)&&(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(3===this._activeSelectionMode){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 e=i.translateBufferLineToString(o,!0,s,n);r.push(e)}}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 e=i.lines.get(n),t=i.translateBufferLineToString(n,!0);(null==e?void 0:e.isWrapped)?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=i.lines.get(t[1]),s=i.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=s:r.push(s)}}return r.map(e=>e.replace(Yg," ")).join(Pg?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Dg&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(i&&r&&t)&&this._areCoordsInSelection(t,i,r)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!i||!r)&&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 i,r;let s=null==(r=null==(i=this._linkifier.currentLink)?void 0:i.link)?void 0:r.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Vg(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return!!n&&(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0)}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=vg(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,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return Mg?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&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(),50)}_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]&&0===t.hasWidth(this._model.selectionStart[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&&!(Mg&&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)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(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 e=i.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[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?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(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<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){let e=Fg(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!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]);i?!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):this._oldHasSelection&&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(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;0===this._workCell.getWidth()?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),a=this._convertViewportColToCharacterIndex(n,e[0]),l=a,h=e[0]-a,c=0,u=0,d=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l<o.length&&" "===o.charAt(l+1);)l++}else{let t=e[0],i=e[0];0===n.getWidth(t)&&(c++,t--),2===n.getWidth(i)&&(u++,i++);let r=n.getString(i).length;for(r>1&&(f+=r-1,l+=r-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(c++,t--):e>1&&(d+=e-1,a-=e-1),a--,t--}for(;i<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(i+1,this._workCell));){n.loadCell(i+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,i++):e>1&&(f+=e-1,l+=e-1),l++,i++}}l++;let _=a+h-c+d,p=Math.min(this._bufferService.cols,l-a+c+u-d-f);if(t||""!==o.slice(a,l).trim()){if(i&&0===_&&32!==n.getCodePoint(0)){let t=s.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;_-=e,p+=e}}}if(r&&_+p===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){let t=s.lines.get(e[1]+1);if((null==t?void 0:t.isWrapped)&&32!==t.getCodePoint(0)){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(p+=t.length)}}return{start:_,length:p}}}_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 0!==e.getWidth()&&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=Vg(i,this._bufferService.cols)}};Gg=yd([bd(3,Hd),bd(4,Ud),bd(5,rf),bd(6,Yd),bd(7,sf),bd(8,tf)],Gg);var Xg=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={}}},Qg=class{constructor(){this._color=new Xg,this._css=new Xg}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()}},Jg=Object.freeze((()=>{let e=[jp.toColor("#2e3436"),jp.toColor("#cc0000"),jp.toColor("#4e9a06"),jp.toColor("#c4a000"),jp.toColor("#3465a4"),jp.toColor("#75507b"),jp.toColor("#06989a"),jp.toColor("#d3d7cf"),jp.toColor("#555753"),jp.toColor("#ef2929"),jp.toColor("#8ae234"),jp.toColor("#fce94f"),jp.toColor("#729fcf"),jp.toColor("#ad7fa8"),jp.toColor("#34e2e2"),jp.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:zp.toCss(r,s,n),rgba:zp.toRgba(r,s,n)})}for(let i=0;i<24;i++){let t=8+10*i;e.push({css:zp.toCss(t,t,t),rgba:zp.toRgba(t,t,t)})}return e})()),Zg=jp.toColor("#ffffff"),ev=jp.toColor("#000000"),tv=jp.toColor("#ffffff"),iv=ev,rv={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},sv=Zg,nv=class extends Cf{constructor(e){super(),this._optionsService=e,this._contrastCache=new Qg,this._halfContrastCache=new Qg,this._onChangeColors=this._register(new Hf),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Zg,background:ev,cursor:tv,cursorAccent:iv,selectionForeground:void 0,selectionBackgroundTransparent:rv,selectionBackgroundOpaque:Fp.blend(ev,rv),selectionInactiveBackgroundTransparent:rv,selectionInactiveBackgroundOpaque:Fp.blend(ev,rv),scrollbarSliderBackground:Fp.opacity(Zg,.2),scrollbarSliderHoverBackground:Fp.opacity(Zg,.4),scrollbarSliderActiveBackground:Fp.opacity(Zg,.5),overviewRulerBorder:Zg,ansi:Jg.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=ov(e.foreground,Zg),t.background=ov(e.background,ev),t.cursor=Fp.blend(t.background,ov(e.cursor,tv)),t.cursorAccent=Fp.blend(t.background,ov(e.cursorAccent,iv)),t.selectionBackgroundTransparent=ov(e.selectionBackground,rv),t.selectionBackgroundOpaque=Fp.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ov(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Fp.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ov(e.selectionForeground,Vp):void 0,t.selectionForeground===Vp&&(t.selectionForeground=void 0),Fp.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Fp.opacity(t.selectionBackgroundTransparent,.3)),Fp.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Fp.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ov(e.scrollbarSliderBackground,Fp.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ov(e.scrollbarSliderHoverBackground,Fp.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ov(e.scrollbarSliderActiveBackground,Fp.opacity(t.foreground,.5)),t.overviewRulerBorder=ov(e.overviewRulerBorder,sv),t.ansi=Jg.slice(),t.ansi[0]=ov(e.black,Jg[0]),t.ansi[1]=ov(e.red,Jg[1]),t.ansi[2]=ov(e.green,Jg[2]),t.ansi[3]=ov(e.yellow,Jg[3]),t.ansi[4]=ov(e.blue,Jg[4]),t.ansi[5]=ov(e.magenta,Jg[5]),t.ansi[6]=ov(e.cyan,Jg[6]),t.ansi[7]=ov(e.white,Jg[7]),t.ansi[8]=ov(e.brightBlack,Jg[8]),t.ansi[9]=ov(e.brightRed,Jg[9]),t.ansi[10]=ov(e.brightGreen,Jg[10]),t.ansi[11]=ov(e.brightYellow,Jg[11]),t.ansi[12]=ov(e.brightBlue,Jg[12]),t.ansi[13]=ov(e.brightMagenta,Jg[13]),t.ansi[14]=ov(e.brightCyan,Jg[14]),t.ansi[15]=ov(e.brightWhite,Jg[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]=ov(e.extendedAnsi[r],Jg[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(void 0!==e)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]}else for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t]}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()}}};function ov(e,t){if(void 0!==e)try{return jp.toColor(e)}catch{}return t}nv=yd([bd(0,Yd)],nv);var av=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)}},lv=class{constructor(){this._services=new av,this._services.set(qd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=(s=e,s[Fd]||[]).sort((e,t)=>e.index-t.index),r=[];var s;for(let o of i){let t=this._services.get(o.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);r.push(t)}let n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},hv={trace:0,debug:1,info:2,warn:3,error:4,off:5},cv=class extends Cf{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=hv[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};cv=yd([bd(0,Yd)],cv);var uv=class extends Cf{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Hf),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Hf),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Hf),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 i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+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 e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}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}},dv=Object.freeze(new Nd),fv=0,_v=class e{constructor(e,t,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||Od.fromCharData([0,"",1,0]);for(let s=0;s<e;++s)this.setCell(s,r);this.length=e}get(e){let t=this._data[3*e+0],i=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:i?Td(i):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){this._data[3*e+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[2]<<22):this._data[3*e+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?Td(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return fv=3*e,t.content=this._data[fv+0],t.fg=this._data[fv+1],t.bg=this._data[fv+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,i,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,t,i){let r=this._data[3*e+0];2097152&r?this._combined[e]+=Td(t):2097151&r?(this._combined[e]=Td(2097151&r)+Td(t),r&=-2097152,r|=2097152):r=t|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[3*e+0]=r}insertCells(e,t,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length-e){let r=new Od;for(let i=this.length-e-t-1;i>=0;--i)this.setCell(e+t+i,this.loadCell(e+i,r));for(let s=0;s<t;++s)this.setCell(e+s,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,t,i){if(e%=this.length,t<this.length-e){let r=new Od;for(let i=0;i<this.length-e-t;++i)this.setCell(e+i,this.loadCell(e+t+i,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),0===this.getWidth(e)&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,t,i,r=!1){if(r)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.setCell(e++,i)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{let e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i<e;++i)this.setCell(i,t)}else{this._data=this._data.subarray(0,i);let t=Object.keys(this._combined);for(let i=0;i<t.length;i++){let r=parseInt(t[i],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let i=0;i<r.length;i++){let t=parseInt(r[i],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,r,s){let n=e._data;if(s)for(let a=r-1;a>=0;a--){for(let e=0;e<3;e++)this._data[3*(i+a)+e]=n[3*(t+a)+e];268435456&n[3*(t+a)+2]&&(this._extendedAttrs[i+a]=e._extendedAttrs[t+a])}else for(let a=0;a<r;a++){for(let e=0;e<3;e++)this._data[3*(i+a)+e]=n[3*(t+a)+e];268435456&n[3*(t+a)+2]&&(this._extendedAttrs[i+a]=e._extendedAttrs[t+a])}let o=Object.keys(e._combined);for(let a=0;a<o.length;a++){let r=parseInt(o[a],10);r>=t&&(this._combined[r-t+i]=e._combined[r])}}translateToString(e,t,i,r){t=t??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let s="";for(;t<i;){let e=this._data[3*t+0],i=2097151&e,n=2097152&e?this._combined[t]:i?Td(i):Ad;if(s+=n,r)for(let s=0;s<n.length;++s)r.push(t);t+=e>>22||1}return r&&r.push(t),s}};function pv(e,t,i){let r=[],s=e.map((i,r)=>gv(e,r,t)).reduce((e,t)=>e+t),n=0,o=0,a=0;for(;a<s;){if(s-a<i){r.push(s-a);break}n+=i;let l=gv(e,o,t);n>l&&(n-=l,o++);let h=2===e[o].getWidth(n-1);h&&n--;let c=h?i-1:i;r.push(c),a+=c}return r}function gv(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),s=2===e[t+1].getWidth(0);return r&&s?i-1:i}var vv=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Hf),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),bf(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};vv._nextId=1;var mv=vv,yv={},bv=yv.B;yv[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:"≥","{":"π","|":"≠","}":"£","~":"·"},yv.A={"#":"£"},yv.B=void 0,yv[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},yv.C=yv[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},yv.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},yv.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},yv.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},yv.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},yv.E=yv[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},yv.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},yv.H=yv[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},yv["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Sv=4294967295,wv=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=dv.clone(),this.savedCharset=bv,this.markers=[],this._nullCell=Od.fromCharData([0,"",1,0]),this._whitespaceCell=Od.fromCharData([0,Ad,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ng,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new uv(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 Id),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 Id),this._whitespaceCell}getBlankLine(e,t){return new _v(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>Sv?Sv:t}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=dv);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 uv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(dv),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 t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,i);let n=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new _v(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 _v(e,i)));else for(let e=this._rows;e>t;e--)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 e=this.lines.length-s;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,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&&"conpty"===e.backend&&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=function(e,t,i,r,s,n){let o=[];for(let a=0;a<e.length-1;a++){let l=a,h=e.get(++l);if(!h.isWrapped)continue;let c=[e.get(a)];for(;l<e.length&&h.isWrapped;)c.push(h),h=e.get(++l);if(!n&&r>=a&&r<l){a+=c.length-1;continue}let u=0,d=gv(c,u,t),f=1,_=0;for(;f<c.length;){let e=gv(c,f,t),r=e-_,n=i-d,o=Math.min(r,n);c[u].copyCellsFrom(c[f],_,d,o,!1),d+=o,d===i&&(u++,d=0),_+=o,_===e&&(f++,_=0),0===d&&0!==u&&2===c[u-1].getWidth(i-1)&&(c[u].copyCellsFrom(c[u-1],i-1,d++,1,!1),c[u-1].setCell(i-1,s))}c[u].replaceCells(d,i,s);let p=0;for(let e=c.length-1;e>0&&(e>u||0===c[e].getTrimmedLength());e--)p++;p>0&&(o.push(a+c.length-p),o.push(p)),a+=c.length-1}return o}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(dv),i);if(r.length>0){let i=function(e,t){let i=[],r=0,s=t[r],n=0;for(let o=0;o<e.length;o++)if(s===o){let i=t[++r];e.onDeleteEmitter.fire({index:o-n,amount:i}),o+=i-1,n+=i,s=t[++r]}else i.push(o);return{layout:i,countRemoved:n}}(this.lines,r);(function(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})(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(dv),s=i;for(;s-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new _v(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(dv),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!i){let e=this.ybase+this.y;if(e>=o&&e<o+l.length)continue}let h,c=l[l.length-1].getTrimmedLength(),u=pv(l,this._cols,e),d=u.length-l.length;h=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let f=[];for(let e=0;e<d;e++){let e=this.getBlankLine(dv,!0);f.push(e)}f.length>0&&(s.push({start:o+l.length+n,newLines:f}),n+=f.length),l.push(...f);let _=u.length-1,p=u[_];0===p&&(_--,p=u[_]);let g=l.length-d-1,v=c;for(;g>=0;){let e=Math.min(v,p);if(void 0===l[_])break;if(l[_].copyCellsFrom(l[g],v-e,p-e,e,!0),p-=e,0===p&&(_--,p=u[_]),v-=e,0===v){g--,v=gv(l,Math.max(g,0),this._cols)}}for(let t=0;t<l.length;t++)u[t]<e&&l[t].setCell(u[t],r);let m=d-h;for(;m-- >0;)0===this.ybase?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+d,this.ybase+t-1)}if(s.length>0){let e=[],t=[];for(let s=0;s<this.lines.length;s++)t.push(this.lines.get(s));let i=this.lines.length,r=i-1,o=0,a=s[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let l=0;for(let u=Math.min(this.lines.maxLength-1,i+n-1);u>=0;u--)if(a&&a.start>r+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(u--,a.newLines[e]);u++,e.push({index:r+1,amount:a.newLines.length}),l+=a.newLines.length,a=s[++o]}else this.lines.set(u,t[r--]);let h=0;for(let s=e.length-1;s>=0;s--)e[s].index+=h,this.lines.onInsertEmitter.fire(e[s]),h+=e[s].amount;let c=Math.max(0,i+n-this.lines.maxLength);c>0&&this.lines.onTrimEmitter.fire(c)}}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(null!=e?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(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(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 mv(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},xv=class extends Cf{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Hf),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 wv(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new wv(!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)}},Cv=class extends Cf{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Hf),this.onResize=this._onResize.event,this._onScroll=this._register(new Hf),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new xv(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.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,r=this.buffer;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=r.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let s=r.ybase+r.scrollTop,n=r.ybase+r.scrollBottom;if(0===r.scrollTop){let e=r.lines.isFull;n===r.lines.length-1?e?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(n+1,0,i.clone()),e?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let e=n-s+1;r.lines.shiftElements(s+1,e-1,-1),r.lines.set(n,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(0===i.ydisp)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))}};Cv=yd([bd(0,Yd)],Cv);var kv={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:Mg,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Lv=["normal","bold","100","200","300","400","500","600","700","800","900"],Ev=class extends Cf{constructor(e){super(),this._onOptionChange=this._register(new Hf),this.onOptionChange=this._onOptionChange.event;let t={...kv};for(let i in e)if(i in t)try{let r=e[i];t[i]=this._sanitizeAndValidateOption(i,r)}catch(sp){console.error(sp)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Sf(()=>{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=>{-1!==e.indexOf(i)&&t()})}_setupOptions(){let e=e=>{if(!(e in kv))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in kv))throw new Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};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=kv[e]),"block"!==(i=t)&&"underline"!==i&&"bar"!==i)throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=kv[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof t&&1<=t&&t<=1e3)break;t=Lv.includes(t)?t:kv[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(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<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&&0!==t)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}var i;return t}};function Mv(e,t=5){if("object"!=typeof e)return e;let i=Array.isArray(e)?[]:{};for(let r in e)i[r]=t<=1?e[r]:e[r]&&Mv(e[r],t-1);return i}var Rv=Object.freeze({insertMode:!1}),Tv=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Pv=class extends Cf{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 Hf),this.onData=this._onData.event,this._onUserInput=this._register(new Hf),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Hf),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Hf),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Mv(Rv),this.decPrivateModes=Mv(Tv)}reset(){this.modes=Mv(Rv),this.decPrivateModes=Mv(Tv)}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(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};Pv=yd([bd(0,Hd),bd(1,Vd),bd(2,Yd)],Pv);var Dv={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>!(32===e.action&&3===e.button)},ANY:{events:31,restrict:e=>!0}};function Bv(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0===e.action&&!t&&(i|=3)),i}var Av=String.fromCharCode,Nv={DEFAULT:e=>{let t=[Bv(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`${Av(t[0])}${Av(t[1])}${Av(t[2])}`},SGR:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${Bv(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${Bv(e,!0)};${e.x};${e.y}${t}`}},Iv=class extends Cf{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 Hf),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Dv))this.addProtocol(r,Dv[r]);for(let r of Object.keys(Nv))this.addEncoding(r,Nv[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 0!==this._protocols[this._activeProtocol].events}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(0===e.deltaY||e.shiftKey||void 0===t||void 0===i)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||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_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)}};Iv=yd([bd(0,Hd),bd(1,Ud),bd(2,Yd)],Iv);var Ov,zv=[[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]],Fv=[[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]];var jv=class{constructor(){if(this.version="6",!Ov){(Ov=new Uint8Array(65536)).fill(1),Ov[0]=0,Ov.fill(0,1,32),Ov.fill(0,127,160),Ov.fill(2,4352,4448),Ov[9001]=2,Ov[9002]=2,Ov.fill(2,11904,42192),Ov[12351]=1,Ov.fill(2,44032,55204),Ov.fill(2,63744,64256),Ov.fill(2,65040,65050),Ov.fill(2,65072,65136),Ov.fill(2,65280,65377),Ov.fill(2,65504,65511);for(let e=0;e<zv.length;++e)Ov.fill(0,zv[e][0],zv[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ov[e]:function(e,t){let i,r=0,s=t.length-1;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=r;)if(i=r+s>>1,e>t[i][1])r=i+1;else{if(!(e<t[i][0]))return!0;s=i-1}return!1}(e,Fv)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=0===i&&0!==t;if(r){let e=Wv.extractWidth(t);0===e?r=!1:e>i&&(i=e)}return Wv.createPropertyValue(0,i,r)}},Wv=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Hf,this.onChange=this._onChange.event;let e=new jv;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(16777215&e)<<3|(3&t)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(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 e=t.charCodeAt(n);56320<=e&&e<=57343?o=1024*(o-55296)+e-56320+65536:i+=this.wcwidth(e)}let a=this.charProperties(o,r),l=e.extractWidth(a);e.extractShouldJoin(a)&&(l-=e.extractWidth(r)),i+=l,r=a}return i}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Hv=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 $v(e){var t;let i=null==(t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))?void 0:t.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=0!==i[3]&&32!==i[3])}var Uv=2147483647,Kv=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new e;if(!t.length)return i;for(let e=Array.isArray(t[0])?1:0;e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)i.addSubParam(r[e]);else i.addParam(r)}return i}clone(){let t=new e(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 e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let i=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Uv?Uv:e}}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)return void(this._rejectSubDigits=!0);if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Uv?Uv:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let i=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-i>0&&(e[t]=this._subParams.slice(i,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[t-1];i[t-1]=~r?Math.min(10*r+e,Uv):e}},qv=[],Vv=class{constructor(){this._state=0,this._active=qv,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let e=i.indexOf(t);-1!==e&&i.splice(e,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=qv}reset(){if(2===this._state)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=qv,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||qv,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i);else this._handlerFb(this._id,"PUT",Pd(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t<i;){let i=e[t++];if(59===i){this._state=2,this._start();break}if(i<48||57<i)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+i-48}2===this._state&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){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&&!1===i){for(;r>=0&&(i=this._active[r].end(e),!0!==i);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}else this._handlerFb(this._id,"END",e);this._active=qv,this._id=-1,this._state=0}}},Yv=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+=Pd(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(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}},Gv=[],Xv=class{constructor(){this._handlers=Object.create(null),this._active=Gv,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gv}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let e=i.indexOf(t);-1!==e&&i.splice(e,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=Gv,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Gv,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,i){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i);else this._handlerFb(this._ident,"PUT",Pd(e,t,i))}unhook(e,t=!0){if(this._active.length){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&&!1===i){for(;r>=0&&(i=this._active[r].unhook(e),!0!==i);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}else this._handlerFb(this._ident,"UNHOOK",e);this._active=Gv,this._ident=0}},Qv=new Kv;Qv.addParam(0);var Jv=class{constructor(e){this._handler=e,this._data="",this._params=Qv,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Qv,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Pd(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(e=>(this._params=Qv,this._data="",this._hitLimit=!1,e));return this._params=Qv,this._data="",this._hitLimit=!1,t}},Zv=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}},em=160,tm=function(){let e=new Zv(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),i=(e,i)=>t.slice(e,i),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n,o=i(0,14);for(n in e.setDefault(1,0),e.addMany(r,0,2,0),o)e.addMany([24,26,153,154],n,3,0),e.addMany(i(128,144),n,3,0),e.addMany(i(144,152),n,3,0),e.add(156,n,0,0),e.add(27,n,11,1),e.add(157,n,4,8),e.addMany([152,158,159],n,0,7),e.add(155,n,11,3),e.add(144,n,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(em,0,2,0),e.add(em,8,5,8),e.add(em,6,0,6),e.add(em,11,0,11),e.add(em,13,13,13),e}(),im=class extends Cf{constructor(e=tm){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 Kv,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,i)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Sf(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Vv),this._dcsParser=this._register(new Xv),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 t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=r}}if(1!==e.final.length)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(255&e)),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]);void 0===this._escHandlers[i]&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(t),{dispose:()=>{let e=r.indexOf(t);-1!==e&&r.splice(e,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);void 0===this._csiHandlers[i]&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(t),{dispose:()=>{let e=r.indexOf(t);-1!==e&&r.splice(e,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,0!==this._parseStack.state&&(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,s=0,n=0,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let t=this._parseStack.handlers,n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&n>-1)for(;n>=0&&(r=t[n](this._params),!0!==r);n--)if(r instanceof Promise)return this._parseStack.handlerPos=n,r;this._parseStack.handlers=[];break;case 4:if(!1===i&&n>-1)for(;n>=0&&(r=t[n](),!0!==r);n--)if(r instanceof Promise)return this._parseStack.handlerPos=n,r;this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(24!==s&&26!==s,i),r)return r;27===s&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],r=this._oscParser.end(24!==s&&26!==s,i),r)return r;27===s&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let a=o;a<t;++a){switch(s=e[a],n=this._transitions.table[this.currentState<<8|(s<160?s:em)],n>>4){case 2:for(let r=a+1;;++r){if(r>=t||(s=e[r])<32||s>126&&s<em){this._printHandler(e,a,r),a=r-1;break}if(++r>=t||(s=e[r])<32||s>126&&s<em){this._printHandler(e,a,r),a=r-1;break}if(++r>=t||(s=e[r])<32||s>126&&s<em){this._printHandler(e,a,r),a=r-1;break}if(++r>=t||(s=e[r])<32||s>126&&s<em){this._printHandler(e,a,r),a=r-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let i=this._csiHandlers[this._collect<<8|s],o=i?i.length-1:-1;for(;o>=0&&(r=i[o](this._params),!0!==r);o--)if(r instanceof Promise)return this._preserveStack(3,i,o,n,a),r;o<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do{switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let l=this._escHandlers[this._collect<<8|s],h=l?l.length-1:-1;for(;h>=0&&(r=l[h](),!0!==r);h--)if(r instanceof Promise)return this._preserveStack(4,l,h,n,a),r;h<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let r=a+1;;++r)if(r>=t||24===(s=e[r])||26===s||27===s||s>127&&s<em){this._dcsParser.put(e,a,r),a=r-1;break}break;case 14:if(r=this._dcsParser.unhook(24!==s&&26!==s),r)return this._preserveStack(6,[],0,n,a),r;27===s&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=a+1;;r++)if(r>=t||(s=e[r])<32||s>127&&s<em){this._oscParser.put(e,a,r),a=r-1;break}break;case 6:if(r=this._oscParser.end(24!==s&&26!==s),r)return this._preserveStack(5,[],0,n,a),r;27===s&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&n}}},rm=/^([\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})$/,sm=/^[\da-f]+$/;function nm(e){if(!e)return;let t=e.toLowerCase();if(0===t.indexOf("rgb:")){t=t.slice(4);let e=rm.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(0===t.indexOf("#")&&(t=t.slice(1),sm.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,i=[0,0,0];for(let r=0;r<3;++r){let s=parseInt(t.slice(e*r,e*r+e),16);i[r]=1===e?s<<4:2===e?s:3===e?s>>4:s>>8}return i}}function om(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 am(e,t=16){let[i,r,s]=e;return`rgb:${om(i,t)}/${om(r,t)}/${om(s,t)}`}var lm={"(":0,")":1,"*":2,"+":3,"-":1,".":2},hm=131072;function cm(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 um=0,dm=class extends Cf{constructor(e,t,i,r,s,n,o,a,l=new im){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Dd,this._utf8Decoder=new Bd,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=dv.clone(),this._eraseAttrDataInternal=dv.clone(),this._onRequestBell=this._register(new Hf),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Hf),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Hf),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Hf),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Hf),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Hf),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Hf),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Hf),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Hf),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Hf),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Hf),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Hf),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Hf),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 fm(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,i)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})}),this._parser.setDcsHandlerFallback((e,t,i)=>{"HOOK"===t&&(i=i.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setPrintHandler((e,t,i)=>this.print(e,t,i)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Ep.BEL,()=>this.bell()),this._parser.setExecuteHandler(Ep.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ep.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Ep.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ep.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Ep.BS,()=>this.backspace()),this._parser.setExecuteHandler(Ep.HT,()=>this.tab()),this._parser.setExecuteHandler(Ep.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Ep.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Rp.IND,()=>this.index()),this._parser.setExecuteHandler(Rp.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Rp.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Yv(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Yv(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Yv(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Yv(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Yv(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Yv(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Yv(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Yv(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Yv(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Yv(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Yv(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Yv(e=>this.restoreCursorColor(e))),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 h in yv)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Jv((e,t)=>this.requestStatusString(e,t)))}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((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 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>hm&&(n=this._parseStack.position+hm)}if(this._logService.logLevel<=1&&this._logService.debug("parsing data "+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`)),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<hm&&(this._parseBuffer=new Uint32Array(Math.min(e.length,hm))),o||this._dirtyRowTracker.clearRange(),e.length>hm)for(let h=n;h<e.length;h+=hm){let t=h+hm<e.length?h+hm:e.length,n="string"==typeof e?this._stringDecoder.decode(e.substring(h,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,t),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,n))return this._preserveStack(r,s,n,h),this._logSlowResolvingAsync(i),i}else if(!o){let t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,s,t,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,c=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&2===u.getWidth(this._activeBuffer.x-1)&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let d=this._parser.precedingJoinState;for(let f=t;f<i;++f){if(r=e[f],r<127&&n){let e=n[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,d);s=Wv.extractWidth(t);let i=Wv.extractShouldJoin(t),_=i?Wv.extractWidth(d):0;if(d=t,o&&this._onA11yChar.fire(Td(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-_>a)if(l){let e=u,t=this._activeBuffer.x-_;for(this._activeBuffer.x=_,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),_>0&&u instanceof _v&&u.copyCellsFrom(e,t,0,_,!1);t<a;)e.setCellFromCodepoint(t++,0,1,c)}else if(this._activeBuffer.x=a-1,2===s)continue;if(i&&this._activeBuffer.x){let e=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-e,r,s);for(let t=s-_;--t>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(h&&(u.insertCells(this._activeBuffer.x,s-_,this._activeBuffer.getNullCell(c)),2===u.getWidth(a-1)&&u.setCellFromCodepoint(a-1,0,1,c)),u.setCellFromCodepoint(this._activeBuffer.x++,r,s,c),s>0)for(;--s;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&i-t>0&&0===u.getWidth(this._activeBuffer.x)&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!cm(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Jv(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Yv(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(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(null==(e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))?void 0: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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(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 1===t&&(this._curAttrData.bg|=536870912),(2===t||0===t)&&(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 i;let r;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!(null==(i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))?void 0:i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}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,0===this._activeBuffer.x,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)}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,r=this._activeBuffer.ybase+this._activeBuffer.y;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(r,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}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(dv));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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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=Wv.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),a=0;for(let h=0;h<n.length;){let e=n.codePointAt(h)||0;o[a++]=e,h+=e>65535?2:1}let l=a;for(let h=1;h<i;++h)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Ep.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Ep.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Ep.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Ep.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Ep.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}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}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,bv),this._charsetService.setgCharset(1,bv),this._charsetService.setgCharset(2,bv),this._charsetService.setgCharset(3,bv);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}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}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:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[t]&&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)}return!0}requestMode(e,t){let i;var r;(r=i||(i={}))[r.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",r[r.SET=1]="SET",r[r.RESET=2]="RESET",r[r.PERMANENTLY_SET=3]="PERMANENTLY_SET",r[r.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let s=this._coreService.decPrivateModes,{activeProtocol:n,activeEncoding:o}=this._coreMouseService,a=this._coreService,{buffers:l,cols:h}=this._bufferService,{active:c,alt:u}=l,d=this._optionsService.rawOptions,f=(e,i)=>(a.triggerDataEvent(`${Ep.ESC}[${t?"":"?"}${e};${i}$y`),!0),_=e=>e?1:2,p=e.params[0];return f(p,t?2===p?4:4===p?_(a.modes.insertMode):12===p?3:20===p?_(d.convertEol):0:1===p?_(s.applicationCursorKeys):3===p?d.windowOptions.setWinLines?80===h?2:132===h?1:0:0:6===p?_(s.origin):7===p?_(s.wraparound):8===p?3:9===p?_("X10"===n):12===p?_(d.cursorBlink):25===p?_(!a.isCursorHidden):45===p?_(s.reverseWraparound):66===p?_(s.applicationKeypad):67===p?4:1e3===p?_("VT200"===n):1002===p?_("DRAG"===n):1003===p?_("ANY"===n):1004===p?_(s.sendFocus):1005===p?4:1006===p?_("SGR"===o):1015===p?4:1016===p?_("SGR_PIXELS"===o):1048===p?1:47===p||1047===p||1049===p?_(c===u):2004===p?_(s.bracketedPasteMode):2026===p?_(s.synchronizedOutput):0)}_updateAttrColor(e,t,i,r,s){return 2===t?(e|=50331648,e&=-16777216,e|=Nd.fromColorRGB([i,r,s])):5===t&&(e&=-50331904,e|=33554432|255&i),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 i=e.getSubParams(t+n),o=0;do{5===r[1]&&(s=1),r[n+o+1+s]=i[o]}while(++o<i.length&&o+n+1+s<r.length);break}if(5===r[1]&&n+s>=2||2===r[1]&&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)-1===r[o]&&(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,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=dv.fg,e.bg=dv.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let t,i=e.length,r=this._curAttrData;for(let s=0;s<i;s++)t=e.params[s],t>=30&&t<=37?(r.fg&=-50331904,r.fg|=16777216|t-30):t>=40&&t<=47?(r.bg&=-50331904,r.bg|=16777216|t-40):t>=90&&t<=97?(r.fg&=-50331904,r.fg|=16777224|t-90):t>=100&&t<=107?(r.bg&=-50331904,r.bg|=16777224|t-100):0===t?this._processSGR0(r):1===t?r.fg|=134217728:3===t?r.bg|=67108864:4===t?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):5===t?r.fg|=536870912:7===t?r.fg|=67108864:8===t?r.fg|=1073741824:9===t?r.fg|=2147483648:2===t?r.bg|=134217728:21===t?this._processUnderline(2,r):22===t?(r.fg&=-134217729,r.bg&=-134217729):23===t?r.bg&=-67108865:24===t?(r.fg&=-268435457,this._processUnderline(0,r)):25===t?r.fg&=-536870913:27===t?r.fg&=-67108865:28===t?r.fg&=-1073741825:29===t?r.fg&=2147483647:39===t?(r.fg&=-67108864,r.fg|=16777215&dv.fg):49===t?(r.bg&=-67108864,r.bg|=16777215&dv.bg):38===t||48===t||58===t?s+=this._extractColor(e,s,r):53===t?r.bg|=1073741824:55===t?r.bg&=-1073741825:59===t?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):100===t?(r.fg&=-67108864,r.fg|=16777215&dv.fg,r.bg&=-67108864,r.bg|=16777215&dv.bg):this._logService.debug("Unknown SGR attribute: %d.",t);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Ep.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Ep.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Ep.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=dv.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=0===e.length?1:e.params[0];if(0===t)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"}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t,i=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0}windowOptions(e){if(!cm(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Ep.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===t||2===t)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===t||1===t)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===t||2===t)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===t||1===t)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}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 e=i.shift(),r=i.shift();if(/^\d+$/.exec(e)){let i=parseInt(e);if(_m(i))if("?"===r)t.push({type:0,index:i});else{let e=nm(r);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(-1===t)return!0;let i=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(i,r):!i.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i,r=e.split(":"),s=r.findIndex(e=>e.startsWith("id="));return-1!==s&&(i=r[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,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 e=nm(i[r]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}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 e=parseInt(i[r]);_m(e)&&t.push({type:2,index:e})}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,bv),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(lm[e[0]],yv[e[1]]||bv),!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=dv.clone(),this._eraseAttrDataInternal=dv.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Od;e.content=4194373,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=this._bufferService.buffer,r=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${Ep.ESC}${e}${Ep.ESC}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},fm=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&&(um=e,e=t,t=um),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function _m(e){return 0<=e&&e<256}fm=yd([bd(0,Hd)],fm);var pm=class extends Cf{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 Hf),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();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 e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){let e=e=>performance.now()-i>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(i,e);return void r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-i>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}},gm=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(void 0===e.id){let i=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(r,i)),this._dataByLinkId.set(r.id,r),r.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(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(i,e))}}getLinkData(e){var t;return null==(t=this._dataByLinkId.get(e))?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};gm=yd([bd(0,Hd)],gm);var vm=!1,mm=class extends Cf{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new kf),this._onBinary=this._register(new Hf),this.onBinary=this._onBinary.event,this._onData=this._register(new Hf),this.onData=this._onData.event,this._onLineFeed=this._register(new Hf),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Hf),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Hf),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Hf),this._instantiationService=new lv,this.optionsService=this._register(new Ev(e)),this._instantiationService.setService(Yd,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Cv)),this._instantiationService.setService(Hd,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(cv)),this._instantiationService.setService(Vd,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Pv)),this._instantiationService.setService(Ud,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Iv)),this._instantiationService.setService($d,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Wv)),this._instantiationService.setService(Xd,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Hv),this._instantiationService.setService(Kd,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(gm),this._instantiationService.setService(Gd,this._oscLinkService),this._inputHandler=this._register(new dm(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Mf.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Mf.forward(this._bufferService.onResize,this._onResize)),this._register(Mf.forward(this.coreService.onData,this._onData)),this._register(Mf.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 pm((e,t)=>this._inputHandler.parse(e,t))),this._register(Mf.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Hf),this._onScroll.event(e=>{var t;null==(t=this._onScrollApi)||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&&!vm&&(this._logService.warn("writeSync is unreliable and will be removed soon."),vm=!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,2),t=Math.max(t,1),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;0!==t&&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&&void 0!==t.buildNumber&&void 0!==t.buildNumber?e="conpty"===t.backend&&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($v.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>($v(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Sf(()=>{for(let t of e)t.dispose()})}}},ym={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:["'",'"']};var bm=0,Sm=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ng,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ng,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(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),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(),0===this._array.length)return!1;let t=this._getKey(e);if(void 0===t||-1===(bm=this._search(t))||this._getKey(this._array[bm])!==t)return!1;do{if(this._array[bm]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(bm),!0}while(++bm<this._array.length&&this._getKey(this._array[bm])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),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(),0!==this._array.length&&(!((bm=this._search(e))<0||bm>=this._array.length)&&this._getKey(this._array[bm])===e))do{yield this._array[bm]}while(++bm<this._array.length&&this._getKey(this._array[bm])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((bm=this._search(e))<0||bm>=this._array.length)&&this._getKey(this._array[bm])===e))do{t(this._array[bm])}while(++bm<this._array.length&&this._getKey(this._array[bm])===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)){for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}},wm=0,xm=0,Cm=class extends Cf{constructor(){super(),this._decorations=new Sm(e=>null==e?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Hf),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Hf),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Sf(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new km(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.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,t=>{wm=t.options.x??0,xm=wm+(t.options.width??1),e>=wm&&e<xm&&(!i||(t.options.layer??"bottom")===i)&&r(t)})}},km=class extends xf{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Hf),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Hf),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 null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=jp.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=jp.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Lm=class{constructor(e,t=1e3){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=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?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 e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)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)}},Em=class extends Cf{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=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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 Lm(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(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Y_(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Sf(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=kd())))}_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 e=i.lines.get(i.ydisp+s),t=[],n=(null==e?void 0:e.translateToString(!0,void 0,void 0,t))||"",o=(i.ydisp+s+1).toString(),a=this._rowElements[s];a&&(0===n.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=n,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",r),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i,r,s=e.target,n=this._rowElements[0===t?1:this._rowElements.length-2];if(s.getAttribute("aria-posinset")!==(0===t?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===n){if(0===t?(i=s,r=this._rowElements.pop(),this._rowContainer.removeChild(r)):(i=this._rowElements.shift(),r=s,this._rowContainer.removeChild(i)),i.removeEventListener("focus",this._topBoundaryFocusListener),r.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){var e;if(0===this._rowElements.length)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed)return void(this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection());if(!t.anchorNode||!t.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:t.anchorNode,offset:t.anchorOffset},r={node:t.focusNode,offset:t.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let s=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:s,offset:(null==(e=s.textContent)?void 0:e.length)??0}),!this._rowContainer.contains(r.node))return;let n=({node:e,offset:t})=>{let i=e instanceof Text?e.parentNode:e,r=parseInt(null==i?void 0:i.getAttribute("aria-posinset"),10)-1;if(isNaN(r))return console.warn("row is invalid. Race condition?"),null;let s=this._rowColumns.get(i);if(!s)return console.warn("columns is null. Race condition?"),null;let n=t<s.length?s[t]:s.slice(-1)[0]+1;return n>=this._terminal.cols&&(++r,n=0),{row:r,column:n}},o=n(i),a=n(r);if(o&&a){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.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 t,i;e.style.transform="";let r=e.getBoundingClientRect().width,s=null==(i=null==(t=this._rowColumns.get(e))?void 0:t.slice(-1))?void 0:i[0];if(!s)return;let n=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/r})`}};Em=yd([bd(1,qd),bd(2,tf),bd(3,sf)],Em);var Mm=class extends Cf{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 Hf),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Hf),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Sf(()=>{var e;bf(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,null==(e=this._activeProviderReplies)||e.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Y_(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Y_(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Y_(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Y_(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(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 e=i[r];if(e.classList.contains("xterm"))break;if(e.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)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,r;(!this._activeProviderReplies||!t)&&(null==(i=this._activeProviderReplies)||i.forEach(e=>{null==e||e.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?(null==(r=this._activeProviderReplies)?void 0:r.get(n))&&(s=this._checkLinkProviderResult(n,e,s)):o.provideLinks(e.y,t=>{var i,r;if(this._isMouseOut)return;let o=null==t?void 0:t.map(e=>({link:e}));null==(i=this._activeProviderReplies)||i.set(n,o),s=this._checkLinkProviderResult(n,e,s),(null==(r=this._activeProviderReplies)?void 0:r.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 t=0;t<s.length;t++){let r=s[t],n=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){s.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){var r;if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(e),n=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(n=!0);if(!n&&s){let e=s.find(e=>this._linkAtPosition(e.link,t));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let e=null==(r=this._activeProviderReplies.get(o))?void 0:r.find(e=>this._linkAtPosition(e.link,t));if(e){i=!0,this._handleNewLink(e);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);var i,r;t&&this._mouseDownLink&&(i=this._mouseDownLink.link,r=this._currentLink.link,i.text===r.text&&i.range.start.x===r.range.start.x&&i.range.start.y===r.range.start.y&&i.range.end.x===r.range.end.x&&i.range.end.y===r.range.end.y)&&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,bf(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:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||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 e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.pointerCursor},set:e=>{var t;(null==(t=this._currentLink)?void 0:t.state)&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>{var e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.underline},set:t=>{var i,r,s;(null==(i=this._currentLink)?void 0:i.state)&&(null==(s=null==(r=this._currentLink)?void 0:r.state)?void 0:s.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,i){var r;(null==(r=this._currentLink)?void 0: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;(null==(r=this._currentLink)?void 0: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}}};Mm=yd([bd(1,rf),bd(2,sf),bd(3,Hd),bd(4,lf)],Mm);var Rm=class extends mm{constructor(e={}){super(e),this._linkifier=this._register(new kf),this.browser=bg,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new kf),this._onCursorMove=this._register(new Hf),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Hf),this.onKey=this._onKey.event,this._onRender=this._register(new Hf),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Hf),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Hf),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Hf),this.onBell=this._onBell.event,this._onFocus=this._register(new Hf),this._onBlur=this._register(new Hf),this._onA11yCharEmitter=this._register(new Hf),this._onA11yTabEmitter=this._register(new Hf),this._onWillOpen=this._register(new Hf),this._setup(),this._decorationService=this._instantiationService.createInstance(Cm),this._instantiationService.setService(Qd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(gg),this._instantiationService.setService(lf,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Jd)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh((null==e?void 0:e.start)??0,(null==e?void 0:e.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Mf.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Mf.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Mf.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Mf.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Sf(()=>{var e,t;this._customKeyEventHandler=void 0,null==(t=null==(e=this.element)?void 0:e.parentNode)||t.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 e,i="";switch(t.index){case 256:e="foreground",i="10";break;case 257:e="background",i="11";break;case 258:e="cursor",i="12";break;default:e="ansi",i="4;"+t.index}switch(t.type){case 0:let r=Fp.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Ep.ESC}]${i};${am(r)}${Pp.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=zp.toColor(...t.color));else{let i=e;this._themeService.modifyColors(e=>e[i]=zp.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_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(Em,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ep.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return null==(e=this.textarea)?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ep.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,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"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(Y_(this.element,"copy",e=>{var t,i;this.hasSelection()&&(t=e,i=this._selectionService,t.clipboardData&&t.clipboardData.setData("text/plain",i.selectionText),t.preventDefault())}));let e=e=>function(e,t,i,r){e.stopPropagation(),e.clipboardData&&Ed(e.clipboardData.getData("text/plain"),t,i,r)}(e,this.textarea,this.coreService,this.optionsService);this._register(Y_(this.textarea,"paste",e)),this._register(Y_(this.element,"paste",e)),Cg?this._register(Y_(this.element,"mousedown",e=>{2===e.button&&Rd(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Y_(this.element,"contextmenu",e=>{Rd(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Dg&&this._register(Y_(this.element,"auxclick",e=>{1===e.button&&Md(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Y_(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Y_(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Y_(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Y_(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Y_(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Y_(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Y_(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var t;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"),(null==(t=this.element)?void 0:t.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Y_(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",wd()),Bg||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(_g,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(tf,this._coreBrowserService),this._register(Y_(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(Y_(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(cg,this._document,this._helperContainer),this._instantiationService.setService(ef,this._charSizeService),this._themeService=this._instantiationService.createInstance(nv),this._instantiationService.setService(af,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Qp),this._instantiationService.setService(of,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Og,this.rows,this.screenElement)),this._instantiationService.setService(sf,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Op,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(mg),this._instantiationService.setService(rf,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(Mm,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(kp,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Gg,this.element,this.screenElement,s)),this._instantiationService.setService(nf,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Mf.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var e;this._selectionService.refresh(),null==(e=this._viewport)||e.queueSync()})),this._register(this._instantiationService.createInstance(Lp,this.screenElement)),this._register(Y_(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),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(Em,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ip,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ip,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(hg,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(t){var i,r,s,n,o;let a,l,h=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!h)return!1;switch(t.overrideType||t.type){case"mousemove":l=32,void 0===t.buttons?(a=3,void 0!==t.button&&(a=t.button<3?t.button:3)):a=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":l=0,a=t.button<3?t.button:3;break;case"mousedown":l=1,a=t.button<3?t.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t))return!1;let h=t.deltaY;if(0===h||0===e.coreMouseService.consumeWheelEvent(t,null==(n=null==(s=null==(r=null==(i=e._renderService)?void 0:i.dimensions)?void 0:r.device)?void 0:s.cell)?void 0:n.height,null==(o=e._coreBrowserService)?void 0:o.dpr))return!1;l=h<0?0:1,a=4;break;default:return!1}return!(void 0===l||void 0===a||a>4)&&e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:a,action:l,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:e=>(i(e),e.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(e)),wheel:e=>(i(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&i(e)},mousemove:e=>{e.buttons||i(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),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()),8&e?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),16&e?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),2&e?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),4&e?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Y_(t,"mousedown",e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return i(e),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(e)})),this._register(Y_(t,"wheel",t=>{var i,s,n,o,a;if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(t))return!1;if(!this.buffer.hasScrollback){if(0===t.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(t,null==(o=null==(n=null==(s=null==(i=e._renderService)?void 0:i.dimensions)?void 0:s.device)?void 0:n.cell)?void 0:o.height,null==(a=e._coreBrowserService)?void 0:a.dpr))return this.cancel(t,!0);let r=Ep.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(r,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){var i;null==(i=this._renderService)||i.refreshRows(e,t)}updateCursorStyle(e){var t;(null==(t=this._selectionService)?void 0: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;0!==t&&this.scrollLines(t)}paste(e){Ed(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}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;null==(e=this._selectionService)||e.clearSelection()}selectAll(){var e;null==(e=this._selectionService)||e.selectAll()}selectLines(e,t){var i;null==(i=this._selectionService)||i.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))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&&("Dead"===e.key||"AltGraph"===e.key)&&(this._unprocessedDeadKey=!0);let i=function(e,t,i,r){var s;let n={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?n.key=t?Ep.ESC+"OA":Ep.ESC+"[A":"UIKeyInputLeftArrow"===e.key?n.key=t?Ep.ESC+"OD":Ep.ESC+"[D":"UIKeyInputRightArrow"===e.key?n.key=t?Ep.ESC+"OC":Ep.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(n.key=t?Ep.ESC+"OB":Ep.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":Ep.DEL,e.altKey&&(n.key=Ep.ESC+n.key);break;case 9:if(e.shiftKey){n.key=Ep.ESC+"[Z";break}n.key=Ep.HT,n.cancel=!0;break;case 13:n.key=e.altKey?Ep.ESC+Ep.CR:Ep.CR,n.cancel=!0;break;case 27:n.key=Ep.ESC,e.altKey&&(n.key=Ep.ESC+Ep.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;n.key=o?Ep.ESC+"[1;"+(o+1)+"D":t?Ep.ESC+"OD":Ep.ESC+"[D";break;case 39:if(e.metaKey)break;n.key=o?Ep.ESC+"[1;"+(o+1)+"C":t?Ep.ESC+"OC":Ep.ESC+"[C";break;case 38:if(e.metaKey)break;n.key=o?Ep.ESC+"[1;"+(o+1)+"A":t?Ep.ESC+"OA":Ep.ESC+"[A";break;case 40:if(e.metaKey)break;n.key=o?Ep.ESC+"[1;"+(o+1)+"B":t?Ep.ESC+"OB":Ep.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(n.key=Ep.ESC+"[2~");break;case 46:n.key=o?Ep.ESC+"[3;"+(o+1)+"~":Ep.ESC+"[3~";break;case 36:n.key=o?Ep.ESC+"[1;"+(o+1)+"H":t?Ep.ESC+"OH":Ep.ESC+"[H";break;case 35:n.key=o?Ep.ESC+"[1;"+(o+1)+"F":t?Ep.ESC+"OF":Ep.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=Ep.ESC+"[5;"+(o+1)+"~":n.key=Ep.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=Ep.ESC+"[6;"+(o+1)+"~":n.key=Ep.ESC+"[6~";break;case 112:n.key=o?Ep.ESC+"[1;"+(o+1)+"P":Ep.ESC+"OP";break;case 113:n.key=o?Ep.ESC+"[1;"+(o+1)+"Q":Ep.ESC+"OQ";break;case 114:n.key=o?Ep.ESC+"[1;"+(o+1)+"R":Ep.ESC+"OR";break;case 115:n.key=o?Ep.ESC+"[1;"+(o+1)+"S":Ep.ESC+"OS";break;case 116:n.key=o?Ep.ESC+"[15;"+(o+1)+"~":Ep.ESC+"[15~";break;case 117:n.key=o?Ep.ESC+"[17;"+(o+1)+"~":Ep.ESC+"[17~";break;case 118:n.key=o?Ep.ESC+"[18;"+(o+1)+"~":Ep.ESC+"[18~";break;case 119:n.key=o?Ep.ESC+"[19;"+(o+1)+"~":Ep.ESC+"[19~";break;case 120:n.key=o?Ep.ESC+"[20;"+(o+1)+"~":Ep.ESC+"[20~";break;case 121:n.key=o?Ep.ESC+"[21;"+(o+1)+"~":Ep.ESC+"[21~";break;case 122:n.key=o?Ep.ESC+"[23;"+(o+1)+"~":Ep.ESC+"[23~";break;case 123:n.key=o?Ep.ESC+"[24;"+(o+1)+"~":Ep.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!r||!e.altKey||e.metaKey)!i||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?n.key=e.key:e.key&&e.ctrlKey&&("_"===e.key&&(n.key=Ep.US),"@"===e.key&&(n.key=Ep.NUL)):65===e.keyCode&&(n.type=1);else{let t=null==(s=ym[e.keyCode])?void 0:s[e.shiftKey?1:0];if(t)n.key=Ep.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),n.key=Ep.ESC+i}else if(32===e.keyCode)n.key=Ep.ESC+(e.ctrlKey?Ep.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),n.key=Ep.ESC+t,n.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key=Ep.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key=Ep.DEL:219===e.keyCode?n.key=Ep.ESC:220===e.keyCode?n.key=Ep.FS:221===e.keyCode&&(n.key=Ep.GS)}return n}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===i.type||2===i.type){let t=this.rows-1;return this.scrollLines(2===i.type?-t:t),this.cancel(e,!0)}return 1===i.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((i.key===Ep.ETX||i.key===Ep.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?this.cancel(e,!0):void(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"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){var t;this._keyDownSeen=!1,(!this._customKeyEventHandler||!1!==this._customKeyEventHandler(e))&&(16===(t=e).keyCode||17===t.keyCode||18===t.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e))&&(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&&"insertText"===e.inputType&&(!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){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var i;null==(i=this._charSizeService)||i.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){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(dv));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var e;this.options.rows=this.rows,this.options.cols=this.cols;let t=this._customKeyEventHandler;this._setup(),super.reset(),null==(e=this._selectionService)||e.reset(),this._decorationService.reset(),this._customKeyEventHandler=t,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;null==(e=this._renderService)||e.clearTextureAtlas()}_reportFocus(){var e;(null==(e=this.element)?void 0:e.classList.contains("focus"))?this.coreService.triggerDataEvent(Ep.ESC+"[I"):this.coreService.triggerDataEvent(Ep.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Ep.ESC}[4;${t};${e}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Ep.ESC}[6;${r};${i}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}};var Tm=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(-1===t)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)}},Pm=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 Od)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},Dm=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 Pm(t)}getNullCell(){return new Od}},Bm=class extends Cf{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Hf),this.onBufferChange=this._onBufferChange.event,this._normal=new Dm(this._core.buffers.normal,"normal"),this._alternate=new Dm(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Am=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,i)=>t(e,i.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)}},Nm=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}},Im=["cols","rows"],Om=0,zm=class extends Cf{constructor(e){super(),this._core=this._register(new Rm(e)),this._addonManager=this._register(new Tm),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let r in this._core.options){let e={get:t.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,e)}}_checkReadonlyOptions(e){if(Im.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new Am(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Nm(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 Bm(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"}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\n",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 wd()},set promptLabel(e){xd(e)},get tooMuchOutput(){return kd()},set tooMuchOutput(e){Ld(e)}}}_verifyIntegers(...e){for(Om of e)if(Om===1/0||isNaN(Om)||Om%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Om of e)if(Om&&(Om===1/0||isNaN(Om)||Om%1!=0||Om<0))throw new Error("This API only accepts positive integers")}},Fm=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 e;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:(null==(e=this._terminal.options.overviewRuler)?void 0:e.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a=s-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),l=n-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-i;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},jm=class{constructor(e,t,i,r={}){this._terminal=e,this._regex=t,this._handler=i,this._options=r}provideLinks(e,t){let i=Hm.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,i)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,i,r)}},e))}};function Wm(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var Hm=class e{static computeLink(t,i,r,s){let n,o=new RegExp(i.source,(i.flags||"")+"g"),[a,l]=e._getWindowedLineStrings(t-1,r),h=a.join(""),c=[];for(;n=o.exec(h);){let t=n[0];if(!Wm(t))continue;let[i,o]=e._mapStrIdx(r,l,0,n.index),[a,h]=e._mapStrIdx(r,i,o,t.length);if(-1===i||-1===o||-1===a||-1===h)continue;let u={start:{x:o+1,y:i+1},end:{x:h,y:a+1}};c.push({range:u,text:t,activate:s})}return c}static _getWindowedLineStrings(e,t){let i,r=e,s=e,n=0,o="",a=[];if(i=t.buffer.active.getLine(e)){let e=i.translateToString(!0);if(i.isWrapped&&" "!==e[0]){for(n=0;(i=t.buffer.active.getLine(--r))&&n<2048&&(o=i.translateToString(!0),n+=o.length,a.push(o),i.isWrapped&&-1===o.indexOf(" ")););a.reverse()}for(a.push(e),n=0;(i=t.buffer.active.getLine(++s))&&i.isWrapped&&n<2048&&(o=i.translateToString(!0),n+=o.length,a.push(o),-1===o.indexOf(" ")););}return[a,r]}static _mapStrIdx(e,t,i,r){let s=e.buffer.active,n=s.getNullCell(),o=i;for(;r;){let e=s.getLine(t);if(!e)return[-1,-1];for(let i=o;i<e.length;++i){e.getCell(i,n);let o=n.getChars();if(n.getWidth()&&(r-=o.length||1,i===e.length-1&&""===o)){let e=s.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,n),2===n.getWidth()&&(r+=1))}if(r<0)return[t,i]}t++,o=0}return[t,o]}},$m=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Um(e,t){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 Km=class{constructor(e=Um,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||$m;this._linkProvider=this._terminal.registerLinkProvider(new jm(this._terminal,i,this._handler,t))}dispose(){var e;null==(e=this._linkProvider)||e.dispose()}},qm=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Zm.isErrorNoTelemetry(e)?new Zm(e.message+"\n\n"+e.stack):new Error(e.message+"\n\n"+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)}};
51
+ /**
52
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
53
+ * @license MIT
54
+ *
55
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
56
+ * @license MIT
57
+ *
58
+ * Originally forked from (with the author's permission):
59
+ * Fabrice Bellard's javascript vt100 for jslinux:
60
+ * http://bellard.org/jslinux/
61
+ * Copyright (c) 2011 Fabrice Bellard
62
+ */function Vm(e){(function(e){return e instanceof Jm||e instanceof Error&&e.name===Ym&&e.message===Ym})(e)||qm.onUnexpectedError(e)}var Ym="Canceled";var Gm,Xm,Qm,Jm=class extends Error{constructor(){super(Ym),this.name=this.message}},Zm=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}};function ey(e,t){let i,r=this,s=!1;return function(){return s||(s=!0,t||(i=e.apply(r,arguments))),i}}function ty(e){if(Qm.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(sp){t.push(sp)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function iy(...e){return ry(()=>ty(e))}function ry(e){return{dispose:ey(()=>{e()})}}(Xm=Gm||(Gm={})).isLessThan=function(e){return e<0},Xm.isLessThanOrEqual=function(e){return e<=0},Xm.isGreaterThan=function(e){return e>0},Xm.isNeitherLessOrGreaterThan=function(e){return 0===e},Xm.greaterThan=1,Xm.lessThan=-1,Xm.neitherLessOrGreaterThan=0,(e=>{function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;let i=Object.freeze([]);function*r(e){yield e}e.empty=function(){return i},e.single=r,e.wrap=function(e){return t(e)?e:r(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(let r of e)if(t(r,i++))return!0;return!1},e.find=function(e,t){for(let i of e)if(t(i))return i},e.filter=function*(e,t){for(let i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(let r of e)yield t(r,i++)},e.flatMap=function*(e,t){let i=0;for(let r of e)yield*t(r,i++)},e.concat=function*(...e){for(let t of e)yield*t},e.reduce=function(e,t,i){let r=i;for(let s of e)r=t(r,s);return r},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);t<i;t++)yield e[t]},e.consume=function(t,i=Number.POSITIVE_INFINITY){let r=[];if(0===i)return[r,t];let s=t[Symbol.iterator]();for(let n=0;n<i;n++){let t=s.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator]:()=>s}]},e.asyncToArray=async function(e){let t=[];for await(let i of e)t.push(i);return Promise.resolve(t)}})(Qm||(Qm={}));var sy=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{ty(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?e.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(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&this._toDispose.delete(e)}};sy.DISABLE_DISPOSED_WARNING=!1;var ny=sy,oy=class{constructor(){this._store=new ny,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)}};oy.None=Object.freeze({dispose(){}});var ay,ly=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null==(t=this._value)||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null==(e=this._value)||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},hy=globalThis.performance&&"function"==typeof globalThis.performance.now,cy=class e{static create(t){return new e(t)}constructor(e){this._now=hy&&!1===e?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-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function t(e){return(t,i=null,r)=>{let s,n=!1;return s=e(e=>{if(!n)return s?s.dispose():n=!0,t.call(i,e)},null,r),n&&s.dispose(),s}}function i(e,t,i){return s((i,r=null,s)=>e(e=>i.call(r,t(e)),null,s),i)}function r(e,t,i){return s((i,r=null,s)=>e(e=>t(e)&&i.call(r,e),null,s),i)}function s(e,t){let i,r=new Sy({onWillAddFirstListener(){i=e(r.fire,r)},onDidRemoveLastListener(){null==i||i.dispose()}});return null==t||t.add(r),r.event}function n(e,t,i=100,r=!1,s=!1,n,o){let a,l,h,c,u=0,d=new Sy({leakWarningThreshold:n,onWillAddFirstListener(){a=e(e=>{u++,l=t(l,e),r&&!h&&(d.fire(l),l=void 0),c=()=>{let e=l;l=void 0,h=void 0,(!r||u>1)&&d.fire(e),u=0},"number"==typeof i?(clearTimeout(h),h=setTimeout(c,i)):void 0===h&&(h=0,queueMicrotask(c))})},onWillRemoveListener(){s&&u>0&&(null==c||c())},onDidRemoveLastListener(){c=void 0,a.dispose()}});return null==o||o.add(d),d.event}e.None=()=>oy.None,e.defer=function(e,t){return n(e,()=>{},0,void 0,!0,void 0,t)},e.once=t,e.map=i,e.forEach=function(e,t,i){return s((i,r=null,s)=>e(e=>{t(e),i.call(r,e)},null,s),i)},e.filter=r,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,r)=>{let s=iy(...e.map(e=>e(e=>t.call(i,e))));return function(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}(s,r)}},e.reduce=function(e,t,r,s){let n=r;return i(e,e=>(n=t(n,e),n),s)},e.debounce=n,e.accumulate=function(t,i=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,r)},e.latch=function(e,t=(e,t)=>e===t,i){let s,n=!0;return r(e,e=>{let i=n||!t(e,s);return n=!1,s=e,i},i)},e.split=function(t,i,r){return[e.filter(t,i,r),e.filter(t,e=>!i(e),r)]},e.buffer=function(e,t=!1,i=[],r){let s=i.slice(),n=e(e=>{s?s.push(e):a.fire(e)});r&&r.add(n);let o=()=>{null==s||s.forEach(e=>a.fire(e)),s=null},a=new Sy({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),r&&r.add(n))},onDidAddFirstListener(){s&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return r&&r.add(a),a.event},e.chain=function(e,t){return(i,r,s)=>{let n=t(new a);return e(function(e){let t=n.evaluate(e);t!==o&&i.call(r,t)},void 0,s)}};let o=Symbol("HaltChainable");class a{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:o),this}reduce(e,t){let i=t;return this.steps.push(t=>(i=e(i,t),i)),this}latch(e=(e,t)=>e===t){let t,i=!0;return this.steps.push(r=>{let s=i||!e(r,t);return i=!1,t=r,s?r:o}),this}evaluate(e){for(let t of this.steps)if((e=t(e))===o)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new Sy({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return s.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new Sy({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return s.event},e.toPromise=function(e){return new Promise(i=>t(e)(i))},e.fromPromise=function(e){let t=new Sy;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class l{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let i={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Sy(i),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new l(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,r)=>{let s=0,n=!1,o={beginUpdate(){s++},endUpdate(){s--,0===s&&(e.reportChanges(),n&&(n=!1,t.call(i)))},handlePossibleChange(){},handleChange(){n=!0}};e.addObserver(o),e.reportChanges();let a={dispose(){e.removeObserver(o)}};return r instanceof ny?r.add(a):Array.isArray(r)&&r.push(a),a}}})(ay||(ay={}));var uy=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new cy,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};uy.all=new Set,uy._idPool=0;var dy=uy,fy=class e{constructor(t,i,r=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;null==(e=this._stacks)||e.clear()}check(e,t){let i=this.threshold;if(i<=0||t<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*i;let[e,r]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(s),console.warn(e);let n=new vy(s,e);this._errorHandler(n)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[i,r]of this._stacks)(!e||t<r)&&(e=[i,r],t=r);return e}};fy._idPool=1;var _y,py=fy,gy=class e{constructor(e){this.value=e}static create(){let t=new Error;return new e(t.stack??"")}print(){console.warn(this.value.split("\n").slice(2).join("\n"))}},vy=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},my=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},yy=0,by=class{constructor(e){this.value=e,this.id=yy++}},Sy=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(null==(t=this._options)?void 0:t.leakWarningThreshold)?new py((null==e?void 0:e.onListenerError)??Vm,(null==(i=this._options)?void 0:i.leakWarningThreshold)??-1):void 0,this._perfMon=(null==(r=this._options)?void 0:r._profName)?new dy(this._options._profName):void 0,this._deliveryQueue=null==(s=this._options)?void 0:s.deliveryQueue}dispose(){var e,t,i,r;this._disposed||(this._disposed=!0,(null==(e=this._deliveryQueue)?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),null==(i=null==(t=this._options)?void 0:t.onDidRemoveLastListener)||i.call(t),null==(r=this._leakageMon)||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var r,s,n,o,a;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new my(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return((null==(r=this._options)?void 0:r.onListenerError)||Vm)(i),oy.None}if(this._disposed)return oy.None;t&&(e=e.bind(t));let l,h=new by(e);this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(h.stack=gy.create(),l=this._leakageMon.check(h.stack,this._size+1)),this._listeners?this._listeners instanceof by?(this._deliveryQueue??(this._deliveryQueue=new wy),this._listeners=[this._listeners,h]):this._listeners.push(h):(null==(n=null==(s=this._options)?void 0:s.onWillAddFirstListener)||n.call(s,this),this._listeners=h,null==(a=null==(o=this._options)?void 0:o.onDidAddFirstListener)||a.call(o,this)),this._size++;let c=ry(()=>{null==l||l(),this._removeListener(h)});return i instanceof ny?i.add(c):Array.isArray(i)&&i.push(c),c}),this._event}_removeListener(e){var t,i,r,s;if(null==(i=null==(t=this._options)?void 0:t.onWillRemoveListener)||i.call(t,this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,null==(s=null==(r=this._options)?void 0:r.onDidRemoveLastListener)||s.call(r,this),void(this._size=0);let n=this._listeners,o=n.indexOf(e);if(-1===o)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--,n[o]=void 0;let a=this._deliveryQueue.current===this;if(2*this._size<=n.length){let e=0;for(let t=0;t<n.length;t++)n[t]?n[e++]=n[t]:a&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=e}}_deliver(e,t){var i;if(!e)return;let r=(null==(i=this._options)?void 0:i.onListenerError)||Vm;if(r)try{e.value(t)}catch(h_){r(h_)}else e.value(t)}_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((null==(t=this._deliveryQueue)?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),null==(i=this._perfMon)||i.stop()),null==(r=this._perfMon)||r.start(this._size),this._listeners)if(this._listeners instanceof by)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}null==(s=this._perfMon)||s.stop()}hasListeners(){return this._size>0}},wy=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}},xy=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(e=>{e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof Ly||!(!t||"object"!=typeof t)&&("boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested)},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ay.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:xy})})(_y||(_y={}));var Cy,ky,Ly=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?xy:(this._emitter||(this._emitter=new Sy),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ey="en",My=Ey,Ry=globalThis;typeof Ry.vscode<"u"&&typeof Ry.vscode.process<"u"?ky=Ry.vscode.process:typeof process<"u"&&"string"==typeof(null==(r=null==process?void 0:process.versions)?void 0:r.node)&&(ky=process);var Ty="string"==typeof(null==(s=null==ky?void 0:ky.versions)?void 0:s.electron)&&"renderer"===(null==ky?void 0:ky.type);if("object"==typeof ky){ky.platform,ky.platform,"linux"===ky.platform&&!!ky.env.SNAP&&ky.env.SNAP_REVISION,!!ky.env.CI||ky.env.BUILD_ARTIFACTSTAGINGDIRECTORY,My=Ey;let e=ky.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,My=t.resolvedLanguage||Ey,null==(n=t.languagePack)?void 0:n.translationsConfigFile}catch{}}else"object"!=typeof navigator||Ty?console.error("Unable to resolve platform."):((Cy=navigator.userAgent).indexOf("Windows"),Cy.indexOf("Macintosh"),(Cy.indexOf("Macintosh")>=0||Cy.indexOf("iPad")>=0||Cy.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints,Cy.indexOf("Linux")>=0,null==Cy||Cy.indexOf("Mobi"),My=globalThis._VSCODE_NLS_LANGUAGE||Ey,navigator.language.toLowerCase());var Py,Dy=Cy,By=My;(e=>{e.value=function(){return By},e.isDefaultVariant=function(){return 2===By.length?"en"===By:By.length>=3&&("e"===By[0]&&"n"===By[1]&&"-"===By[2])},e.isDefault=function(){return"en"===By}})(Py||(Py={}));var Ay="function"==typeof Ry.postMessage&&!Ry.importScripts;(()=>{if(Ay){let e=[];Ry.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let r=e[i];if(r.id===t.data.vscodeScheduleAsyncWork)return e.splice(i,1),void r.callback()}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),Ry.postMessage({vscodeScheduleAsyncWork:r},"*")}}})();var Ny,Iy,Oy=!!(Dy&&Dy.indexOf("Chrome")>=0);function zy(e,t=0,i){let r=setTimeout(()=>{e()},t);return ry(()=>{clearTimeout(r)})}Dy&&Dy.indexOf("Firefox"),!Oy&&Dy&&Dy.indexOf("Safari"),Dy&&Dy.indexOf("Edg/"),Dy&&Dy.indexOf("Android"),(Iy=Ny||(Ny={})).settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if(typeof t<"u")throw t;return i},Iy.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(vt){i(vt)}})};var Fy=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Sy,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(h_){this.reject(h_)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await ay.toPromise(this._onStateChanged.event)}},return:async()=>{var e;return null==(e=this._onReturn)||e.call(this),{done:!0,value:void 0}}}}static map(t,i){return new e(async e=>{for await(let r of t)e.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let r of t)i(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Fy.EMPTY=Fy.fromArray([]);var jy=class extends oy{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new ly),this._linesCacheDisposables=this._register(new ly),this._register(ry(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=iy(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=zy(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){var t;return null==(t=this._linesCache)?void 0:t[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){var i;let r=[],s=[0],n=this._terminal.buffer.active.getLine(e);for(;n;){let o=this._terminal.buffer.active.getLine(e+1),a=!!o&&o.isWrapped,l=n.translateToString(!a&&t);if(a&&o){let e=n.getCell(n.length-1);e&&0===e.getCode()&&1===e.getWidth()&&2===(null==(i=o.getCell(0))?void 0:i.getWidth())&&(l=l.slice(0,-1))}if(r.push(l),!a)break;s.push(s[s.length-1]+l.length),e++,n=o}return[r.join(""),s]}},Wy=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return!this._lastSearchOptions||!!e&&(this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord)}shouldUpdateHighlighting(e,t){return!!(null==t?void 0:t.decorations)&&(void 0===this._cachedSearchTerm||e!==this._cachedSearchTerm||this.didOptionsChange(t))}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Hy=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,r){if(!e||0===e.length)return void this._terminal.clearSelection();if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let s={startRow:t,startCol:i},n=this._findInLine(e,s,r);if(!n)for(let o=t+1;o<this._terminal.buffer.active.baseY+this._terminal.rows&&(s.startRow=o,s.startCol=0,n=this._findInLine(e,s,r),!n);o++);return n}findNextWithSelection(e,t,i){if(!e||0===e.length)return void this._terminal.clearSelection();let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=0,n=0;r&&(i===e?(s=r.end.x,n=r.end.y):(s=r.start.x,n=r.start.y)),this._lineCache.initLinesCache();let o={startRow:n,startCol:s},a=this._findInLine(e,o,t);if(!a)for(let l=n+1;l<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=l,o.startCol=0,a=this._findInLine(e,o,t),!a);l++);if(!a&&0!==n)for(let l=0;l<n&&(o.startRow=l,o.startCol=0,a=this._findInLine(e,o,t),!a);l++);return!a&&r&&(o.startRow=r.start.y,o.startCol=0,a=this._findInLine(e,o,t)),a}findPreviousWithSelection(e,t,i){if(!e||0===e.length)return void this._terminal.clearSelection();let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=this._terminal.buffer.active.baseY+this._terminal.rows-1,n=this._terminal.cols,o=!0;this._lineCache.initLinesCache();let a,l={startRow:s,startCol:n};if(r&&(l.startRow=s=r.start.y,l.startCol=n=r.start.x,i!==e&&(a=this._findInLine(e,l,t,!1),a||(l.startRow=s=r.end.y,l.startCol=n=r.end.x))),a||(a=this._findInLine(e,l,t,o)),!a){l.startCol=Math.max(l.startCol,this._terminal.cols);for(let i=s-1;i>=0&&(l.startRow=i,a=this._findInLine(e,l,t,o),!a);i--);}if(!a&&s!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let h=this._terminal.buffer.active.baseY+this._terminal.rows-1;h>=s&&(l.startRow=h,a=this._findInLine(e,l,t,o),!a);h--);return a}_isWholeWord(e,t,i){return(0===e||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},r=!1){var s;let n=t.startRow,o=t.startCol;if(null==(s=this._terminal.buffer.active.getLine(n))?void 0:s.isWrapped)return r?void(t.startCol+=this._terminal.cols):(t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i));let a=this._lineCache.getLineFromCache(n);a||(a=this._lineCache.translateBufferLineToStringWithWrap(n,!0),this._lineCache.setLineInCache(n,a));let[l,h]=a,c=this._bufferColsToStringOffset(n,o),u=e,d=l;i.regex||(u=i.caseSensitive?e:e.toLowerCase(),d=i.caseSensitive?l:l.toLowerCase());let f=-1;if(i.regex){let t,s=RegExp(u,i.caseSensitive?"g":"gi");if(r)for(;t=s.exec(d.slice(0,c));)f=s.lastIndex-t[0].length,e=t[0],s.lastIndex-=e.length-1;else t=s.exec(d.slice(c)),t&&t[0].length>0&&(f=c+(s.lastIndex-t[0].length),e=t[0])}else r?c-u.length>=0&&(f=d.lastIndexOf(u,c-u.length)):f=d.indexOf(u,c);if(f>=0){if(i.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<h.length-1&&f>=h[t+1];)t++;let r=t;for(;r<h.length-1&&f+e.length>=h[r+1];)r++;let s=f-h[t],o=f+e.length-h[r],a=this._stringLengthToBufferSize(n+t,s);return{term:e,col:a,row:n+t,size:this._stringLengthToBufferSize(n+r,o)-a+this._terminal.cols*(r-t)}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let r=0;r<t;r++){let e=i.getCell(r);if(!e)break;let s=e.getChars();s.length>1&&(t-=s.length-1);let n=i.getCell(r+1);n&&0===n.getWidth()&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,r=0,s=this._terminal.buffer.active.getLine(i);for(;t>0&&s;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=s.getCell(e);if(!t)break;t.getWidth()&&(r+=0===t.getCode()?1:t.getChars().length)}if(i++,s=this._terminal.buffer.active.getLine(i),s&&!s.isWrapped)break;t-=this._terminal.cols}return r}},$y=class extends oy{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(ry(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let e=this._createResultDecorations(i,t,!1);if(e)for(let t of e)this._storeDecoration(t,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){ty(i)}}}clearHighlightDecorations(){ty(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let r=[],s=e.col,n=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;n>0;){let e=Math.min(this._terminal.cols-s,n);r.push([o,s,e]),s=0,n-=e,o++}let a=[];for(let l of r){let e=this._terminal.registerMarker(l[0]),r=this._terminal.registerDecoration({marker:e,x:l[1],width:l[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(e.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(r){let s=[];s.push(e),s.push(r.onRender(e=>this._applyStyles(e,i?t.activeMatchBorder:t.matchBorder,!1))),s.push(r.onDispose(()=>ty(s))),a.push(r)}}return 0===a.length?void 0:a}},Uy=class extends oy{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Sy)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Ky=class extends oy{constructor(e){super(),this._highlightTimeout=this._register(new ly),this._lineCache=this._register(new ly),this._state=new Wy,this._resultTracker=this._register(new Uy),this._highlightLimit=(null==e?void 0:e.highlightLimit)??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new jy(e),this._engine=new Hy(e,this._lineCache.value),this._decorationManager=new $y(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(ry(()=>this.clearDecorations()))}_updateMatches(){var e;this._highlightTimeout.clear(),this._state.cachedSearchTerm&&(null==(e=this._state.lastSearchOptions)?void 0:e.decorations)&&(this._highlightTimeout.value=zy(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){var t;this._resultTracker.clearSelectedDecoration(),null==(t=this._decorationManager)||t.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e))return void this.clearDecorations();this.clearDecorations(!0);let i,r=[],s=this._engine.find(e,0,0,t);for(;s&&((null==i?void 0:i.row)!==s.row||(null==i?void 0:i.col)!==s.col)&&!(r.length>=this._highlightLimit);)i=s,r.push(i),s=this._engine.find(e,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,t);this._resultTracker.updateResults(r,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(r,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,null==t?void 0:t.decorations,null==i?void 0:i.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!(null==e?void 0:e.decorations))}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,null==t?void 0:t.decorations,null==i?void 0:i.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}},qy=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Jy.isErrorNoTelemetry(e)?new Jy(e.message+"\n\n"+e.stack):new Error(e.message+"\n\n"+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)}};function Vy(e){(function(e){return e instanceof Qy||e instanceof Error&&e.name===Yy&&e.message===Yy})(e)||qy.onUnexpectedError(e)}var Yy="Canceled";var Gy,Xy,Qy=class extends Error{constructor(){super(Yy),this.name=this.message}},Jy=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}};function Zy(e,t){let i,r=this,s=!1;return function(){return s||(s=!0,t||(i=e.apply(r,arguments))),i}}function eb(e){if(Xy.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(sp){t.push(sp)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function tb(...e){return ib(()=>eb(e))}function ib(e){return{dispose:Zy(()=>{e()})}}(e=>{e.isLessThan=function(e){return e<0},e.isLessThanOrEqual=function(e){return e<=0},e.isGreaterThan=function(e){return e>0},e.isNeitherLessOrGreaterThan=function(e){return 0===e},e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Gy||(Gy={})),(e=>{function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;let i=Object.freeze([]);function*r(e){yield e}e.empty=function(){return i},e.single=r,e.wrap=function(e){return t(e)?e:r(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(let r of e)if(t(r,i++))return!0;return!1},e.find=function(e,t){for(let i of e)if(t(i))return i},e.filter=function*(e,t){for(let i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(let r of e)yield t(r,i++)},e.flatMap=function*(e,t){let i=0;for(let r of e)yield*t(r,i++)},e.concat=function*(...e){for(let t of e)yield*t},e.reduce=function(e,t,i){let r=i;for(let s of e)r=t(r,s);return r},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);t<i;t++)yield e[t]},e.consume=function(t,i=Number.POSITIVE_INFINITY){let r=[];if(0===i)return[r,t];let s=t[Symbol.iterator]();for(let n=0;n<i;n++){let t=s.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator]:()=>s}]},e.asyncToArray=async function(e){let t=[];for await(let i of e)t.push(i);return Promise.resolve(t)}})(Xy||(Xy={}));var rb=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{eb(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?e.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(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&this._toDispose.delete(e)}};rb.DISABLE_DISPOSED_WARNING=!1;var sb=rb,nb=class{constructor(){this._store=new sb,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)}};nb.None=Object.freeze({dispose(){}});var ob=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null==(t=this._value)||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null==(e=this._value)||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},ab=typeof process<"u"&&"title"in process,lb=ab?"node":navigator.userAgent,hb=ab?"node":navigator.platform,cb=lb.includes("Firefox"),ub=lb.includes("Edge"),db=/^((?!chrome|android).)*safari/i.test(lb);hb.indexOf("Linux");var fb,_b,pb,gb,vb,mb=0,yb=0,bb=0,Sb=0,wb={css:"#00000000",rgba:0};function xb(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Cb(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function kb(e){if(!e)throw new Error("value must not be falsy");return e}function Lb(e){return 57508<=e&&e<=57558}function Eb(e){return Lb(e)||function(e){return 9472<=e&&e<=9631}(e)}function Mb(e,t,i=0){return(e-(2*Math.round(t)-i))%(2*Math.round(t))}(e=>{e.toCss=function(e,t,i,r){return void 0!==r?`#${xb(e)}${xb(t)}${xb(i)}${xb(r)}`:`#${xb(e)}${xb(t)}${xb(i)}`},e.toRgba=function(e,t,i,r=255){return(e<<24|t<<16|i<<8|r)>>>0},e.toColor=function(t,i,r,s){return{css:e.toCss(t,i,r,s),rgba:e.toRgba(t,i,r,s)}}})(fb||(fb={})),(e=>{function t(e,t){return Sb=Math.round(255*t),[mb,yb,bb]=vb.toChannels(e.rgba),{css:fb.toCss(mb,yb,bb,Sb),rgba:fb.toRgba(mb,yb,bb,Sb)}}e.blend=function(e,t){if(1===(Sb=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let i=t.rgba>>24&255,r=t.rgba>>16&255,s=t.rgba>>8&255,n=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return mb=n+Math.round((i-n)*Sb),yb=o+Math.round((r-o)*Sb),bb=a+Math.round((s-a)*Sb),{css:fb.toCss(mb,yb,bb),rgba:fb.toRgba(mb,yb,bb)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){let r=vb.ensureContrastRatio(e.rgba,t.rgba,i);if(r)return fb.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[mb,yb,bb]=vb.toChannels(t),{css:fb.toCss(mb,yb,bb),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return t(e,(Sb=255&e.rgba)*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}})(_b||(_b={})),(e=>{let t,i;try{let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d",{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return mb=parseInt(e.slice(1,2).repeat(2),16),yb=parseInt(e.slice(2,3).repeat(2),16),bb=parseInt(e.slice(3,4).repeat(2),16),fb.toColor(mb,yb,bb);case 5:return mb=parseInt(e.slice(1,2).repeat(2),16),yb=parseInt(e.slice(2,3).repeat(2),16),bb=parseInt(e.slice(3,4).repeat(2),16),Sb=parseInt(e.slice(4,5).repeat(2),16),fb.toColor(mb,yb,bb,Sb);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return mb=parseInt(r[1]),yb=parseInt(r[2]),bb=parseInt(r[3]),Sb=Math.round(255*(void 0===r[5]?1:parseFloat(r[5]))),fb.toColor(mb,yb,bb,Sb);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[mb,yb,bb,Sb]=t.getImageData(0,0,1,1).data,255!==Sb)throw new Error("css.toColor: Unsupported css format");return{rgba:fb.toRgba(mb,yb,bb,Sb),css:e}}})(pb||(pb={})),(e=>{function t(e,t,i){let r=e/255,s=t/255,n=i/255;return.2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t})(gb||(gb={})),(e=>{function t(e,t,i){let r=e>>24&255,s=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,h=Cb(gb.relativeLuminance2(o,a,l),gb.relativeLuminance2(r,s,n));for(;h<i&&(o>0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),h=Cb(gb.relativeLuminance2(o,a,l),gb.relativeLuminance2(r,s,n));return(o<<24|a<<16|l<<8|255)>>>0}function i(e,t,i){let r=e>>24&255,s=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,h=Cb(gb.relativeLuminance2(o,a,l),gb.relativeLuminance2(r,s,n));for(;h<i&&(o<255||a<255||l<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),h=Cb(gb.relativeLuminance2(o,a,l),gb.relativeLuminance2(r,s,n));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(1===(Sb=(255&t)/255))return t;let i=t>>24&255,r=t>>16&255,s=t>>8&255,n=e>>24&255,o=e>>16&255,a=e>>8&255;return mb=n+Math.round((i-n)*Sb),yb=o+Math.round((r-o)*Sb),bb=a+Math.round((s-a)*Sb),fb.toRgba(mb,yb,bb)},e.ensureContrastRatio=function(e,r,s){let n=gb.relativeLuminance(e>>8),o=gb.relativeLuminance(r>>8);if(Cb(n,o)<s){if(o<n){let o=t(e,r,s),a=Cb(n,gb.relativeLuminance(o>>8));if(a<s){let t=i(e,r,s);return a>Cb(n,gb.relativeLuminance(t>>8))?o:t}return o}let a=i(e,r,s),l=Cb(n,gb.relativeLuminance(a>>8));if(l<s){let i=t(e,r,s);return l>Cb(n,gb.relativeLuminance(i>>8))?a:i}return a}},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}})(vb||(vb={}));var Rb,Tb=0,Pb=0,Db=!1,Bb=!1,Ab=!1,Nb=0,Ib=class{constructor(e,t,i,r,s,n){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=r,this._coreBrowserService=s,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,Pb=0,Tb=0,Bb=!1,Db=!1,Ab=!1,Rb=this._themeService.colors,Nb=0,0!==e.getCode()&&4===e.extended.underlineStyle){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Nb=t*r%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",e=>{e.backgroundColorRGB&&(Pb=e.backgroundColorRGB.rgba>>8&16777215,Bb=!0),e.foregroundColorRGB&&(Tb=e.foregroundColorRGB.rgba>>8&16777215,Db=!0)}),Ab=this._selectionRenderModel.isCellSelected(this._terminal,t,i)){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:Pb=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:Pb=(16777215&this.result.fg)<<8|255;break;default:Pb=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:Pb=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:Pb=(16777215&this.result.bg)<<8|255}Pb=vb.blend(Pb,4294967040&(this._coreBrowserService.isFocused?Rb.selectionBackgroundOpaque:Rb.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else Pb=(this._coreBrowserService.isFocused?Rb.selectionBackgroundOpaque:Rb.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Bb=!0,Rb.selectionForeground&&(Tb=Rb.selectionForeground.rgba>>8&16777215,Db=!0),Eb(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))Tb=(this._coreBrowserService.isFocused?Rb.selectionBackgroundOpaque:Rb.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:Tb=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:Tb=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:Tb=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:Tb=(16777215&this.result.fg)<<8|255;break;default:Tb=this._themeService.colors.foreground.rgba}Tb=vb.blend(Tb,4294967040&(this._coreBrowserService.isFocused?Rb.selectionBackgroundOpaque:Rb.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}Db=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",e=>{e.backgroundColorRGB&&(Pb=e.backgroundColorRGB.rgba>>8&16777215,Bb=!0),e.foregroundColorRGB&&(Tb=e.foregroundColorRGB.rgba>>8&16777215,Db=!0)}),Bb&&(Pb=Ab?-16777216&e.bg&-134217729|Pb|50331648:-16777216&e.bg|Pb|50331648),Db&&(Tb=-16777216&e.fg&-67108865|Tb|50331648),67108864&this.result.fg&&(Bb&&!Db&&(Tb=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&Rb.background.rgba>>8|50331648,Db=!0),!Bb&&Db&&(Pb=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&Rb.foreground.rgba>>8|50331648,Bb=!0)),Rb=void 0,this.result.bg=Bb?Pb:this.result.bg,this.result.fg=Db?Tb:this.result.fg,this.result.ext&=536870911,this.result.ext|=Nb<<29&3758096384}},Ob=cb||ub?"bottom":"ideographic",zb={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Fb={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},jb={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Wb={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};function Hb(e,t,i,r,s,n,o,a){let l=zb[t];if(l)return function(e,t,i,r,s,n){for(let o=0;o<t.length;o++){let a=t[o],l=s/8,h=n/8;e.fillRect(i+a.x*l,r+a.y*h,a.w*l,a.h*h)}}(e,l,i,r,s,n),!0;let h=Fb[t];if(h)return function(e,t,i,r,s,n){let o=$b.get(t);o||(o=new Map,$b.set(t,o));let a=e.fillStyle;if("string"!=typeof a)throw new Error(`Unexpected fillStyle type "${a}"`);let l=o.get(a);if(!l){let i=t[0].length,r=t.length,s=e.canvas.ownerDocument.createElement("canvas");s.width=i,s.height=r;let n,h,c,u,d=kb(s.getContext("2d")),f=new ImageData(i,r);if(a.startsWith("#"))n=parseInt(a.slice(1,3),16),h=parseInt(a.slice(3,5),16),c=parseInt(a.slice(5,7),16),u=a.length>7&&parseInt(a.slice(7,9),16)||1;else{if(!a.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);[n,h,c,u]=a.substring(5,a.length-1).split(",").map(e=>parseFloat(e))}for(let e=0;e<r;e++)for(let r=0;r<i;r++)f.data[4*(e*i+r)]=n,f.data[4*(e*i+r)+1]=h,f.data[4*(e*i+r)+2]=c,f.data[4*(e*i+r)+3]=t[e][r]*(255*u);d.putImageData(f,0,0),l=kb(e.createPattern(s,null)),o.set(a,l)}e.fillStyle=l,e.fillRect(i,r,s,n)}(e,h,i,r,s,n),!0;let c=jb[t];if(c)return function(e,t,i,r,s,n,o){e.strokeStyle=e.fillStyle;for(let[a,l]of Object.entries(t)){let t;if(e.beginPath(),e.lineWidth=o*Number.parseInt(a),"function"==typeof l){t=l(.15,.15/n*s)}else t=l;for(let a of t.split(" ")){let t=a[0],l=Kb[t];if(!l){console.error(`Could not find drawing instructions for "${t}"`);continue}let h=a.substring(1).split(",");!h[0]||!h[1]||l(e,qb(h,s,n,i,r,!0,o))}e.stroke(),e.closePath()}}(e,c,i,r,s,n,a),!0;let u=Wb[t];return!!u&&(function(e,t,i,r,s,n,o,a){let l=new Path2D;l.rect(i,r,s,n),e.clip(l),e.beginPath();let h=o/12;e.lineWidth=a*h;for(let c of t.d.split(" ")){let o=c[0],l=Kb[o];if(!l){console.error(`Could not find drawing instructions for "${o}"`);continue}let u=c.substring(1).split(",");!u[0]||!u[1]||l(e,qb(u,s,n,i,r,!1,a,(t.leftPadding??0)*(h/2),(t.rightPadding??0)*(h/2)))}1===t.type?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,u,i,r,s,n,o,a),!0)}Wb[""]=Wb[""],Wb[""]=Wb[""];var $b=new Map;function Ub(e,t,i=0){return Math.max(Math.min(e,t),i)}var Kb={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function qb(e,t,i,r,s,n,o,a=0,l=0){let h=e.map(e=>parseFloat(e)||parseInt(e));if(h.length<2)throw new Error("Too few arguments for instruction");for(let c=0;c<h.length;c+=2)h[c]*=t-a*o-l*o,n&&0!==h[c]&&(h[c]=Ub(Math.round(h[c]+.5)-.5,t,0)),h[c]+=r+a*o;for(let c=1;c<h.length;c+=2)h[c]*=i,n&&0!==h[c]&&(h[c]=Ub(Math.round(h[c]+.5)-.5,i,0)),h[c]+=s;return h}var Vb,Yb=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={}}},Gb=class{constructor(){this._data=new Yb}set(e,t,i,r,s){this._data.get(e,t)||this._data.set(e,t,new Yb),this._data.get(e,t).set(i,r,s)}get(e,t,i,r){var s;return null==(s=this._data.get(e,t))?void 0:s.get(i,r)}clear(){this._data.clear()}},Xb=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(),1.5*i>s)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=s}this.clear()}},Qb=!ab&&"requestIdleCallback"in window?class extends Xb{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:class extends Xb{_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())}}},Jb=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Zb}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&~this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Zb=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},eS=globalThis.performance&&"function"==typeof globalThis.performance.now,tS=class e{static create(t){return new e(t)}constructor(e){this._now=eS&&!1===e?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-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function t(e){return(t,i=null,r)=>{let s,n=!1;return s=e(e=>{if(!n)return s?s.dispose():n=!0,t.call(i,e)},null,r),n&&s.dispose(),s}}function i(e,t,i){return s((i,r=null,s)=>e(e=>i.call(r,t(e)),null,s),i)}function r(e,t,i){return s((i,r=null,s)=>e(e=>t(e)&&i.call(r,e),null,s),i)}function s(e,t){let i,r=new dS({onWillAddFirstListener(){i=e(r.fire,r)},onDidRemoveLastListener(){null==i||i.dispose()}});return null==t||t.add(r),r.event}function n(e,t,i=100,r=!1,s=!1,n,o){let a,l,h,c,u=0,d=new dS({leakWarningThreshold:n,onWillAddFirstListener(){a=e(e=>{u++,l=t(l,e),r&&!h&&(d.fire(l),l=void 0),c=()=>{let e=l;l=void 0,h=void 0,(!r||u>1)&&d.fire(e),u=0},"number"==typeof i?(clearTimeout(h),h=setTimeout(c,i)):void 0===h&&(h=0,queueMicrotask(c))})},onWillRemoveListener(){s&&u>0&&(null==c||c())},onDidRemoveLastListener(){c=void 0,a.dispose()}});return null==o||o.add(d),d.event}e.None=()=>nb.None,e.defer=function(e,t){return n(e,()=>{},0,void 0,!0,void 0,t)},e.once=t,e.map=i,e.forEach=function(e,t,i){return s((i,r=null,s)=>e(e=>{t(e),i.call(r,e)},null,s),i)},e.filter=r,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,r)=>function(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}(tb(...e.map(e=>e(e=>t.call(i,e)))),r)},e.reduce=function(e,t,r,s){let n=r;return i(e,e=>(n=t(n,e),n),s)},e.debounce=n,e.accumulate=function(t,i=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,r)},e.latch=function(e,t=(e,t)=>e===t,i){let s,n=!0;return r(e,e=>{let i=n||!t(e,s);return n=!1,s=e,i},i)},e.split=function(t,i,r){return[e.filter(t,i,r),e.filter(t,e=>!i(e),r)]},e.buffer=function(e,t=!1,i=[],r){let s=i.slice(),n=e(e=>{s?s.push(e):a.fire(e)});r&&r.add(n);let o=()=>{null==s||s.forEach(e=>a.fire(e)),s=null},a=new dS({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),r&&r.add(n))},onDidAddFirstListener(){s&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return r&&r.add(a),a.event},e.chain=function(e,t){return(i,r,s)=>{let n=t(new a);return e(function(e){let t=n.evaluate(e);t!==o&&i.call(r,t)},void 0,s)}};let o=Symbol("HaltChainable");class a{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:o),this}reduce(e,t){let i=t;return this.steps.push(t=>(i=e(i,t),i)),this}latch(e=(e,t)=>e===t){let t,i=!0;return this.steps.push(r=>{let s=i||!e(r,t);return i=!1,t=r,s?r:o}),this}evaluate(e){for(let t of this.steps)if((e=t(e))===o)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new dS({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return s.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new dS({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return s.event},e.toPromise=function(e){return new Promise(i=>t(e)(i))},e.fromPromise=function(e){let t=new dS;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class l{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let i={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new dS(i),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new l(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,r)=>{let s=0,n=!1,o={beginUpdate(){s++},endUpdate(){s--,0===s&&(e.reportChanges(),n&&(n=!1,t.call(i)))},handlePossibleChange(){},handleChange(){n=!0}};e.addObserver(o),e.reportChanges();let a={dispose(){e.removeObserver(o)}};return r instanceof sb?r.add(a):Array.isArray(r)&&r.push(a),a}}})(Vb||(Vb={}));var iS=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new tS,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};iS.all=new Set,iS._idPool=0;var rS=iS,sS=class e{constructor(t,i,r=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;null==(e=this._stacks)||e.clear()}check(e,t){let i=this.threshold;if(i<=0||t<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*i;let[e,r]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(s),console.warn(e);let n=new lS(s,e);this._errorHandler(n)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[i,r]of this._stacks)(!e||t<r)&&(e=[i,r],t=r);return e}};sS._idPool=1;var nS,oS=sS,aS=class e{constructor(e){this.value=e}static create(){let t=new Error;return new e(t.stack??"")}print(){console.warn(this.value.split("\n").slice(2).join("\n"))}},lS=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},hS=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},cS=0,uS=class{constructor(e){this.value=e,this.id=cS++}},dS=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(null==(t=this._options)?void 0:t.leakWarningThreshold)?new oS((null==e?void 0:e.onListenerError)??Vy,(null==(i=this._options)?void 0:i.leakWarningThreshold)??-1):void 0,this._perfMon=(null==(r=this._options)?void 0:r._profName)?new rS(this._options._profName):void 0,this._deliveryQueue=null==(s=this._options)?void 0:s.deliveryQueue}dispose(){var e,t,i,r;this._disposed||(this._disposed=!0,(null==(e=this._deliveryQueue)?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),null==(i=null==(t=this._options)?void 0:t.onDidRemoveLastListener)||i.call(t),null==(r=this._leakageMon)||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var r,s,n,o,a;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new hS(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return((null==(r=this._options)?void 0:r.onListenerError)||Vy)(i),nb.None}if(this._disposed)return nb.None;t&&(e=e.bind(t));let l,h=new uS(e);this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(h.stack=aS.create(),l=this._leakageMon.check(h.stack,this._size+1)),this._listeners?this._listeners instanceof uS?(this._deliveryQueue??(this._deliveryQueue=new fS),this._listeners=[this._listeners,h]):this._listeners.push(h):(null==(n=null==(s=this._options)?void 0:s.onWillAddFirstListener)||n.call(s,this),this._listeners=h,null==(a=null==(o=this._options)?void 0:o.onDidAddFirstListener)||a.call(o,this)),this._size++;let c=ib(()=>{null==l||l(),this._removeListener(h)});return i instanceof sb?i.add(c):Array.isArray(i)&&i.push(c),c}),this._event}_removeListener(e){var t,i,r,s;if(null==(i=null==(t=this._options)?void 0:t.onWillRemoveListener)||i.call(t,this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,null==(s=null==(r=this._options)?void 0:r.onDidRemoveLastListener)||s.call(r,this),void(this._size=0);let n=this._listeners,o=n.indexOf(e);if(-1===o)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--,n[o]=void 0;let a=this._deliveryQueue.current===this;if(2*this._size<=n.length){let e=0;for(let t=0;t<n.length;t++)n[t]?n[e++]=n[t]:a&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=e}}_deliver(e,t){var i;if(!e)return;let r=(null==(i=this._options)?void 0:i.onListenerError)||Vy;if(r)try{e.value(t)}catch(s){r(s)}else e.value(t)}_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((null==(t=this._deliveryQueue)?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),null==(i=this._perfMon)||i.stop()),null==(r=this._perfMon)||r.start(this._size),this._listeners)if(this._listeners instanceof uS)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}null==(s=this._perfMon)||s.stop()}hasListeners(){return this._size>0}},fS=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}},_S={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},pS=class e{constructor(e,t,i){this._document=e,this._config=t,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new Gb,this._cacheMapCombined=new Gb,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Jb,this._textureSize=512,this._onAddTextureAtlasCanvas=new dS,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new dS,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=mS(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=kb(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new Qb;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(0!==this._pages[0].currentRow.x||0!==this._pages[0].currentRow.y){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>2*t.canvas.width<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width!==e.canvas.width?t.canvas.width-e.canvas.width:t.percentageUsed-e.percentageUsed),i=-1,r=0;for(let e=0;e<t.length;e++)if(t[e].canvas.width!==r)i=e,r=t[e].canvas.width;else if(e-i===3)break;let s=t.slice(i,i+4),n=s.map(e=>e.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-s.length,a=this._mergePages(s,o);a.version++;for(let e=n.length-1;e>=0;e--)this._deletePage(n[e]);this.pages.push(a),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(a.canvas)}let t=new gS(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let i=2*e[0].canvas.width,r=new gS(this._document,i,e);for(let[s,n]of e.entries()){let e=s*n.canvas.width%i,o=Math.floor(s/2)*n.canvas.height;r.ctx.drawImage(n.canvas,e,o);for(let r of n.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/i,r.sizeClipSpace.y=r.size.y/i,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/i,r.texturePositionClipSpace.y=r.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let a=this._activePages.indexOf(n);-1!==a&&this._activePages.splice(a,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,i,r,s,n){return this._getFromCacheMap(this._cacheMapCombined,e,t,i,r,s,n)}getRasterizedGlyph(e,t,i,r,s,n){return this._getFromCacheMap(this._cacheMap,e,t,i,r,s,n)}_getFromCacheMap(e,t,i,r,s,n,o){return(nS=e.get(t,i,r,s))||(nS=this._drawToCache(t,i,r,s,n,o),e.set(t,i,r,s,nS)),nS}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,i,r){if(this._config.allowTransparency)return wb;let s;switch(e){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(t);break;case 50331648:let e=Jb.toColorRGB(t);s=fb.toColor(e[0],e[1],e[2]);break;default:s=i?_b.opaque(this._config.colors.foreground):this._config.colors.background}return this._config.allowTransparency||(s=_b.opaque(s)),s}_getForegroundColor(e,t,i,r,s,n,o,a,l,h){let c,u=this._getMinimumContrastColor(e,t,i,r,s,n,o,l,a,h);if(u)return u;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&n<8&&(n+=8),c=this._getColorFromAnsiIndex(n);break;case 50331648:let e=Jb.toColorRGB(n);c=fb.toColor(e[0],e[1],e[2]);break;default:c=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(c=_b.opaque(c)),a&&(c=_b.multiplyOpacity(c,.5)),c}_resolveBackgroundRgba(e,t,i){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,i,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,i,r,s,n,o,a,l,h){if(1===this._config.minimumContrastRatio||h)return;let c=this._getContrastCache(l),u=c.getColor(e,r);if(void 0!==u)return u||void 0;let d=this._resolveBackgroundRgba(t,i,o),f=this._resolveForegroundRgba(s,n,o,a),_=vb.ensureContrastRatio(d,f,this._config.minimumContrastRatio/(l?2:1));if(!_)return void c.setColor(e,r,null);let p=fb.toColor(_>>24&255,_>>16&255,_>>8&255);return c.setColor(e,r,p),p}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,r,s,n,o){let a="number"==typeof t?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let l=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+4,this._config.deviceMaxTextureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let h=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<h&&(this._tmpCanvas.height=h),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=s,this._workAttributeData.isInvisible())return _S;let c=!!this._workAttributeData.isBold(),u=!!this._workAttributeData.isInverse(),d=!!this._workAttributeData.isDim(),f=!!this._workAttributeData.isItalic(),_=!!this._workAttributeData.isUnderline(),p=!!this._workAttributeData.isStrikethrough(),g=!!this._workAttributeData.isOverline(),v=this._workAttributeData.getFgColor(),m=this._workAttributeData.getFgColorMode(),y=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(u){let e=v;v=y,y=e;let t=m;m=b,b=t}let S=this._getBackgroundColor(b,y,u,d);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=S.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let w=c?this._config.fontWeightBold:this._config.fontWeight,x=f?"italic":"";this._tmpCtx.font=`${x} ${w} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Ob;let C=1===a.length&&Lb(a.charCodeAt(0)),k=1===a.length&&function(e){return 57520<=e&&e<=57527}(a.charCodeAt(0)),L=this._getForegroundColor(i,b,y,r,m,v,u,d,c,Eb(a.charCodeAt(0)));this._tmpCtx.fillStyle=L.css;let E=k?0:4,M=!1;!1!==this._config.customGlyphs&&(M=Hb(this._tmpCtx,a,E,E,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let R,T=!C;if(R="number"==typeof t?this._unicodeService.wcwidth(t):this._unicodeService.getStringCellWidth(t),_){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())T=!1,this._tmpCtx.strokeStyle=`rgb(${Jb.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{T=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let i=E,r=Math.ceil(E+this._config.deviceCharHeight)-t-(n?2*e:0),s=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let n=0;n<R;n++){this._tmpCtx.save();let a=i+n*this._config.deviceCellWidth,h=i+(n+1)*this._config.deviceCellWidth,c=a+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(a,r),this._tmpCtx.lineTo(h,r),this._tmpCtx.moveTo(a,o),this._tmpCtx.lineTo(h,o);break;case 3:let i=e<=1?o:Math.ceil(E+this._config.deviceCharHeight-e/2)-t,n=e<=1?r:Math.ceil(E+this._config.deviceCharHeight+e/2)-t,u=new Path2D;u.rect(a,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(u),this._tmpCtx.moveTo(a-this._config.deviceCellWidth/2,s),this._tmpCtx.bezierCurveTo(a-this._config.deviceCellWidth/2,n,a,n,a,s),this._tmpCtx.bezierCurveTo(a,i,c,i,c,s),this._tmpCtx.bezierCurveTo(c,n,h,n,h,s),this._tmpCtx.bezierCurveTo(h,i,h+this._config.deviceCellWidth/2,i,h+this._config.deviceCellWidth/2,s);break;case 4:let d=0===l?0:l>=e?2*e-l:e-l;!1==!(l>=e)||0===d?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(a+d,r),this._tmpCtx.lineTo(h,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(a,r),this._tmpCtx.lineTo(a+d,r),this._tmpCtx.moveTo(a+d+e,r),this._tmpCtx.lineTo(h,r)),l=Mb(h-a,e,l);break;case 5:let f=.6,_=.3,p=h-a,g=Math.floor(f*p),v=Math.floor(_*p),m=p-g-v;this._tmpCtx.setLineDash([g,v,m]),this._tmpCtx.moveTo(a,r),this._tmpCtx.lineTo(h,r);break;default:this._tmpCtx.moveTo(a,r),this._tmpCtx.lineTo(h,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!M&&this._config.fontSize>=12&&!this._config.allowTransparency&&" "!==a){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let t=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(i,r-Math.ceil(e/2),this._config.deviceCellWidth*R,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=S.css,this._tmpCtx.strokeText(a,E,E+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(E,E+t),this._tmpCtx.lineTo(E+this._config.deviceCharWidth*R,E+t),this._tmpCtx.stroke()}if(M||this._tmpCtx.fillText(a,E,E+this._config.deviceCharHeight),"_"===a&&!this._config.allowTransparency){let e=vS(this._tmpCtx.getImageData(E,E,this._config.deviceCellWidth,this._config.deviceCellHeight),S,L,T);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=S.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,E,E+this._config.deviceCharHeight-t),e=vS(this._tmpCtx.getImageData(E,E,this._config.deviceCellWidth,this._config.deviceCellHeight),S,L,T),e);t++);}if(p){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(E,E+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(E+this._config.deviceCharWidth*R,E+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let P,D=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);if(P=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(D):vS(D,S,L,T),P)return _S;let B,A,N=this._findGlyphBoundingBox(D,this._workBoundingBox,l,k,M,E);for(;;){if(0===this._activePages.length){let e=this._createNewPage();B=e,A=e.currentRow,A.height=N.size.y;break}B=this._activePages[this._activePages.length-1],A=B.currentRow;for(let e of this._activePages)N.size.y<=e.currentRow.height&&(B=e,A=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=A.height&&N.size.y<=t.height&&(B=this._activePages[e],A=t);if(N.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new gS(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),B=this._overflowSizePage,A=this._overflowSizePage.currentRow,A.x+N.size.x>=B.canvas.width&&(A.x=0,A.y+=A.height,A.height=0);break}if(A.y+N.size.y>=B.canvas.height||A.height>N.size.y+2){let t=!1;if(B.currentRow.y+B.currentRow.height+N.size.y>=B.canvas.height){let i;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+N.size.y<e.canvas.height){i=e;break}if(i)B=i;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&A.y+N.size.y<=B.canvas.height&&A.height>=N.size.y&&A.x+N.size.x<=B.canvas.width)t=!0;else{let e=this._createNewPage();B=e,A=e.currentRow,A.height=N.size.y,t=!0}}t||(B.currentRow.height>0&&B.fixedRows.push(B.currentRow),A={x:0,y:B.currentRow.y+B.currentRow.height,height:N.size.y},B.fixedRows.push(A),B.currentRow={x:0,y:A.y+A.height,height:0})}if(A.x+N.size.x<=B.canvas.width)break;A===B.currentRow?(A.x=0,A.y+=A.height,A.height=0):B.fixedRows.splice(B.fixedRows.indexOf(A),1)}return N.texturePage=this._pages.indexOf(B),N.texturePosition.x=A.x,N.texturePosition.y=A.y,N.texturePositionClipSpace.x=A.x/B.canvas.width,N.texturePositionClipSpace.y=A.y/B.canvas.height,N.sizeClipSpace.x/=B.canvas.width,N.sizeClipSpace.y/=B.canvas.height,A.height=Math.max(A.height,N.size.y),A.x+=N.size.x,B.ctx.putImageData(D,N.texturePosition.x-this._workBoundingBox.left,N.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,N.size.x,N.size.y),B.addGlyph(N),B.version++,N}_findGlyphBoundingBox(e,t,i,r,s,n){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,a=r?this._config.deviceCellWidth:i,l=!1;for(let h=0;h<o;h++){for(let i=0;i<a;i++){let r=h*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[r]){t.top=h,l=!0;break}}if(l)break}t.left=0,l=!1;for(let h=0;h<n+a;h++){for(let i=0;i<o;i++){let r=i*this._tmpCanvas.width*4+4*h+3;if(0!==e.data[r]){t.left=h,l=!0;break}}if(l)break}t.right=a,l=!1;for(let h=n+a-1;h>=n;h--){for(let i=0;i<o;i++){let r=i*this._tmpCanvas.width*4+4*h+3;if(0!==e.data[r]){t.right=h,l=!0;break}}if(l)break}t.bottom=o,l=!1;for(let h=o-1;h>=0;h--){for(let i=0;i<a;i++){let r=h*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[r]){t.bottom=h,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+n+(r||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+n+(r||s?1===this._config.lineHeight?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},gS=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=mS(e,t,t),this.ctx=kb(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function vS(e,t,i,r){let s=t.rgba>>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,a=i.rgba>>>24,l=i.rgba>>>16&255,h=i.rgba>>>8&255,c=Math.floor((Math.abs(s-a)+Math.abs(n-l)+Math.abs(o-h))/12),u=!0;for(let d=0;d<e.data.length;d+=4)e.data[d]===s&&e.data[d+1]===n&&e.data[d+2]===o||r&&Math.abs(e.data[d]-s)+Math.abs(e.data[d+1]-n)+Math.abs(e.data[d+2]-o)<c?e.data[d+3]=0:u=!1;return u}function mS(e,t,i){let r=e.createElement("canvas");return r.width=t,r.height=i,r}function yS(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}var bS=[];function SS(e,t,i,r,s,n,o,a,l){let h=function(e,t,i,r,s,n,o,a){let l={foreground:n.foreground,background:n.background,cursor:wb,cursorAccent:wb,selectionForeground:wb,selectionBackgroundTransparent:wb,selectionBackgroundOpaque:wb,selectionInactiveBackgroundTransparent:wb,selectionInactiveBackgroundOpaque:wb,overviewRulerBorder:wb,scrollbarSliderBackground:wb,scrollbarSliderHoverBackground:wb,scrollbarSliderActiveBackground:wb,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:l}}(r,s,n,o,t,i,a,l);for(let d=0;d<bS.length;d++){let t=bS[d],i=t.ownedBy.indexOf(e);if(i>=0){if(yS(t.config,h))return t.atlas;1===t.ownedBy.length?(t.atlas.dispose(),bS.splice(d,1)):t.ownedBy.splice(i,1);break}}for(let d=0;d<bS.length;d++){let t=bS[d];if(yS(t.config,h))return t.ownedBy.push(e),t.atlas}let c=e._core,u={atlas:new pS(document,h,c.unicodeService),config:h,ownedBy:[e]};return bS.push(u),u.atlas}function wS(e){for(let t=0;t<bS.length;t++){let i=bS[t].ownedBy.indexOf(e);if(-1!==i){1===bS[t].ownedBy.length?(bS[t].atlas.dispose(),bS.splice(t,1)):bS[t].ownedBy.splice(i,1);break}}}var xS=600,CS=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=xS-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=xS-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(e)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},xS)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function kS(e,t,i){let r=new t.ResizeObserver(t=>{let s=t.find(t=>t.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s))return null==r||r.disconnect(),void(r=void 0);let n=s.devicePixelContentBoxSize[0].inlineSize,o=s.devicePixelContentBoxSize[0].blockSize;n>0&&o>0&&i(n,o)});try{r.observe(e,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return ib(()=>null==r?void 0:r.disconnect())}var LS=class e extends Jb{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Zb,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(2===e[1].length){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(i-55296)+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ES=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function MS(e,t,i){let r=kb(e.createProgram());if(e.attachShader(r,kb(RS(e,e.VERTEX_SHADER,t))),e.attachShader(r,kb(RS(e,e.FRAGMENT_SHADER,i))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function RS(e,t,i){let r=kb(e.createShader(t));if(e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}var TS=class{constructor(e){this.texture=e,this.version=-1}};var PS,DS=11,BS=DS*Float32Array.BYTES_PER_ELEMENT,AS=0,NS=0,IS=0,OS=class extends nb{constructor(e,t,i,r){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let s=this._gl;void 0===pS.maxAtlasPages&&(pS.maxAtlasPages=Math.min(32,kb(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),pS.maxTextureSize=kb(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=kb(MS(s,"#version 300 es\nlayout (location = 0) in vec2 a_unitquad;\nlayout (location = 1) in vec2 a_cellpos;\nlayout (location = 2) in vec2 a_offset;\nlayout (location = 3) in vec2 a_size;\nlayout (location = 4) in float a_texpage;\nlayout (location = 5) in vec2 a_texcoord;\nlayout (location = 6) in vec2 a_texsize;\n\nuniform mat4 u_projection;\nuniform vec2 u_resolution;\n\nout vec2 v_texcoord;\nflat out int v_texpage;\n\nvoid main() {\n vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);\n gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n v_texpage = int(a_texpage);\n v_texcoord = a_texcoord + a_unitquad * a_texsize;\n}",function(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es\nprecision lowp float;\n\nin vec2 v_texcoord;\nflat in int v_texpage;\n\nuniform sampler2D u_texture[${e}];\n\nout vec4 outColor;\n\nvoid main() {\n if (v_texpage == 0) {\n outColor = texture(u_texture[0], v_texcoord);\n } ${t}\n}`}(pS.maxAtlasPages))),this._register(ib(()=>s.deleteProgram(this._program))),this._projectionLocation=kb(s.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=kb(s.getUniformLocation(this._program,"u_resolution")),this._textureLocation=kb(s.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(ib(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(ib(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=kb(s.createBuffer()),this._register(ib(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,2,s.FLOAT,!1,BS,0),s.vertexAttribDivisor(2,1),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,s.FLOAT,!1,BS,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(3,1),s.enableVertexAttribArray(4),s.vertexAttribPointer(4,1,s.FLOAT,!1,BS,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(4,1),s.enableVertexAttribArray(5),s.vertexAttribPointer(5,2,s.FLOAT,!1,BS,5*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(5,1),s.enableVertexAttribArray(6),s.vertexAttribPointer(6,2,s.FLOAT,!1,BS,7*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(6,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,BS,9*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.useProgram(this._program);let h=new Int32Array(pS.maxAtlasPages);for(let c=0;c<pS.maxAtlasPages;c++)h[c]=c;s.uniform1iv(this._textureLocation,h),s.uniformMatrix4fv(this._projectionLocation,!1,ES),this._atlasTextures=[];for(let c=0;c<pS.maxAtlasPages;c++){let e=new TS(kb(s.createTexture()));this._register(ib(()=>s.deleteTexture(e.texture))),s.activeTexture(s.TEXTURE0+c),s.bindTexture(s.TEXTURE_2D,e.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[c]=e}s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(e,t,i,r,s,n,o,a,l){this._updateCell(this._vertices.attributes,e,t,i,r,s,n,o,a,l)}_updateCell(e,t,i,r,s,n,o,a,l,h){AS=(i*this._terminal.cols+t)*DS,0!==r&&void 0!==r?this._atlas&&(PS=a&&a.length>1?this._atlas.getRasterizedGlyphCombinedChar(a,s,n,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(r,s,n,o,!1,this._terminal.element),NS=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),s!==h&&PS.offset.x>NS?(IS=PS.offset.x-NS,e[AS]=-(PS.offset.x-IS)+this._dimensions.device.char.left,e[AS+1]=-PS.offset.y+this._dimensions.device.char.top,e[AS+2]=(PS.size.x-IS)/this._dimensions.device.canvas.width,e[AS+3]=PS.size.y/this._dimensions.device.canvas.height,e[AS+4]=PS.texturePage,e[AS+5]=PS.texturePositionClipSpace.x+IS/this._atlas.pages[PS.texturePage].canvas.width,e[AS+6]=PS.texturePositionClipSpace.y,e[AS+7]=PS.sizeClipSpace.x-IS/this._atlas.pages[PS.texturePage].canvas.width,e[AS+8]=PS.sizeClipSpace.y):(e[AS]=-PS.offset.x+this._dimensions.device.char.left,e[AS+1]=-PS.offset.y+this._dimensions.device.char.top,e[AS+2]=PS.size.x/this._dimensions.device.canvas.width,e[AS+3]=PS.size.y/this._dimensions.device.canvas.height,e[AS+4]=PS.texturePage,e[AS+5]=PS.texturePositionClipSpace.x,e[AS+6]=PS.texturePositionClipSpace.y,e[AS+7]=PS.sizeClipSpace.x,e[AS+8]=PS.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&function(e,t,i,r){return 1===t&&i>Math.ceil(1.5*r)&&void 0!==e&&e>255&&!function(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}(e)&&!Lb(e)&&!function(e){return 57344<=e&&e<=63743}(e)}(r,l,PS.size.x,this._dimensions.device.cell.width)&&(e[AS+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):e.fill(0,AS,AS+DS-1-2)}clear(){let e=this._terminal,t=e.cols*e.rows*DS;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let r=0;r<e.rows;r++)for(let t=0;t<e.cols;t++)this._vertices.attributes[i+9]=t/e.cols,this._vertices.attributes[i+10]=r/e.rows,i+=DS}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let s=0;s<e.lineLengths.length;s++){let t=s*this._terminal.cols*DS,n=this._vertices.attributes.subarray(t,t+e.lineLengths[s]*DS);i.set(n,r),r+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,r),t.STREAM_DRAW);for(let s=0;s<this._atlas.pages.length;s++)this._atlas.pages[s].version!==this._atlasTextures[s].version&&this._bindAtlasPageTexture(t,this._atlas,s);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,r/DS)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},zS=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])return void this.clear();let s=e.buffers.active.ydisp,n=t[1]-s,o=i[1]-s,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,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)}};var FS=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=new zS}resize(e,t){let i=e*t*4;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},jS=8*Float32Array.BYTES_PER_ELEMENT,WS=class{constructor(){this.attributes=new Float32Array(160),this.count=0}},HS=0,$S=0,US=0,KS=0,qS=0,VS=0,YS=0,GS=class extends nb{constructor(e,t,i,r){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=r,this._vertices=new WS,this._verticesCursor=new WS;let s=this._gl;this._program=kb(MS(s,"#version 300 es\nlayout (location = 0) in vec2 a_position;\nlayout (location = 1) in vec2 a_size;\nlayout (location = 2) in vec4 a_color;\nlayout (location = 3) in vec2 a_unitquad;\n\nuniform mat4 u_projection;\n\nout vec4 v_color;\n\nvoid main() {\n vec2 zeroToOne = a_position + (a_unitquad * a_size);\n gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n v_color = a_color;\n}","#version 300 es\nprecision lowp float;\n\nin vec4 v_color;\n\nout vec4 outColor;\n\nvoid main() {\n outColor = v_color;\n}")),this._register(ib(()=>s.deleteProgram(this._program))),this._projectionLocation=kb(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(ib(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(ib(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=kb(s.createBuffer()),this._register(ib(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,jS,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,jS,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,jS,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,ES),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t,i,r,s,n,o,a,l,h,c,u,d=this._terminal,f=this._vertices,_=1;for(t=0;t<d.rows;t++){for(r=-1,s=0,n=0,o=!1,i=0;i<d.cols;i++)a=4*(t*d.cols+i),l=e.cells[a+1],h=e.cells[a+2],c=!!(67108864&h),(l!==s||h!==n&&(o||c))&&((0!==s||o&&0!==n)&&(u=8*_++,this._updateRectangle(f,u,n,s,r,i,t)),r=i,s=l,n=h,o=c);(0!==s||o&&0!==n)&&(u=8*_++,this._updateRectangle(f,u,n,s,r,d.cols,t))}f.count=_}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||"block"===i.style)return void(t.count=0);let r,s=0;("bar"===i.style||"outline"===i.style)&&(r=8*s++,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,"bar"===i.style?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),("underline"===i.style||"outline"===i.style)&&(r=8*s++,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),"outline"===i.style&&(r=8*s++,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),r=8*s++,this._addRectangleFloat(t.attributes,r,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=s}_updateRectangle(e,t,i,r,s,n,o){if(67108864&i)switch(50331648&i){case 16777216:case 33554432:HS=this._themeService.colors.ansi[255&i].rgba;break;case 50331648:HS=(16777215&i)<<8;break;default:HS=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:HS=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:HS=(16777215&r)<<8;break;default:HS=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=function(e,t){let i=Math.min(2*e.length,t),r=new Float32Array(i);for(let s=0;s<e.length;s++)r[s]=e[s];return r}(e.attributes,this._terminal.rows*this._terminal.cols*8)),$S=s*this._dimensions.device.cell.width,US=o*this._dimensions.device.cell.height,KS=(HS>>24&255)/255,qS=(HS>>16&255)/255,VS=(HS>>8&255)/255,YS=1,this._addRectangle(e.attributes,t,$S,US,(n-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,KS,qS,VS,YS)}_addRectangle(e,t,i,r,s,n,o,a,l,h){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=l,e[t+7]=h}_addRectangleFloat(e,t,i,r,s,n,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}},XS=class extends nb{constructor(e,t,i,r,s,n,o,a){super(),this._container=t,this._alpha=s,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(ib(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=kb(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=SS(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Ob,this._clipCell(i,r,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){return`${i?"italic":""} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},QS=class extends XS{constructor(e,t,i,r,s,n,o){super(i,e,"link",t,!0,s,n,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(257===e.fg?this._ctx.fillStyle=this._themeService.colors.background.css:void 0!==e.fg&&function(e){return 16777216==(50331648&e)||33554432==(50331648&e)}(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},JS="object"==typeof window?window:globalThis,ZS=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new dS,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new dS,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(i,e),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToFullScreen.set(i,e),this._onDidChangeFullscreen.fire(i)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};ZS.INSTANCE=new ZS;var ew=ZS;ew.INSTANCE.onDidChangeZoomLevel,ew.INSTANCE.onDidChangeFullscreen;var tw="object"==typeof navigator?navigator.userAgent:"";tw.indexOf("Firefox"),tw.indexOf("AppleWebKit"),!(tw.indexOf("Chrome")>=0)&&tw.indexOf("Safari"),tw.indexOf("Electron/"),tw.indexOf("Android");var iw=!1;if("function"==typeof JS.matchMedia){let e=JS.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=JS.matchMedia("(display-mode: fullscreen)");iw=e.matches,function(e,t,i){"string"==typeof t&&(t=e.matchMedia(t)),t.addEventListener("change",i)}(JS,e,({matches:e})=>{iw&&t.matches||(iw=e)})}var rw,sw,nw="en",ow=!1,aw=nw,lw=globalThis;typeof lw.vscode<"u"&&typeof lw.vscode.process<"u"?sw=lw.vscode.process:typeof process<"u"&&"string"==typeof(null==(o=null==process?void 0:process.versions)?void 0:o.node)&&(sw=process);var hw="string"==typeof(null==(a=null==sw?void 0:sw.versions)?void 0:a.electron)&&"renderer"===(null==sw?void 0:sw.type);if("object"==typeof sw){sw.platform,sw.platform,"linux"===sw.platform&&!!sw.env.SNAP&&sw.env.SNAP_REVISION,!!sw.env.CI||sw.env.BUILD_ARTIFACTSTAGINGDIRECTORY,aw=nw;let e=sw.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,aw=t.resolvedLanguage||nw,null==(l=t.languagePack)?void 0:l.translationsConfigFile}catch{}ow=!0}else"object"!=typeof navigator||hw?console.error("Unable to resolve platform."):((rw=navigator.userAgent).indexOf("Windows"),rw.indexOf("Macintosh"),(rw.indexOf("Macintosh")>=0||rw.indexOf("iPad")>=0||rw.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints,rw.indexOf("Linux")>=0,null==rw||rw.indexOf("Mobi"),aw=globalThis._VSCODE_NLS_LANGUAGE||nw,navigator.language.toLowerCase());var cw,uw=ow,dw=rw,fw=aw;(e=>{e.value=function(){return fw},e.isDefaultVariant=function(){return 2===fw.length?"en"===fw:fw.length>=3&&("e"===fw[0]&&"n"===fw[1]&&"-"===fw[2])},e.isDefault=function(){return"en"===fw}})(cw||(cw={}));var _w="function"==typeof lw.postMessage&&!lw.importScripts;(()=>{if(_w){let e=[];lw.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let r=e[i];if(r.id===t.data.vscodeScheduleAsyncWork)return e.splice(i,1),void r.callback()}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),lw.postMessage({vscodeScheduleAsyncWork:r},"*")}}})();var pw=!!(dw&&dw.indexOf("Chrome")>=0);dw&&dw.indexOf("Firefox"),!pw&&dw&&dw.indexOf("Safari"),dw&&dw.indexOf("Edg/"),dw&&dw.indexOf("Android");var gw="object"==typeof navigator?navigator:{};uw||document.queryCommandSupported&&document.queryCommandSupported("copy")||gw&&gw.clipboard&&gw.clipboard.writeText,uw||gw&&gw.clipboard&&gw.clipboard.readText;var vw,mw,yw=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}},bw=new yw,Sw=new yw,ww=new yw;new Array(230),(mw=vw||(vw={})).toString=function(e){return bw.keyCodeToStr(e)},mw.fromString=function(e){return bw.strToKeyCode(e)},mw.toUserSettingsUS=function(e){return Sw.keyCodeToStr(e)},mw.toUserSettingsGeneral=function(e){return ww.keyCodeToStr(e)},mw.fromUserSettings=function(e){return Sw.strToKeyCode(e)||ww.strToKeyCode(e)},mw.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return bw.keyCodeToStr(e)};var xw,Cw=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(e=>{e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof Lw||!(!t||"object"!=typeof t)&&("boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested)},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Vb.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Cw})})(xw||(xw={}));var kw,Lw=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?Cw:(this._emitter||(this._emitter=new dS),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};(e=>{e.settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if(typeof t<"u")throw t;return i},e.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(mw){i(mw)}})}})(kw||(kw={}));var Ew=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new dS,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(i){this.reject(i)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await Vb.toPromise(this._onStateChanged.event)}},return:async()=>{var e;return null==(e=this._onReturn)||e.call(this),{done:!0,value:void 0}}}}static map(t,i){return new e(async e=>{for await(let r of t)e.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let r of t)i(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Ew.EMPTY=Ew.fromArray([]);var{getWindow:Mw}=function(){let e=new Map,t={window:JS,disposables:new sb};e.set(JS.vscodeWindowId,t);let i=new dS,r=new dS,s=new dS;return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return nb.None;let n=new sb,o={window:t,disposables:n.add(new sb)};return e.set(t.vscodeWindowId,o),n.add(ib(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),n.add(Tw(t,Pw.BEFORE_UNLOAD,()=>{s.fire(t)})),i.fire(o),n},getWindows:()=>e.values(),getWindowsCount:()=>e.size,getWindowId:e=>e.vscodeWindowId,hasWindow:t=>e.has(t),getWindowById:function(i,r){return("number"==typeof i?e.get(i):void 0)??(r?t:void 0)},getWindow(e){var t;let i=e;if(null==(t=null==i?void 0:i.ownerDocument)?void 0:t.defaultView)return i.ownerDocument.defaultView.window;let r=e;return(null==r?void 0:r.view)?r.view.window:JS},getDocument:e=>Mw(e).document}}(),Rw=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 Tw(e,t,i,r){return new Rw(e,t,i,r)}var Pw={BEFORE_UNLOAD:"beforeunload"},Dw=class extends nb{constructor(e,t,i,r,s,n,o,a,l){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new ob,this._charAtlasDisposable=this._register(new ob),this._observerDisposable=this._register(new ob),this._model=new FS,this._workCell=new LS,this._workCell2=new LS,this._rectangleRenderer=this._register(new ob),this._glyphRenderer=this._register(new ob),this._onChangeTextureAtlas=this._register(new dS),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new dS),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new dS),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new dS),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new dS),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let h={antialias:!1,depth:!1,preserveDrawingBuffer:l};if(this._gl=this._canvas.getContext("webgl2",h),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Ib(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new QS(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions={css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}},this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Tw(this._canvas,"webglcontextlost",e=>{console.log("webglcontextlost event received"),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(e)},3e3)})),this._register(Tw(this._canvas,"webglcontextrestored",e=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,wS(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=kS(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=kS(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ib(()=>{var e;for(let t of this._renderLayers)t.dispose();null==(e=this._canvas.parentElement)||e.removeChild(this._canvas),wS(this._terminal)}))}get textureAtlas(){var e;return null==(e=this._charAtlas)?void 0:e.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){var i,r,s,n;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let o of this._renderLayers)o.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,null==(i=this._rectangleRenderer.value)||i.setDimensions(this.dimensions),null==(r=this._rectangleRenderer.value)||r.handleResize(),null==(s=this._glyphRenderer.value)||s.setDimensions(this.dimensions),null==(n=this._glyphRenderer.value)||n.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var e;for(let t of this._renderLayers)t.handleBlur(this._terminal);null==(e=this._cursorBlinkStateManager.value)||e.pause(),this._requestRedrawViewport()}handleFocus(){var e;for(let t of this._renderLayers)t.handleFocus(this._terminal);null==(e=this._cursorBlinkStateManager.value)||e.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){var e;for(let t of this._renderLayers)t.handleCursorMove(this._terminal);null==(e=this._cursorBlinkStateManager.value)||e.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new GS(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new OS(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let t=SS(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=tb(Vb.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Vb.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),null==(e=this._glyphRenderer.value)||e.setAtlas(this._charAtlas)}_clearModel(e){var t;this._model.clear(),e&&(null==(t=this._glyphRenderer.value)||t.clear())}clearTextureAtlas(){var e;null==(e=this._charAtlas)||e.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var e;this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);null==(e=this._cursorBlinkStateManager.value)||e.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){var i;if(!this._isAttached){if(!((null==(i=this._core.screenElement)?void 0:i.isConnected)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let r of this._renderLayers)r.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new CS(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i,r,s,n,o,a,l,h,c,u,d,f,_,p,g,v=this._core,m=this._workCell,y=0,b=!0;e=Aw(e,v.rows-1,0),t=Aw(t,v.rows-1,0);let S=this._coreService.decPrivateModes.cursorStyle??v.options.cursorStyle??"block",w=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=w-v.buffer.ydisp,C=Math.min(this._terminal.buffer.active.cursorX,v.cols-1),k=-1,L=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(r=e;r<=t;r++)for(s=r+v.buffer.ydisp,n=v.buffer.lines.get(s),this._model.lineLengths[r]=0,c=w===s,y=0,o=this._characterJoinerService.getJoinedCharacters(s),p=0;p<v.cols;p++){if(i=this._cellColorResolver.result.bg,n.loadCell(p,m),0===p&&(i=this._cellColorResolver.result.bg),a=!1,b=p>=y,l=p,o.length>0&&p===o[0][0]&&b){h=o.shift();let e=this._model.selection.isCellSelected(this._terminal,h[0],s);for(_=h[0]+1;_<h[1];_++)b&&(b=e===this._model.selection.isCellSelected(this._terminal,_,s));b&&(b=!c||C<h[0]||C>=h[1]),b?(a=!0,m=new Bw(m,n.translateToString(!0,h[0],h[1]),h[1]-h[0]),l=h[1]-1):y=h[1]}if(u=m.getChars(),d=m.getCode(),_=4*(r*v.cols+p),this._cellColorResolver.resolve(m,p,s,this.dimensions.device.cell.width),L&&s===w&&(p===C&&(this._model.cursor={x:C,y:x,width:m.getWidth(),style:this._coreBrowserService.isFocused?S:v.options.cursorInactiveStyle,cursorWidth:v.options.cursorWidth,dpr:this._devicePixelRatio},k=C+m.getWidth()-1),p>=C&&p<=k&&(this._coreBrowserService.isFocused&&"block"===S||!1===this._coreBrowserService.isFocused&&"block"===v.options.cursorInactiveStyle)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),0!==d&&(this._model.lineLengths[r]=p+1),(this._model.cells[_]!==d||this._model.cells[_+1]!==this._cellColorResolver.result.bg||this._model.cells[_+2]!==this._cellColorResolver.result.fg||this._model.cells[_+3]!==this._cellColorResolver.result.ext)&&(E=!0,u.length>1&&(d|=2147483648),this._model.cells[_]=d,this._model.cells[_+1]=this._cellColorResolver.result.bg,this._model.cells[_+2]=this._cellColorResolver.result.fg,this._model.cells[_+3]=this._cellColorResolver.result.ext,f=m.getWidth(),this._glyphRenderer.value.updateCell(p,r,d,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,u,f,i),a)){for(m=this._workCell,p++;p<=l;p++)g=4*(r*v.cols+p),this._glyphRenderer.value.updateCell(p,r,0,0,0,0,"",0,0),this._model.cells[g]=0,this._model.cells[g+1]=this._cellColorResolver.result.bg,this._model.cells[g+2]=this._cellColorResolver.result.fg,this._model.cells[g+3]=this._cellColorResolver.result.ext;p--}}E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=1===this._optionsService.rawOptions.lineHeight?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},Bw=class extends Jb{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()]}};function Aw(e,t,i=0){return Math.max(Math.min(e,t),i)}var Nw="di$target",Iw="di$dependencies",Ow=new Map;function zw(e){if(Ow.has(e))return Ow.get(e);let t=function(e,i,r){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,i){t[Nw]===t?t[Iw].push({id:e,index:i}):(t[Iw]=[{id:e,index:i}],t[Nw]=t)}(t,e,r)};return t._id=e,Ow.set(e,t),t}zw("BufferService"),zw("CoreMouseService"),zw("CoreService"),zw("CharsetService"),zw("InstantiationService"),zw("LogService");var Fw=zw("OptionsService");zw("OscLinkService"),zw("UnicodeService"),zw("DecorationService");var jw={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ww=class extends nb{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=jw[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Ww=((e,t)=>{for(var i,r=t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=i(r)||r);return r})([((e,t)=>(i,r)=>t(i,r,e))(0,Fw)],Ww);var Hw=class extends nb{constructor(e){if(db&&function(){if(!db)return 0;let e=lb.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new dS),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new dS),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new dS),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new dS),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element)return void this._register(t.onWillOpen(()=>this.activate(e)));this._terminal=e;let i=t.coreService,r=t.optionsService,s=t,n=s._renderService,o=s._characterJoinerService,a=s._charSizeService,l=s._coreBrowserService,h=s._decorationService;s._logService;let c=s._themeService;this._renderer=this._register(new Dw(e,o,a,l,i,h,r,c,this._preserveDrawingBuffer)),this._register(Vb.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Vb.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Vb.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Vb.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(ib(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){var e;return null==(e=this._renderer)?void 0:e.textureAtlas}clearTextureAtlas(){var e;null==(e=this._renderer)||e.clearTextureAtlas()}};function $w(){return"light"===dd(gd.getState().theme)?Gu:Yu}const Uw=new Set,Kw=new Map,qw=new Map,Vw=new Map,Yw=new Map,Gw=new Map;function Xw(e){const t="light"===dd(gd.getState().theme);e.options.theme=$w(),e.options.minimumContrastRatio=t?7:1}let Qw=gd.getState().theme;function Jw(e,t){if(!Yw.has(e))try{const i=new Hw;i.onContextLoss(()=>{i.dispose(),Yw.delete(e)}),t.loadAddon(i),Yw.set(e,i)}catch{}}function Zw(e){const t=Yw.get(e);t&&(t.dispose(),Yw.delete(e))}gd.subscribe(e=>{if(e.theme!==Qw){Qw=e.theme;for(const e of Gw.values())Xw(e)}});let ex=gd.getState().gpuRendering;function tx(e){return qw.get(e)}gd.subscribe(e=>{if(e.gpuRendering!==ex){ex=e.gpuRendering;for(const[t,i]of Gw)e.gpuRendering?Jw(t,i):Zw(t)}});const ix=new Map;function rx({terminalId:e,projectId:t,cwd:i}){const r=Y.useRef(null),s=Y.useRef(null),n=Y.useRef(null),o=Y.useRef(null),a=$u(e=>e.setTerminalInstance),l=$u(e=>e.createSession),h=gd(e=>e.setFocusedTerminal);Y.useEffect(()=>{var c,u;const d=r.current;if(!d)return;d.innerHTML="";const f=$u.getState().sessions[e],_=Kw.get(e);if((null==f?void 0:f.terminal)&&_){const t=f.terminal;s.current=t,d.appendChild(_);let i=Vw.get(e);return i||(i=new Fm,t.loadAddon(i),Vw.set(e,i)),n.current=i,requestAnimationFrame(()=>{try{i.fit(),t.scrollToBottom();const{cols:r,rows:s}=t;o.current={cols:r,rows:s},ox({type:"pty:resize",terminalId:e,cols:r,rows:s})}catch{}}),()=>{}}const p=$w(),g="light"===dd(gd.getState().theme),v=new zm({theme:p,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",allowProposedApi:!0,scrollback:1e4,minimumContrastRatio:g?7:1}),m=new Fm,y=new Km((e,t)=>{(e.ctrlKey||e.metaKey)&&ox({type:"open:url",url:t})}),b=new Ky;v.loadAddon(m),v.loadAddon(y),v.loadAddon(b),v.open(d),Vw.set(e,m),qw.set(e,b),s.current=v,n.current=m,v.element&&Kw.set(e,v.element),gd.getState().gpuRendering&&Jw(e,v);const S=null==(c=v.element)?void 0:c.querySelector(".xterm-screen");return S&&S.addEventListener("mouseup",t=>{const i=t;i.ctrlKey||i.metaKey||setTimeout(()=>{if(v.hasSelection())return;const t=v.buffer.active;if(t.viewportY!==t.baseY)return;const r=S.getBoundingClientRect(),s=Math.floor((i.clientX-r.left)/(r.width/v.cols));if(Math.floor((i.clientY-r.top)/(r.height/v.rows))!==t.cursorY)return;const n=t.getLine(t.baseY+t.cursorY);if(!n)return;const o=n.translateToString().trimEnd().length,a=Math.min(s,o)-t.cursorX;if(0===a)return;ox({type:"pty:input",terminalId:e,data:(a>0?"":"").repeat(Math.abs(a))})},0)}),null==(u=v.element)||u.addEventListener("copy",e=>{var t;const i=v.getSelection();if(i){const r=i.split("\n").map(e=>e.trimEnd()).join("\n");null==(t=e.clipboardData)||t.setData("text/plain",r),e.preventDefault()}}),l(e,t),a(e,v),v.attachCustomKeyEventHandler(t=>{if("Enter"===t.key&&t.shiftKey)return"keydown"===t.type&&ox({type:"pty:input",terminalId:e,data:"\n"}),!1;if(t.metaKey&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&"keydown"===t.type){if("ArrowLeft"===t.key)return ox({type:"pty:input",terminalId:e,data:""}),!1;if("ArrowRight"===t.key)return ox({type:"pty:input",terminalId:e,data:""}),!1;if("Backspace"===t.key)return ox({type:"pty:input",terminalId:e,data:""}),!1}return!(t.metaKey&&"f"===t.key&&!t.altKey&&!t.ctrlKey)&&(!(t.metaKey&&"p"===t.key&&!t.altKey&&!t.ctrlKey)&&(!(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)&&t.ctrlKey&&t.shiftKey&&!t.metaKey&&!t.altKey)&&(!(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)&&t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey)||"alternate"===v.buffer.active.type)))}),v.onData(t=>{ox({type:"pty:input",terminalId:e,data:t})}),v.onTitleChange(t=>{$u.getState().setTitle(e,t)}),Uw.has(e)||(Uw.add(e),requestAnimationFrame(()=>{try{m.fit()}catch{}ox({type:"pty:spawn",terminalId:e,projectId:t,cwd:i}),ox({type:"pty:resize",terminalId:e,cols:v.cols,rows:v.rows}),o.current={cols:v.cols,rows:v.rows},v.focus(),h(e)})),()=>{}},[e,t,i,l,a]),Y.useEffect(()=>{const t=s.current;t&&(Xw(t),function(e,t){Gw.set(e,t)}(e,t));const i=window.matchMedia("(prefers-color-scheme: light)"),r=()=>{t&&"system"===gd.getState().theme&&Xw(t)};return i.addEventListener("change",r),()=>{var t;t=e,Gw.delete(t),i.removeEventListener("change",r)}},[e]);const c=Y.useCallback(()=>{const t=n.current,i=s.current;if(t&&i)try{t.fit(),i.scrollToBottom();const{cols:r,rows:s}=i,n=o.current;n&&n.cols===r&&n.rows===s||(o.current={cols:r,rows:s},ox({type:"pty:resize",terminalId:e,cols:r,rows:s}))}catch{}},[e]),u=Y.useCallback(()=>{var t;null==(t=s.current)||t.focus(),h(e)},[e,h]);return{containerRef:r,fit:c,focus:u,terminalRef:s}}function sx(e){Uw.delete(e),Kw.delete(e),Vw.delete(e),qw.delete(e),Zw(e),Gw.delete(e)}let nx=null;function ox(e){(null==nx?void 0:nx.readyState)===WebSocket.OPEN&&nx.send(JSON.stringify(e))}function ax(){const e=gd(e=>e.setConnectionStatus),t=Vu(e=>e.addProject),i=Vu(e=>e.setActiveProject),r=Y.useRef(),s=Y.useCallback(()=>{if((null==nx?void 0:nx.readyState)===WebSocket.OPEN||(null==nx?void 0:nx.readyState)===WebSocket.CONNECTING)return;e("connecting");const n=new WebSocket(`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}/ws`);nx=n,n.onopen=()=>{e("connected"),ox({type:"editor:sync",enabled:gd.getState().editorSyncEnabled})},n.onmessage=e=>{var r,s,n;try{const o=JSON.parse(e.data);if("pty:output"===o.type){const e=$u.getState().sessions[o.terminalId];null==(r=null==e?void 0:e.terminal)||r.write(o.data);const t=function(e){const t=ix.get(e);return void 0!==t?(ix.delete(e),t):null}(o.terminalId);return void(t&&ox({type:"pty:input",terminalId:o.terminalId,data:t}))}if("pty:exit"===o.type){const e=o.terminalId,t=$u.getState().sessions[e],i=null==t?void 0:t.projectId;if(null==(s=null==t?void 0:t.terminal)||s.dispose(),$u.getState().removeSession(e),sx(e),i){cd.getState().removePaneFromProject(i,e),Vu.getState().removeTerminalFromProject(i,e);const t=Xu(cd.getState().getLayout(i)),r=gd.getState().focusedTerminalId;if(r===e&&t.length>0){const e=t[0];gd.getState().setFocusedTerminal(e);const i=$u.getState().sessions[e];null==(n=null==i?void 0:i.terminal)||n.focus()}else r===e&&gd.getState().setFocusedTerminal(null)}return}if("project:spawned"===o.type){const e=Object.values(Vu.getState().projects).find(e=>e.cwd===o.cwd);return void(e?i(e.id):(t({id:o.projectId,name:o.name,cwd:o.cwd,terminalIds:[]}),i(o.projectId)))}if("port:status"===o.type)return void $u.getState().setActivePorts(o.ports);if("claude:status"===o.type)return void $u.getState().setClaudeStatus(o.statuses);if("git:branch"===o.type)return void $u.getState().setGitBranches(o.branches);if("inbox:paste"===o.type){const e=gd.getState().focusedTerminalId;if(e&&o.files.length>0){ox({type:"pty:input",terminalId:e,data:o.files.map(e=>"'"+e.replace(/'/g,"'\\''")+"'").join(" ")})}return}if("editor:status"===o.type)return void $u.getState().setEditorNeedsAccessibility(o.needsAccessibility);if("editor:active"===o.type){if(!gd.getState().editorSyncEnabled)return;const{projects:e,activeProjectId:t}=Vu.getState(),r=Object.values(e).find(e=>{const t=e.cwd.replace(/\/$/,"").split("/").pop();return e.name===o.projectName||t===o.projectName});r&&r.id!==t&&(gd.getState().showSyncToast(r.name),i(r.id))}}catch{}},n.onclose=()=>{e("disconnected"),$u.getState().setActivePorts({}),$u.getState().setClaudeStatus({}),$u.getState().setGitBranches({}),$u.getState().setEditorNeedsAccessibility(!1),nx=null,r.current=setTimeout(s,2e3)},n.onerror=()=>{n.close()}},[e,t,i]);Y.useEffect(()=>(s(),()=>{clearTimeout(r.current)}),[s])}const lx=new Set(["n","w","t","d","r","f","p"]);const hx=Hu()((e,t)=>({favourites:{},addFavourite:i=>{e(e=>({favourites:{...e.favourites,[i.id]:i}})),qu({favourites:{...t().favourites}})},updateFavourite:(i,r)=>{e(e=>{const t=e.favourites[i];return t?{favourites:{...e.favourites,[i]:{...t,...r}}}:e}),qu({favourites:{...t().favourites}})},removeFavourite:i=>{e(e=>{const{[i]:t,...r}=e.favourites;return{favourites:r}}),qu({favourites:{...t().favourites}})},hydrateFromServer:async()=>{try{const t=await fetch("/api/settings"),i=await t.json();i.favourites&&e({favourites:i.favourites})}catch{}}})),cx=(...e)=>e.filter((e,t,i)=>Boolean(e)&&i.indexOf(e)===t).join(" ");
63
+ /**
64
+ * @license lucide-react v0.400.0 - ISC
65
+ *
66
+ * This source code is licensed under the ISC license.
67
+ * See the LICENSE file in the root directory of this source tree.
68
+ */
69
+ /**
70
+ * @license lucide-react v0.400.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ */
75
+ var ux={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
76
+ /**
77
+ * @license lucide-react v0.400.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const dx=Y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:i=2,absoluteStrokeWidth:r,className:s="",children:n,iconNode:o,...a},l)=>Y.createElement("svg",{ref:l,...ux,width:t,height:t,stroke:e,strokeWidth:r?24*Number(i)/Number(t):i,className:cx("lucide",s),...a},[...o.map(([e,t])=>Y.createElement(e,t)),...Array.isArray(n)?n:[n]])),fx=(e,t)=>{const i=Y.forwardRef(({className:i,...r},s)=>{return Y.createElement(dx,{ref:s,iconNode:t,className:cx(`lucide-${n=e,n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,i),...r});var n});return i.displayName=`${e}`,i},_x=fx("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]),px=fx("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),gx=fx("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),vx=fx("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),mx=fx("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]),yx=fx("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),bx=fx("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),Sx=fx("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),wx=fx("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),xx=fx("Grid2x2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M12 3v18",key:"108xh3"}]]),Cx=fx("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),kx=fx("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),Lx=fx("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),Ex=fx("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),Mx=fx("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]),Rx=fx("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),Tx=fx("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),Px=fx("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]),Dx=fx("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]),Bx=fx("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ax=fx("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]),Nx=fx("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),Ix=fx("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),Ox=fx("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),zx=fx("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]),Fx=fx("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),jx=fx("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]),Wx=fx("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),Hx=fx("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),$x=fx("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),Ux=fx("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Kx=fx("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),qx=fx("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);
82
+ /**
83
+ * @license lucide-react v0.400.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */function Vx(e){Xu(cd.getState().getLayout(e)).forEach(e=>{var t;const i=$u.getState().sessions[e];null==(t=null==i?void 0:i.terminal)||t.dispose(),$u.getState().removeSession(e),sx(e)}),ox({type:"project:kill",projectId:e}),cd.getState().setLayout(e,null),Vu.getState().clearProjectTerminals(e)}function Yx(){const e=window.__panefulDropPaths;return Array.isArray(e)&&e.length>0?(window.__panefulDropPaths=null,e):null}function Gx(e){return/[ ()'"]/.test(e)?`'${e.replace(/'/g,"'\\''")}'`:e}function Xx(e){return e.split(/[\r\n]+/).map(e=>e.trim()).filter(e=>e.startsWith("file://")).map(e=>{try{return decodeURIComponent(new URL(e).pathname)}catch{return null}}).filter(e=>null!==e&&e.length>0)}const Qx=G.memo(function({project:e,isActive:t,hasActivePorts:i,claudeStatus:r,gitStatus:s,onClick:n,onKill:o,onRemove:a}){const l=e.terminalIds.length,h=Y.useRef(null);return Y.useEffect(()=>{t&&h.current&&h.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[t]),re.jsxs("div",{ref:h,onClick:n,className:`\n group flex items-center gap-2 px-3 py-2 mx-2 mb-1 rounded-lg cursor-pointer scroll-my-8\n transition-colors duration-100\n ${t?"bg-[var(--surface-2)] text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--surface-2)] hover:text-[var(--text-primary)]"}\n `,children:[re.jsx(Sx,{size:14,className:t?"text-accent":"text-[var(--text-muted)]"}),re.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[re.jsxs("div",{className:"text-xs font-medium truncate flex items-center gap-1.5",children:[e.name,r&&re.jsx("span",{className:"shrink-0 text-[8px] font-bold leading-none px-1 py-0.5 rounded "+("active"===r?"bg-purple-500/20 text-purple-400 animate-pulse":"bg-purple-500/10 text-purple-400/50"),title:"active"===r?"Agent is working":"Agent session open",children:"AI"}),i&&re.jsx("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full bg-[var(--success)]",title:"Dev server running"})]}),s&&re.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[re.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[var(--text-muted)] text-[10px] font-medium truncate max-w-full",children:[re.jsx(wx,{size:8,className:"shrink-0"}),re.jsx("span",{className:"truncate",children:s.branch})]}),s.ahead>0&&re.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)]",title:`${s.ahead} ahead`,children:["↑",s.ahead]}),s.behind>0&&re.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)]",title:`${s.behind} behind`,children:["↓",s.behind]}),s.staged>0&&re.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)]",title:`${s.staged} staged`,children:["+ ",s.staged]}),s.modified>0&&re.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)]",title:`${s.modified} modified`,children:[re.jsx("span",{className:"text-[5px]",children:"●"})," ",s.modified]})]}),re.jsx("div",{className:"text-[10px] text-[var(--text-muted)] truncate font-mono",children:e.cwd})]}),l>0&&re.jsxs("span",{className:"text-[10px] tabular-nums px-1.5 py-0.5 rounded-full bg-[var(--surface-3)] text-[var(--text-muted)] flex items-center gap-0.5",children:[re.jsx(Hx,{size:8}),l]}),re.jsxs("div",{className:"hidden group-hover:flex items-center gap-0.5",children:[l>0&&re.jsx("button",{onClick:e=>{e.stopPropagation(),o()},title:"Kill all terminals",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:re.jsx(yx,{size:12})}),re.jsx("button",{onClick:e=>{e.stopPropagation(),a()},title:"Remove project",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:re.jsx($x,{size:12})})]})]})});function Jx({open:e,onClose:t,onCreate:i,initialName:r,initialCwd:s}){const[n,o]=Y.useState(""),[a,l]=Y.useState("~"),[h,c]=Y.useState(null),[u,d]=Y.useState(!1),f=Y.useRef(null);Y.useEffect(()=>{e&&(o(r??""),l(s??"~"),c(null),setTimeout(()=>{var e;return null==(e=f.current)?void 0:e.focus()},50))},[e,r,s]);const _=Y.useCallback(async e=>{if(e.preventDefault(),!n.trim())return;const r=a.trim()||"~",s=Object.values(Vu.getState().projects).find(e=>e.cwd===r);if(s)c(`Project "${s.name}" already uses this directory`);else{d(!0),c(null);try{const e=await fetch("/api/validate-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})}),{valid:t}=await e.json();if(!t)return c("Directory does not exist"),void d(!1)}catch{return c("Could not validate path"),void d(!1)}d(!1),i(n.trim(),r),t()}},[n,a,i,t]);return e?re.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:re.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[400px] shadow-2xl animate-fade-in",onClick:e=>e.stopPropagation(),children:[re.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[re.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"New Project"}),re.jsx("button",{onClick:t,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:re.jsx(Kx,{size:14})})]}),re.jsxs("form",{onSubmit:_,className:"p-4 space-y-4",children:[re.jsxs("div",{children:[re.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Project Name"}),re.jsx("input",{ref:f,value:n,onChange:e=>o(e.target.value),placeholder:"my-project",className:"\n w-full px-3 py-2 text-sm\n bg-[var(--surface-0)] border border-[var(--border)]\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded-lg outline-none\n focus:border-accent focus:ring-1 focus:ring-accent/30\n transition-colors\n "})]}),re.jsxs("div",{children:[re.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Working Directory"}),re.jsx("input",{value:a,onChange:e=>{l(e.target.value),c(null)},placeholder:"/path/to/project",className:`\n w-full px-3 py-2 text-sm font-mono\n bg-[var(--surface-0)] border\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded-lg outline-none\n transition-colors\n ${h?"border-[var(--danger)] focus:border-[var(--danger)] focus:ring-1 focus:ring-[var(--danger)]/30":"border-[var(--border)] focus:border-accent focus:ring-1 focus:ring-accent/30"}\n `}),h&&re.jsx("p",{className:"mt-1.5 text-[11px] text-[var(--danger)]",children:h})]}),re.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[re.jsx("button",{type:"button",onClick:t,className:"\n px-3 py-1.5 text-xs text-[var(--text-secondary)]\n hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]\n rounded-lg transition-colors\n ",children:"Cancel"}),re.jsx("button",{type:"submit",disabled:!n.trim()||u,className:"\n px-3 py-1.5 text-xs font-medium\n bg-accent hover:bg-accent/80\n disabled:opacity-40 disabled:cursor-not-allowed\n text-white rounded-lg transition-colors\n ",children:u?"Checking...":"Create"})]})]})]})}):null}const Zx={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function eC({favourite:e,onLaunch:t,onEdit:i,onDelete:r}){const s=`${Zx[e.preset]??e.preset}, ${e.slots.length} terminal${1!==e.slots.length?"s":""}`;return re.jsxs("div",{className:"\n group flex items-center gap-2 px-3 py-2 mx-2 rounded-lg cursor-pointer\n text-[var(--text-secondary)] hover:bg-[var(--surface-2)] hover:text-[var(--text-primary)]\n transition-colors duration-100\n ",onClick:t,children:[re.jsx(jx,{size:14,className:"text-[var(--text-muted)] flex-shrink-0"}),re.jsxs("div",{className:"flex-1 min-w-0",children:[re.jsx("div",{className:"text-xs font-medium truncate",children:e.name}),re.jsxs("div",{className:"text-[10px] text-[var(--text-muted)] truncate flex items-center gap-0.5",children:[re.jsx(Hx,{size:8}),s]})]}),re.jsxs("div",{className:"hidden group-hover:flex items-center gap-0.5",children:[re.jsx("button",{onClick:e=>{e.stopPropagation(),t()},title:"Launch",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--success)] hover:bg-green-500/10 transition-colors",children:re.jsx(Ix,{size:12})}),re.jsx("button",{onClick:e=>{e.stopPropagation(),i()},title:"Edit",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:re.jsx(Nx,{size:12})}),re.jsx("button",{onClick:e=>{e.stopPropagation(),r()},title:"Delete",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:re.jsx($x,{size:12})})]})]})}function tC({favourites:e,onLaunch:t,onEdit:i,onDelete:r}){const[s,n]=Y.useState(!1);return 0===e.length?null:re.jsxs("div",{children:[re.jsxs("button",{onClick:()=>n(!s),className:"\n flex items-center gap-1 w-full px-4 py-1.5\n text-[10px] font-semibold uppercase tracking-wider\n text-[var(--text-muted)] hover:text-[var(--text-secondary)]\n transition-colors\n ",children:[s?re.jsx(gx,{size:10}):re.jsx(px,{size:10}),"Favourites"]}),!s&&re.jsx("div",{children:e.map(e=>re.jsx(eC,{favourite:e,onLaunch:()=>t(e),onEdit:()=>i(e),onDelete:()=>r(e.id)},e.id))})]})}const iC={"even-horizontal":re.jsx(zx,{size:16}),"even-vertical":re.jsx(bx,{size:16}),"main-left":re.jsx(Bx,{size:16}),"main-top":re.jsx(Ax,{size:16}),grid:re.jsx(xx,{size:16})},rC={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function sC({open:e,onClose:t,onSave:i,editingFavourite:r,defaultPreset:s,defaultSlotCount:n}){const[o,a]=Y.useState(""),[l,h]=Y.useState("even-horizontal"),[c,u]=Y.useState([{label:"",command:""}]),d=Y.useRef(null);if(Y.useEffect(()=>{if(e){if(r)a(r.name),h(r.preset),u(r.slots.map(e=>({...e})));else{a(""),h(s??"even-horizontal");const e=n??1;u(Array.from({length:e},()=>({label:"",command:""})))}setTimeout(()=>{var e;return null==(e=d.current)?void 0:e.focus()},50)}},[e,r,s,n]),!e)return null;const f=(e,t,i)=>{u(c.map((r,s)=>s===e?{...r,[t]:i}:r))};return re.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:re.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[440px] shadow-2xl animate-fade-in max-h-[80vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[re.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[re.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:r?"Edit Favourite":"Save Favourite"}),re.jsx("button",{onClick:t,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:re.jsx(Kx,{size:14})})]}),re.jsxs("form",{onSubmit:e=>{e.preventDefault(),o.trim()&&0!==c.length&&(i(o.trim(),l,c),t())},className:"p-4 space-y-4 overflow-y-auto",children:[re.jsxs("div",{children:[re.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Name"}),re.jsx("input",{ref:d,value:o,onChange:e=>a(e.target.value),placeholder:"My Workspace",className:"\n w-full px-3 py-2 text-sm\n bg-[var(--surface-0)] border border-[var(--border)]\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded-lg outline-none\n focus:border-accent focus:ring-1 focus:ring-accent/30\n transition-colors\n "})]}),re.jsxs("div",{children:[re.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Layout"}),re.jsx("div",{className:"flex gap-1",children:nd.map(e=>re.jsxs("button",{type:"button",onClick:()=>h(e),className:`\n flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors\n ${l===e?"bg-accent/15 text-accent border border-accent/30":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] border border-transparent"}\n `,title:rC[e],children:[iC[e],re.jsx("span",{className:"hidden sm:inline",children:rC[e]})]},e))})]}),re.jsxs("div",{children:[re.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[re.jsx("label",{className:"text-xs text-[var(--text-secondary)]",children:"Terminal Slots"}),re.jsxs("button",{type:"button",onClick:()=>{u([...c,{label:"",command:""}])},className:"flex items-center gap-0.5 text-[10px] text-accent hover:text-accent/80 transition-colors",children:[re.jsx(Ox,{size:10}),"Add"]})]}),re.jsx("div",{className:"space-y-2",children:c.map((e,t)=>re.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-[var(--surface-0)] border border-[var(--border)]",children:[re.jsxs("div",{className:"flex-1 space-y-1.5",children:[re.jsx("input",{value:e.label,onChange:e=>f(t,"label",e.target.value),placeholder:`Terminal ${t+1}`,className:"\n w-full px-2 py-1 text-xs\n bg-transparent border border-[var(--border)]\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded outline-none\n focus:border-accent focus:ring-1 focus:ring-accent/30\n transition-colors\n "}),re.jsx("input",{value:e.command,onChange:e=>f(t,"command",e.target.value),placeholder:"Command (optional)",className:"\n w-full px-2 py-1 text-xs font-mono\n bg-transparent border border-[var(--border)]\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded outline-none\n focus:border-accent focus:ring-1 focus:ring-accent/30\n transition-colors\n "})]}),c.length>1&&re.jsx("button",{type:"button",onClick:()=>{return e=t,void(c.length<=1||u(c.filter((t,i)=>i!==e)));var e},className:"p-1 mt-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:re.jsx($x,{size:12})})]},t))})]}),re.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[re.jsx("button",{type:"button",onClick:t,className:"\n px-3 py-1.5 text-xs text-[var(--text-secondary)]\n hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]\n rounded-lg transition-colors\n ",children:"Cancel"}),re.jsx("button",{type:"submit",disabled:!o.trim()||0===c.length,className:"\n px-3 py-1.5 text-xs font-medium\n bg-accent hover:bg-accent/80\n disabled:opacity-40 disabled:cursor-not-allowed\n text-white rounded-lg transition-colors\n ",children:r?"Update":"Save"})]})]})]})})}function nC({open:e,onClose:t,onConfirm:i,terminalCount:r,favouriteName:s}){return e?re.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:re.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[380px] shadow-2xl animate-fade-in",onClick:e=>e.stopPropagation(),children:[re.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[re.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Launch Favourite"}),re.jsx("button",{onClick:t,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:re.jsx(Kx,{size:14})})]}),re.jsxs("div",{className:"p-4 space-y-4",children:[re.jsxs("div",{className:"flex items-start gap-3",children:[re.jsx("div",{className:"p-2 rounded-lg bg-yellow-500/10",children:re.jsx(Ux,{size:16,className:"text-yellow-500"})}),re.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:["Launching ",re.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:s})," will close ",r," existing terminal",1!==r?"s":"",". Continue?"]})]}),re.jsxs("div",{className:"flex justify-end gap-2",children:[re.jsx("button",{onClick:t,className:"\n px-3 py-1.5 text-xs text-[var(--text-secondary)]\n hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]\n rounded-lg transition-colors\n ",children:"Cancel"}),re.jsx("button",{onClick:()=>{i(),t()},className:"\n px-3 py-1.5 text-xs font-medium\n bg-accent hover:bg-accent/80\n text-white rounded-lg transition-colors\n ",children:"Launch"})]})]})]})}):null}function oC(){const[e,t]=Y.useState(!1),[i,r]=Y.useState(!1),[s,n]=Y.useState(!1),[o,a]=Y.useState(null),[l,h]=Y.useState(null),[c,u]=Y.useState(null),[d,f]=Y.useState(!1),[_,p]=Y.useState(null);Y.useEffect(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.latest&&function(e,t){const i=e.split(".").map(Number),r=t.split(".").map(Number);for(let s=0;s<3;s++){if((i[s]||0)>(r[s]||0))return!0;if((i[s]||0)<(r[s]||0))return!1}return!1}(e.latest,e.current)&&p({current:e.current,latest:e.latest})}).catch(()=>{})},[]);const g=Vu(e=>e.projects),v=Vu(e=>e.activeProjectId),m=Vu(e=>e.setActiveProject),y=Vu(e=>e.addProject),b=Vu(e=>e.removeProject),S=Vu(e=>e.addTerminalToProject),w=gd(e=>e.sidebarOpen),x=gd(e=>e.sidebarWidth),C=gd(e=>e.setSidebarWidth),k=gd(e=>e.toggleSidebar),L=gd(e=>e.connectionStatus),E=Y.useRef(!1),M=gd(e=>e.editorSyncEnabled),R=gd(e=>e.toggleEditorSync),T=gd(e=>e.gpuRendering),P=gd(e=>e.toggleGpuRendering),D=gd(e=>e.theme),B=gd(e=>e.cycleTheme),A=$u(e=>e.activePorts),N=$u(e=>e.claudeStatus),I=$u(e=>e.gitBranches),O=$u(e=>e.editorNeedsAccessibility),z=hx(e=>e.favourites);hx(e=>e.addFavourite);const F=hx(e=>e.updateFavourite),j=hx(e=>e.removeFavourite),W=gd(e=>e.pendingFavouriteLaunchId),H=gd(e=>e.clearPendingFavouriteLaunch),[$,U]=Y.useState(null),[K,q]=Y.useState(null),V=Y.useCallback(()=>{fetch("/api/cleanup-projects").then(e=>e.json()).then(e=>{0===e.stale.length?(U([]),setTimeout(()=>U(null),2e3)):U(e.stale)}).catch(()=>{})},[]),G=Y.useCallback(()=>{fetch("/api/cleanup-projects",{method:"POST"}).then(e=>e.json()).then(e=>{for(const t of Object.values(g))e.removed.includes(t.name)&&(cd.getState().removeProjectLayout(t.id),b(t.id));U(null)}).catch(()=>{})},[g,b]),X=e=>{Vx(e)},Q=Y.useCallback(e=>{if(!v)return;if(!g[v])return;Vx(v);const t=e.slots.map(()=>crypto.randomUUID());e.slots.forEach((e,i)=>{var r,s;e.command.trim()&&(r=t[i],s=e.command+"\n",ix.set(r,s))});const i=od(t,e.preset);cd.getState().setLayout(v,i),t.forEach(e=>{S(v,e)}),t.length>0&&gd.getState().setFocusedTerminal(t[0])},[v,g,S]),J=Y.useCallback(e=>{if(!v)return;Xu(cd.getState().getLayout(v)).length>0?(h(e),n(!0)):Q(e)},[v,Q]);Y.useEffect(()=>{if(!W)return;const e=z[W];H(),e&&J(e)},[W,z,H,J]);const Z=Y.useCallback(e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",f(!0))},[]),ee=Y.useCallback(e=>{e.currentTarget.contains(e.relatedTarget)||f(!1)},[]),te=Y.useCallback(e=>{e.preventDefault(),E.current=!0;const t=e=>{requestAnimationFrame(()=>C(e.clientX))},i=()=>{E.current=!1,window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",i),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",t),window.addEventListener("mouseup",i)},[C]),ie=Y.useCallback(e=>{if(f(!1),!e.dataTransfer.types.includes("Files")||0===e.dataTransfer.files.length)return;e.preventDefault(),e.stopPropagation();const i=Yx();if(i&&i.length>0){const r=i[0],s=r.split("/").pop()||e.dataTransfer.files[0].name;return u({name:s,cwd:r}),void t(!0)}const r=e.dataTransfer.files[0];fetch("/api/resolve-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r.name,size:r.size,lastModified:r.lastModified})}).then(e=>e.json()).then(e=>{if(!e.path||!e.isDirectory)return;const i=e.path,s=i.split("/").pop()||r.name;u({name:s,cwd:i}),t(!0)}).catch(()=>{})},[]);if(!w)return null;const se=Object.values(g),ne=Object.values(z),oe=(v?g[v]:null)?Xu(cd.getState().getLayout(v)).length:0;return re.jsxs("div",{className:"relative flex-shrink-0 bg-[var(--surface-1)] border-r border-[var(--border)] flex flex-col h-full "+(d?"ring-2 ring-inset ring-[var(--accent)]":""),style:{width:x},onDragOver:Z,onDragLeave:ee,onDrop:ie,children:[re.jsx("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize z-10 hover:bg-[var(--accent)] active:bg-[var(--accent)] opacity-0 hover:opacity-40 active:opacity-60 transition-opacity",onMouseDown:te}),re.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[re.jsxs("div",{className:"flex items-center gap-2",children:[re.jsx("span",{className:"text-sm font-semibold tracking-tight text-[var(--text-primary)]",children:"Paneful"}),re.jsx("span",{className:"w-1.5 h-1.5 rounded-full "+("connected"===L?"bg-[var(--success)]":"connecting"===L?"bg-yellow-500 animate-pulse":"bg-[var(--danger)]"),title:L})]}),re.jsxs("div",{className:"flex items-center gap-1",children:[re.jsx("button",{onClick:B,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:`Theme: ${D}. Click to cycle.`,children:"light"===D?re.jsx(Wx,{size:14}):"dark"===D?re.jsx(Tx,{size:14}):re.jsx(Rx,{size:14})}),re.jsxs("button",{onClick:()=>{R(),ox({type:"editor:sync",enabled:!M})},className:"relative p-1 rounded transition-colors "+(M?"text-[var(--accent)] hover:bg-[var(--surface-3)]":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]"),title:M&&O?"Editor sync needs Accessibility permission. Go to System Settings → Privacy & Security → Accessibility and add the app you launched paneful from (e.g. Paneful, Terminal, iTerm, VS Code, Cursor). If already listed, try toggling it off and on, or removing and re-adding it.":M?"Editor sync ON — auto-switches project based on your active editor. Click to disable.":"Editor sync OFF — click to enable. Requires Accessibility permission for the app you launched paneful from (e.g. Paneful, Terminal, VS Code, Cursor) in System Settings → Privacy & Security → Accessibility. After updating, you may need to remove and re-add it.",children:[re.jsx(Mx,{size:14}),M&&O&&re.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-yellow-500"})]}),re.jsx("button",{onClick:P,className:"p-1 rounded transition-colors "+(T?"text-[var(--accent)] hover:bg-[var(--surface-3)]":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]"),title:T?"GPU rendering ON — terminals use WebGL. Click to switch to DOM renderer.":"GPU rendering OFF — terminals use DOM renderer. Click to enable WebGL.",children:re.jsx(qx,{size:14})}),re.jsx("button",{onClick:V,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Clean up stale projects",children:re.jsx(_x,{size:14})}),re.jsx("button",{onClick:k,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Hide sidebar",children:re.jsx(Px,{size:14})})]})]}),re.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:0===se.length&&0===ne.length?re.jsx("div",{className:"px-4 py-8 text-center",children:re.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"No projects yet"})}):re.jsxs(re.Fragment,{children:[se.map(e=>{var t;return re.jsx(Qx,{project:e,isActive:e.id===v,hasActivePorts:((null==(t=A[e.id])?void 0:t.length)??0)>0,claudeStatus:N[e.id]??null,gitStatus:I[e.id]??null,onClick:()=>m(e.id),onKill:()=>X(e.id),onRemove:()=>{return t=e.id,void q(t);var t}},e.id)}),re.jsx(tC,{favourites:ne,onLaunch:J,onEdit:e=>{a(e),r(!0)},onDelete:j})]})}),re.jsxs("div",{className:"mx-3 mb-2 px-3 py-2.5 rounded-lg bg-[var(--surface-2)] text-[10px] text-[var(--text-muted)] leading-relaxed flex flex-col items-center gap-1.5 text-center",children:[re.jsx(Ex,{size:12,className:"text-yellow-500"}),"Drag a folder into this sidebar to create a project"]}),re.jsx("div",{className:"p-2 border-t border-[var(--border)]",children:re.jsxs("button",{onClick:()=>t(!0),className:"\n w-full flex items-center justify-center gap-1.5\n px-3 py-2 text-xs\n text-[var(--text-secondary)] hover:text-[var(--text-primary)]\n bg-[var(--surface-2)] hover:bg-[var(--surface-3)]\n rounded-lg transition-colors\n ",children:[re.jsx(Ox,{size:14}),"New Project"]})}),_&&re.jsxs("div",{className:"px-4 py-3 border-t border-[var(--border)]",children:[re.jsxs("a",{href:"https://www.npmjs.com/package/paneful",onClick:e=>{e.preventDefault(),ox({type:"open:url",url:"https://www.npmjs.com/package/paneful"})},className:"flex items-center gap-2 text-xs text-[var(--accent)] hover:underline cursor-pointer",children:[re.jsx(mx,{size:14}),re.jsxs("span",{children:["v",_.latest," available (current: v",_.current,")"]})]}),re.jsxs("p",{className:"text-[10px] text-[var(--text-muted)] mt-1",children:["paneful update · ",re.jsx("a",{href:"https://github.com/kplates/paneful/blob/master/CHANGELOG.md",onClick:e=>{e.preventDefault(),ox({type:"open:url",url:"https://github.com/kplates/paneful/blob/master/CHANGELOG.md"})},className:"underline cursor-pointer hover:text-[var(--text-secondary)]",children:"changelog"})]})]}),re.jsx(Jx,{open:e,onClose:()=>{t(!1),u(null)},onCreate:(e,t)=>{const i=Object.values(g).find(e=>e.cwd===t);if(i)return void m(i.id);const r=crypto.randomUUID();y({id:r,name:e,cwd:t,terminalIds:[]}),ox({type:"project:create",projectId:r,name:e,cwd:t}),m(r)},initialName:null==c?void 0:c.name,initialCwd:null==c?void 0:c.cwd}),re.jsx(sC,{open:i,onClose:()=>{r(!1),a(null)},onSave:(e,t,i)=>{o&&F(o.id,{name:e,preset:t,slots:i}),a(null)},editingFavourite:o}),re.jsx(nC,{open:s,onClose:()=>{n(!1),h(null)},onConfirm:()=>{l&&Q(l)},terminalCount:oe,favouriteName:(null==l?void 0:l.name)??""}),null!==$&&re.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>U(null),children:re.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:e=>e.stopPropagation(),children:[re.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Clean Up Projects"}),0===$.length?re.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"All projects have valid directories."}):re.jsxs(re.Fragment,{children:[re.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-3",children:[$.length," project",$.length>1?"s":""," with missing directories:"]}),re.jsx("div",{className:"space-y-1.5 mb-4 max-h-40 overflow-y-auto",children:$.map(e=>re.jsxs("div",{className:"text-xs px-2 py-1.5 rounded bg-[var(--surface-2)]",children:[re.jsx("div",{className:"font-medium text-[var(--text-primary)]",children:e.name}),re.jsx("div",{className:"text-[10px] text-[var(--text-muted)] font-mono truncate",children:e.cwd})]},e.id))}),re.jsxs("div",{className:"flex gap-2 justify-end",children:[re.jsx("button",{onClick:()=>U(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),re.jsxs("button",{onClick:G,className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:["Remove ",$.length," project",$.length>1?"s":""]})]})]})]})}),K&&g[K]&&re.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>q(null),children:re.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:e=>e.stopPropagation(),children:[re.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Remove Project"}),re.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-4",children:["Remove ",re.jsx("strong",{children:g[K].name}),"? This will kill all its terminals."]}),re.jsxs("div",{className:"flex gap-2 justify-end",children:[re.jsx("button",{onClick:()=>q(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),re.jsx("button",{onClick:()=>{K&&(X(K),ox({type:"project:remove",projectId:K}),cd.getState().removeProjectLayout(K),b(K),q(null))},className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:"Remove"})]})]})})]})}const aC=[{keys:["⌘","P"],action:"Command palette"},{keys:["⌘","F"],action:"Search terminal"},{keys:["⌘","N"],action:"New pane (vertical)"},{keys:["⌘","⇧","N"],action:"New pane (horizontal)"},{keys:["⌘","W"],action:"Close pane"},{keys:["⌘","D"],action:"Toggle sidebar"},{keys:["⌘","T"],action:"Cycle layout"},{keys:["⌘","R"],action:"Auto reorganize"},{keys:["⌘","1-9"],action:"Focus pane by number"},{keys:["⌘","←→↑↓"],action:"Move focus"},{keys:["⌘","⇧","←→↑↓"],action:"Swap panes"},{keys:["⌥","←→↑↓"],action:"Swap panes"},{keys:["Shift","Enter"],action:"Insert new line"}];function lC({open:e,onClose:t}){return e?re.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:re.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[440px] shadow-2xl animate-fade-in",onClick:e=>e.stopPropagation(),children:[re.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[re.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Keyboard Shortcuts"}),re.jsx("button",{onClick:t,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:re.jsx(Kx,{size:14})})]}),re.jsx("div",{className:"p-4 space-y-2",children:aC.map((e,t)=>re.jsxs("div",{className:"flex items-center justify-between py-1",children:[re.jsx("div",{className:"flex items-center gap-1",children:e.keys.map((e,t)=>re.jsx("kbd",{className:"border border-[var(--border)] rounded-md px-1.5 py-0.5 bg-[var(--surface-0)] text-[11px] font-mono min-w-[24px] text-center inline-flex items-center justify-center shadow-[0_1px_0_var(--border)]",children:e},t))}),re.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:e.action})]},t))})]})}):null}const hC={"even-horizontal":re.jsx(zx,{size:14}),"even-vertical":re.jsx(bx,{size:14}),"main-left":re.jsx(Bx,{size:14}),"main-top":re.jsx(Ax,{size:14}),grid:re.jsx(xx,{size:14})},cC={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function uC({onNewPane:e}){const[t,i]=Y.useState(!1),[r,s]=Y.useState(!1),n=gd(e=>e.sidebarOpen),o=gd(e=>e.toggleSidebar),a=Vu(e=>e.activeProjectId),l=cd(e=>e.currentPresetIndex),h=cd(e=>e.cyclePreset),c=hx(e=>e.addFavourite),u=nd[l],d=a?Xu(cd.getState().getLayout(a)).length:0;return re.jsxs("div",{className:"h-9 flex-shrink-0 flex items-center px-2 gap-1 bg-[var(--surface-1)] border-b border-[var(--border)]",children:[!n&&re.jsx("button",{onClick:o,className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Show sidebar (Cmd+D)",children:re.jsx(Dx,{size:14})}),re.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),re.jsx("button",{onClick:()=>e("vertical"),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Split vertical (Cmd+N)",children:re.jsx(bx,{size:14})}),re.jsx("button",{onClick:()=>e("horizontal"),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Split horizontal (Cmd+Shift+N)",children:re.jsx(zx,{size:14})}),re.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),re.jsxs("button",{onClick:()=>{if(!a)return;const e=Xu(cd.getState().getLayout(a));e.length>0&&h(a,e)},className:"flex items-center gap-1.5 px-2 py-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors text-xs",title:"Cycle layout (Cmd+T)",children:[hC[u],re.jsx("span",{className:"hidden sm:inline",children:cC[u]})]}),re.jsx("button",{onClick:()=>{if(!a)return;const e=Xu(cd.getState().getLayout(a));if(0===e.length)return;let t;t=e.length<=2?"even-vertical":3===e.length?"main-left":"grid";const i=od(e,t);i&&cd.getState().setLayout(a,i)},className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Auto reorganize (Cmd+R)",children:re.jsx(Lx,{size:14})}),re.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),re.jsx("button",{onClick:()=>i(!0),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-yellow-400 hover:bg-[var(--surface-3)] transition-colors",title:"Save as favourite",children:re.jsx(jx,{size:14})}),re.jsx("div",{className:"flex-1"}),re.jsx("button",{onClick:()=>s(!0),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Keyboard shortcuts",children:re.jsx(kx,{size:14})}),re.jsx(sC,{open:t,onClose:()=>i(!1),onSave:(e,t,i)=>{c({id:crypto.randomUUID(),name:e,preset:t,slots:i})},defaultPreset:u,defaultSlotCount:Math.max(d,1)}),re.jsx(lC,{open:r,onClose:()=>s(!1)})]})}function dC({terminalId:e,projectId:t,isFocused:i,onClose:r,dragProps:s}){const n=$u(t=>t.sessions[e]),o=(null==n?void 0:n.title)??"Terminal",a=(null==n?void 0:n.alive)??!0,l=Xu(cd(e=>e.getLayout(t))).indexOf(e)+1;return re.jsxs("div",{draggable:!0,onDragStart:s.onDragStart,onDragEnd:s.onDragEnd,className:`\n flex items-center h-7 px-2 gap-1.5 flex-shrink-0\n border-b transition-colors duration-100\n select-none cursor-grab active:cursor-grabbing\n ${i?"bg-[var(--surface-3)] border-[var(--accent)]":"bg-[var(--surface-2)] border-[var(--border)]"}\n `,children:[re.jsx("div",{className:"text-[var(--text-muted)]",children:re.jsx(Cx,{size:12})}),re.jsx("span",{className:"text-[10px] font-medium text-[var(--text-muted)] tabular-nums",children:l}),re.jsx("span",{className:"text-xs text-[var(--text-secondary)] truncate flex-1",children:o}),!a&&re.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--danger)]"}),re.jsx("button",{onClick:e=>{e.stopPropagation(),r()},onMouseDown:e=>e.stopPropagation(),draggable:!1,className:"\n p-0.5 rounded text-[var(--text-muted)]\n hover:text-[var(--danger)] hover:bg-[var(--danger-dim)]\n transition-colors\n ",children:re.jsx(Kx,{size:12})})]})}const fC={matchBackground:void 0,matchBorder:"#facc15aa",matchOverviewRuler:"#facc15",activeMatchBackground:"#694d00",activeMatchBorder:"#fde047",activeMatchColorOverviewRuler:"#facc15"};function _C({terminalId:e,onClose:t}){const i=Y.useRef(null),[r,s]=Y.useState("");Y.useEffect(()=>{var e;null==(e=i.current)||e.focus()},[]);const n=Y.useCallback(()=>{const t=tx(e);t&&r&&t.findNext(r,{regex:!1,caseSensitive:!1,incremental:!1,decorations:fC})},[e,r]),o=Y.useCallback(()=>{const t=tx(e);t&&r&&t.findPrevious(r,{regex:!1,caseSensitive:!1,incremental:!1,decorations:fC})},[e,r]),a=Y.useCallback(()=>{const i=tx(e);null==i||i.clearDecorations(),t()},[e,t]);return re.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-[var(--surface-2)] border-b border-[var(--border)]",onClick:e=>e.stopPropagation(),children:[re.jsx("input",{ref:i,type:"text",value:r,onChange:t=>{const i=t.target.value;s(i);const r=tx(e);r&&(i?r.findNext(i,{regex:!1,caseSensitive:!1,incremental:!0,decorations:fC}):r.clearDecorations())},onKeyDown:e=>{if("Escape"===e.key)return e.stopPropagation(),void a();"Enter"===e.key&&(e.preventDefault(),e.shiftKey?o():n())},placeholder:"Search...",className:"flex-1 min-w-0 bg-[var(--surface-0)] text-[var(--text-primary)] text-sm px-3 py-1.5 rounded-md border border-[var(--border)] outline-none focus:border-[var(--accent)] placeholder:text-[var(--text-muted)]"}),re.jsx("button",{onClick:o,className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Previous match (Shift+Enter)",children:re.jsx(vx,{size:16})}),re.jsx("button",{onClick:n,className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Next match (Enter)",children:re.jsx(px,{size:16})}),re.jsx("button",{onClick:a,className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Close (Escape)",children:re.jsx(Kx,{size:16})})]})}function pC({terminalId:e}){const t=gd(e=>e.dropTarget);if(!t||t.terminalId!==e)return null;const i=t.edge,r="center"===i;return re.jsx("div",{className:`\n absolute ${{left:"left-0 top-0 bottom-0 w-1/2",right:"right-0 top-0 bottom-0 w-1/2",top:"left-0 right-0 top-0 h-1/2",bottom:"left-0 right-0 bottom-0 h-1/2",center:"inset-0"}[i]??"inset-0"}\n pointer-events-none z-20\n ${r?"bg-accent/15 border-2 border-accent/40":"bg-accent/20 border-2 border-accent/50"}\n rounded-sm transition-all duration-100\n `})}function gC({terminalId:e,projectId:t,cwd:i}){const r=gd(t=>t.focusedTerminalId===e),s=gd(t=>t.draggingTerminalId===e),n=gd(t=>t.searchTerminalId===e),{containerRef:o,fit:a,focus:l}=rx({terminalId:e,projectId:t,cwd:i}),h=function(e,t){const i=gd(e=>e.setDragging),r=gd(e=>e.setDropTarget),s=gd(e=>e.draggingTerminalId),n=cd(e=>e.movePaneInProject),o=cd(e=>e.swapPanesInProject),a=Y.useCallback(t=>{t.dataTransfer.setData("text/plain",e),t.dataTransfer.effectAllowed="move",i(e)},[e,i]),l=Y.useCallback(()=>{i(null),r(null)},[i,r]),h=Y.useCallback(t=>{if(t.preventDefault(),t.dataTransfer.dropEffect="move",!s||s===e)return void r(null);const i=t.currentTarget.getBoundingClientRect(),n=(t.clientX-i.left)/i.width,o=(t.clientY-i.top)/i.height;let a="center";const l=.2;n<l?a="left":n>.8?a="right":o<l?a="top":o>.8&&(a="bottom"),r({terminalId:e,edge:a})},[e,s,r]),c=Y.useCallback(()=>{r(null)},[r]),u=Y.useCallback(s=>{s.preventDefault();const a=s.dataTransfer.getData("text/plain");if(!a||a===e)return;const l=gd.getState().dropTarget;l&&("center"===l.edge?o(t,a,e):n(t,a,e,l.edge),i(null),r(null))},[e,t,n,o,i,r]);return{onDragStart:a,onDragEnd:l,onDragOver:h,onDragLeave:c,onDrop:u}}(e,t);!function(e,t){const i=Y.useRef();Y.useEffect(()=>{const r=e.current;if(!r)return;const s=new ResizeObserver(()=>{clearTimeout(i.current),i.current=setTimeout(t,50)});return s.observe(r),()=>{s.disconnect(),clearTimeout(i.current)}},[e,t])}(o,a);const c=Y.useCallback(()=>{var i;ox({type:"pty:kill",terminalId:e}),cd.getState().removePaneFromProject(t,e),Vu.getState().removeTerminalFromProject(t,e);const r=$u.getState().sessions[e];null==(i=null==r?void 0:r.terminal)||i.dispose(),$u.getState().removeSession(e),sx(e);const s=Xu(cd.getState().getLayout(t));gd.getState().setFocusedTerminal(s[0]??null)},[e,t]),u=Y.useCallback(t=>{if(!(null!=gd.getState().draggingTerminalId)){const i=Yx();if(i)return t.preventDefault(),t.stopPropagation(),ox({type:"pty:input",terminalId:e,data:i.map(Gx).join(" ")}),void l();const r=function(e){const t=e.getData("codefiles");if(t)try{const e=JSON.parse(t);if(Array.isArray(e)&&e.length>0)return e}catch{}const i=e.getData("text/uri-list").trim();if(i){const e=Xx(i);if(e.length>0)return e}const r=e.getData("text/plain").trim();if(r){const e=Xx(r);if(e.length>0)return e;if(r.startsWith("/")){const e=r.split("\n").map(e=>e.trim()).filter(Boolean);if(e.length>0)return e}}return[]}(t.dataTransfer);if(r.length>0)return t.preventDefault(),t.stopPropagation(),ox({type:"pty:input",terminalId:e,data:r.map(Gx).join(" ")}),void l()}if(t.dataTransfer.types.includes("Files")&&t.dataTransfer.files.length>0){t.preventDefault(),t.stopPropagation();const r=Array.from(t.dataTransfer.files);return void Promise.all(r.map(e=>fetch("/api/resolve-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,size:e.size,lastModified:e.lastModified,cwd:i})}).then(e=>e.json()).then(e=>e.path).catch(()=>null))).then(t=>{const i=t.filter(Boolean);i.length>0&&(ox({type:"pty:input",terminalId:e,data:i.map(Gx).join(" ")}),l())})}h.onDrop(t)},[e,h,l]),d=Y.useCallback(e=>{if(null==gd.getState().draggingTerminalId)return e.dataTransfer.types.includes("Files")||e.dataTransfer.types.includes("codefiles")||e.dataTransfer.types.includes("text/uri-list")||e.dataTransfer.types.includes("text/plain")?(e.preventDefault(),void(e.dataTransfer.dropEffect="copy")):void h.onDragOver(e);h.onDragOver(e)},[h]);return re.jsxs("div",{"data-terminal-id":e,style:{borderColor:r?"var(--accent)":"transparent"},className:`\n flex flex-col h-full w-full relative border\n ${s?"opacity-40":""}\n transition-colors duration-100\n `,onMouseDown:l,onDragOver:d,onDragLeave:h.onDragLeave,onDrop:u,children:[re.jsx(dC,{terminalId:e,projectId:t,isFocused:r,onClose:c,dragProps:{onDragStart:h.onDragStart,onDragEnd:h.onDragEnd}}),n&&re.jsx(_C,{terminalId:e,onClose:()=>{gd.getState().closeSearch(),l()}}),re.jsx("div",{ref:o,className:"flex-1 min-h-0 min-w-0 overflow-hidden"}),re.jsx(pC,{terminalId:e})]})}function vC({projectId:e,path:t,direction:i}){const{onMouseDown:r,containerRef:s}=function({projectId:e,path:t,direction:i}){const r=cd(e=>e.resizePaneInProject),s=Y.useRef(null),n=Y.useCallback(n=>{var o;n.preventDefault(),n.stopPropagation();const a=null==(o=s.current)?void 0:o.parentElement;if(!a)return;const l=a.getBoundingClientRect();"vertical"===i?n.clientX:n.clientY;const h="vertical"===i?l.width:l.height,c=s=>{const n="vertical"===i?s.clientX:s.clientY,o="vertical"===i?l.left:l.top;r(e,t,(n-o)/h)},u=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",c),document.addEventListener("mouseup",u),document.body.style.cursor="vertical"===i?"col-resize":"row-resize",document.body.style.userSelect="none"},[e,t,i,r]);return{onMouseDown:n,containerRef:s}}({projectId:e,path:t,direction:i}),n="vertical"===i;return re.jsxs("div",{ref:s,className:`\n relative z-10 flex-shrink-0\n ${n?"w-[4px] cursor-col-resize":"h-[4px] cursor-row-resize"}\n group\n `,onMouseDown:r,children:[re.jsx("div",{className:`\n absolute\n ${n?"inset-y-0 -left-[2px] w-[8px]":"inset-x-0 -top-[2px] h-[8px]"}\n transition-colors duration-150\n hover:bg-accent/40\n group-active:bg-accent/60\n `}),re.jsx("div",{className:`\n ${n?"w-full h-full":"h-full w-full"}\n bg-[var(--border)]\n transition-colors duration-150\n group-hover:bg-accent/60\n group-active:bg-accent\n `})]})}function mC({node:e,projectId:t,cwd:i,path:r=[]}){if("leaf"===e.type)return re.jsx(gC,{terminalId:e.terminalId,projectId:t,cwd:i});const s="vertical"===e.direction,n=100*e.ratio+"%",o=100*(1-e.ratio)+"%";return re.jsxs("div",{className:`flex ${s?"flex-row":"flex-col"} h-full w-full`,children:[re.jsx("div",{style:{flexBasis:n,minWidth:0,minHeight:0,overflow:"hidden"},className:"flex",children:re.jsx(mC,{node:e.first,projectId:t,cwd:i,path:[...r,0]})}),re.jsx(vC,{projectId:t,path:r,direction:e.direction}),re.jsx("div",{style:{flexBasis:o,minWidth:0,minHeight:0,overflow:"hidden"},className:"flex",children:re.jsx(mC,{node:e.second,projectId:t,cwd:i,path:[...r,1]})})]})}function yC({onNewTerminal:e,projectName:t}){const i=function(){const[e,t]=Y.useState(null);return Y.useEffect(()=>{let e=!1;return Math.random()<.5?fetch("https://dummyjson.com/quotes/random").then(e=>e.json()).then(i=>{!e&&(null==i?void 0:i.quote)&&t({text:i.quote,attribution:i.author})}).catch(()=>{}):fetch("https://uselessfacts.jsph.pl/api/v2/facts/random?language=en").then(e=>e.json()).then(i=>{!e&&(null==i?void 0:i.text)&&t({text:i.text})}).catch(()=>{}),()=>{e=!0}},[]),e}(),r=hx(e=>e.favourites),s=Object.values(r);return re.jsx("div",{className:"h-full w-full flex items-center justify-center bg-[var(--surface-0)]",children:re.jsxs("div",{className:"flex flex-col items-center gap-8 text-center max-w-md px-8",children:[re.jsxs("div",{className:"flex flex-col items-center gap-4",children:[re.jsx("div",{className:"w-16 h-16 rounded-2xl bg-[var(--surface-2)] border border-[var(--border)] flex items-center justify-center",children:re.jsx(Hx,{size:28,className:"text-[var(--text-muted)]"})}),re.jsxs("div",{children:[re.jsx("h2",{className:"text-lg font-medium text-[var(--text-primary)] mb-1",children:t??"No project selected"}),re.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:t?"This project has no active terminals.":"Create a project to get started."})]}),t&&re.jsxs("button",{onClick:e,className:"\n flex items-center gap-2 px-5 py-2.5\n bg-accent hover:bg-accent/80\n text-white text-sm font-medium\n rounded-lg transition-colors\n ",children:[re.jsx(Ox,{size:16}),"New Terminal"]})]}),t&&s.length>0&&re.jsxs("div",{className:"w-full rounded-xl bg-[var(--surface-1)] border border-[var(--border)] p-4",children:[re.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-[var(--text-muted)] mb-3 text-left flex items-center gap-1.5",children:[re.jsx(jx,{size:11}),"Favourites"]}),re.jsx("div",{className:"space-y-1.5",children:s.map(e=>re.jsxs("button",{onClick:()=>gd.getState().requestFavouriteLaunch(e.id),className:"\n group w-full flex items-center gap-2.5 px-3 py-2.5\n bg-[var(--surface-2)] hover:bg-[var(--surface-3)]\n text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]\n rounded-lg transition-colors text-left\n ",children:[re.jsx(Ix,{size:12,className:"text-[var(--text-muted)] group-hover:text-[var(--accent)] shrink-0 transition-colors"}),re.jsx("span",{className:"truncate font-medium",children:e.name}),re.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)] tabular-nums shrink-0",children:[e.slots.length," pane",1!==e.slots.length?"s":""]})]},e.id))})]}),i&&re.jsxs("div",{className:"max-w-sm",children:[re.jsxs("p",{className:"text-sm italic text-[var(--text-muted)] leading-relaxed",children:['"',i.text,'"']}),i.attribution&&re.jsxs("p",{className:"text-xs text-[var(--text-muted)]/60 mt-2",children:["— ",i.attribution]})]})]})})}function bC(){const e=gd(e=>e.syncToast),t=gd(e=>e.dismissSyncToast),[i,r]=Y.useState(!1);return Y.useEffect(()=>{if(!e)return void r(!1);requestAnimationFrame(()=>r(!0));const i=setTimeout(()=>{r(!1),setTimeout(t,200)},3e3);return()=>clearTimeout(i)},[null==e?void 0:e.id]),e?re.jsxs("div",{onClick:()=>{r(!1),setTimeout(t,200)},style:{position:"absolute",top:16,left:"50%",zIndex:9999,display:"flex",alignItems:"center",gap:8,padding:"8px 14px",borderRadius:8,background:"#facc15",color:"#1a1a1a",border:"1px solid #eab308",fontSize:13,cursor:"pointer",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",opacity:i?1:0,transform:i?"translate(-50%, 0)":"translate(-50%, -8px)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:i?"auto":"none"},children:[re.jsx(Mx,{size:15,style:{color:"#a16207",flexShrink:0}}),re.jsxs("span",{children:["Synced to ",re.jsx("strong",{children:e.projectName})]})]}):null}function SC(){const e=gd(e=>e.commandPaletteOpen),t=gd(e=>e.closeCommandPalette);return e?re.jsx(wC,{onClose:t}):null}function wC({onClose:e}){const[t,i]=Y.useState(""),[r,s]=Y.useState(0),n=Y.useRef(null),o=Y.useRef(null);Y.useEffect(()=>{var e;null==(e=n.current)||e.focus()},[]);const a=Y.useMemo(()=>function(){const e=[],t=Vu.getState().projects,i=hx.getState().favourites,r=Vu.getState().activeProjectId;for(const n of Object.values(t))e.push({id:`project:${n.id}`,label:`Switch to ${n.name}`,category:"Project",icon:re.jsx(Sx,{size:14}),action:()=>{Vu.getState().setActiveProject(n.id)}});for(const n of Object.values(i))e.push({id:`fav:${n.id}`,label:`Launch ${n.name}`,category:"Favourite",icon:re.jsx(jx,{size:14}),action:()=>{gd.getState().requestFavouriteLaunch(n.id)}});const s={"even-horizontal":{label:"Layout: Rows",icon:re.jsx(zx,{size:14})},"even-vertical":{label:"Layout: Columns",icon:re.jsx(bx,{size:14})},"main-left":{label:"Layout: Main + Stack",icon:re.jsx(Bx,{size:14})},"main-top":{label:"Layout: Main + Row",icon:re.jsx(Ax,{size:14})},grid:{label:"Layout: Grid",icon:re.jsx(xx,{size:14})}};for(const n of nd){const t=s[n];e.push({id:`layout:${n}`,label:t.label,category:"Layout",icon:t.icon,action:()=>{if(!r)return;const e=Xu(cd.getState().getLayout(r));if(0===e.length)return;const t=od(e,n);t&&cd.getState().setLayout(r,t)}})}return e.push({id:"action:new-pane-v",label:"New pane (vertical)",category:"Action",icon:re.jsx(Ox,{size:14}),shortcut:"⌘N",action:()=>{if(!r)return;const e=Xu(cd.getState().getLayout(r)),t=gd.getState().focusedTerminalId,i=crypto.randomUUID(),s=t??e[e.length-1];s?cd.getState().addPaneToProject(r,s,i,"vertical"):cd.getState().setLayout(r,{type:"leaf",terminalId:i}),Vu.getState().addTerminalToProject(r,i),gd.getState().setFocusedTerminal(i)}}),e.push({id:"action:new-pane-h",label:"New pane (horizontal)",category:"Action",icon:re.jsx(Ox,{size:14}),shortcut:"⌘⇧N",action:()=>{if(!r)return;const e=Xu(cd.getState().getLayout(r)),t=gd.getState().focusedTerminalId,i=crypto.randomUUID(),s=t??e[e.length-1];s?cd.getState().addPaneToProject(r,s,i,"horizontal"):cd.getState().setLayout(r,{type:"leaf",terminalId:i}),Vu.getState().addTerminalToProject(r,i),gd.getState().setFocusedTerminal(i)}}),e.push({id:"action:close-pane",label:"Close pane",category:"Action",icon:re.jsx(Kx,{size:14}),shortcut:"⌘W",action:()=>{var e;if(!r)return;const t=gd.getState().focusedTerminalId;if(!t)return;ox({type:"pty:kill",terminalId:t}),cd.getState().removePaneFromProject(r,t),Vu.getState().removeTerminalFromProject(r,t);const i=$u.getState().sessions[t];null==(e=null==i?void 0:i.terminal)||e.dispose(),$u.getState().removeSession(t),sx(t);const s=Xu(cd.getState().getLayout(r));gd.getState().setFocusedTerminal(s[0]??null)}}),e.push({id:"action:toggle-sidebar",label:"Toggle sidebar",category:"Action",icon:re.jsx(Px,{size:14}),shortcut:"⌘D",action:()=>{gd.getState().toggleSidebar()}}),e.push({id:"action:cycle-theme",label:"Cycle theme",category:"Action",icon:re.jsx(Mx,{size:14}),action:()=>{gd.getState().cycleTheme()}}),e.push({id:"action:toggle-editor-sync",label:"Toggle editor sync",category:"Action",icon:re.jsx(Mx,{size:14}),action:()=>{gd.getState().toggleEditorSync()}}),e.push({id:"action:toggle-gpu-rendering",label:"Toggle GPU rendering",category:"Action",icon:re.jsx(qx,{size:14}),action:()=>{gd.getState().toggleGpuRendering()}}),e.push({id:"action:auto-reorganize",label:"Auto reorganize",category:"Action",icon:re.jsx(Lx,{size:14}),shortcut:"⌘R",action:()=>{if(!r)return;const e=Xu(cd.getState().getLayout(r));if(0===e.length)return;let t;t=e.length<=2?"even-vertical":3===e.length?"main-left":"grid";const i=od(e,t);i&&cd.getState().setLayout(r,i)}}),e}(),[e]),l=Y.useMemo(()=>{if(!t.trim())return a;const e=t.toLowerCase();return a.filter(t=>t.label.toLowerCase().includes(e))},[a,t]);Y.useEffect(()=>{s(0)},[t]);const h=Y.useCallback(t=>{t.action(),e()},[e]);return Y.useEffect(()=>{const e=o.current;if(!e)return;const t=e.children[r];null==t||t.scrollIntoView({block:"nearest"})},[r]),re.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",onClick:e,children:re.jsxs("div",{className:"max-w-lg mx-auto mt-[20vh] bg-[var(--surface-1)] border border-[var(--border)] rounded-xl shadow-2xl overflow-hidden",onClick:e=>e.stopPropagation(),children:[re.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[var(--border)]",children:[re.jsx(Fx,{size:16,className:"text-[var(--text-muted)] shrink-0"}),re.jsx("input",{ref:n,type:"text",value:t,onChange:e=>i(e.target.value),onKeyDown:t=>"Escape"===t.key?(t.preventDefault(),t.stopPropagation(),void e()):"ArrowDown"===t.key?(t.preventDefault(),void s(e=>Math.min(e+1,l.length-1))):"ArrowUp"===t.key?(t.preventDefault(),void s(e=>Math.max(e-1,0))):"Enter"===t.key?(t.preventDefault(),void(l[r]&&h(l[r]))):void 0,placeholder:"Search commands...",className:"flex-1 bg-transparent text-sm text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"}),re.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)] font-mono",children:"ESC"})]}),re.jsx("div",{ref:o,className:"max-h-72 overflow-y-auto py-1",children:0===l.length?re.jsx("div",{className:"px-4 py-6 text-center text-xs text-[var(--text-muted)]",children:"No matching commands"}):l.map((e,t)=>re.jsxs("button",{onClick:()=>h(e),onMouseEnter:()=>s(t),className:`\n w-full flex items-center gap-3 px-4 py-2 text-left transition-colors\n ${t===r?"bg-[var(--surface-2)] text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--surface-2)]"}\n `,children:[re.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:e.icon}),re.jsx("span",{className:"flex-1 text-xs truncate",children:e.label}),re.jsx("span",{className:"shrink-0 text-[9px] px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[var(--text-muted)]",children:e.category}),e.shortcut&&re.jsx("kbd",{className:"shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[var(--text-muted)] font-mono",children:e.shortcut})]},e.id))})]})})}function xC(){ax(),function(){const e=gd(e=>e.toggleSidebar),t=gd(e=>e.setFocusedTerminal);Y.useEffect(()=>{const i=i=>{var r,s,n,o;const a=i.key.toLowerCase();if(i.ctrlKey&&i.shiftKey&&!i.metaKey&&!i.altKey&&["arrowleft","arrowright","arrowup","arrowdown"].includes(a)){i.preventDefault(),i.stopPropagation();const e=Vu.getState().activeProjectId;if(!e)return;const s=cd.getState().getLayout(e),n=gd.getState().focusedTerminalId;if(!n||!s)return;const o=hd(s,n,"arrowleft"===a?"left":"arrowright"===a?"right":"arrowup"===a?"up":"down");if(o){t(o);const e=$u.getState().sessions[o];null==(r=null==e?void 0:e.terminal)||r.focus()}return}if(i.shiftKey&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&["arrowleft","arrowright","arrowup","arrowdown"].includes(a)){const e=gd.getState().focusedTerminalId,r=e?$u.getState().sessions[e]:null;if("alternate"===(null==(s=null==r?void 0:r.terminal)?void 0:s.buffer.active.type))return;i.preventDefault(),i.stopPropagation();const n=Vu.getState().activeProjectId;if(!n)return;const o=cd.getState().getLayout(n);if(!e||!o)return;const l=hd(o,e,"arrowleft"===a?"left":"arrowright"===a?"right":"arrowup"===a?"up":"down");return void(l&&(cd.getState().swapPanesInProject(n,e,l),requestAnimationFrame(()=>{var i;t(e);const r=$u.getState().sessions[e];null==(i=null==r?void 0:r.terminal)||i.focus()})))}if(!(navigator.platform.startsWith("Mac")?i.metaKey:i.ctrlKey))return;if(("="===a||"+"===a||"-"===a||"0"===a)&&!i.shiftKey&&!("chrome"in window)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent)){i.preventDefault(),i.stopPropagation();const e=parseFloat(document.documentElement.style.zoom||"1");return document.documentElement.style.zoom="="===a||"+"===a?String(Math.min(e+.1,2)):"-"===a?String(Math.max(e-.1,.5)):"1",void window.dispatchEvent(new Event("resize"))}(lx.has(a)||a>="1"&&a<="9")&&(i.preventDefault(),i.stopPropagation());const l=Vu.getState().activeProjectId;if(!l)return;const h=cd.getState().getLayout(l),c=gd.getState().focusedTerminalId,u=Vu.getState().projects[l];if("p"===a&&!i.shiftKey)return void gd.getState().toggleCommandPalette();if("f"===a&&!i.shiftKey)return void(c&&gd.getState().openSearch(c));if("d"===a&&!i.shiftKey)return void e();if("n"===a){if(!u)return;const e=crypto.randomUUID(),r=Xu(h);if(r.length>0){const t=c??r[r.length-1],s=i.shiftKey?"horizontal":"vertical";cd.getState().addPaneToProject(l,t,e,s)}else cd.getState().setLayout(l,{type:"leaf",terminalId:e});return Vu.getState().addTerminalToProject(l,e),void t(e)}if("w"===a&&!i.shiftKey){if(!c||!h)return;ox({type:"pty:kill",terminalId:c}),cd.getState().removePaneFromProject(l,c),Vu.getState().removeTerminalFromProject(l,c);const e=$u.getState().sessions[c];null==(n=null==e?void 0:e.terminal)||n.dispose(),$u.getState().removeSession(c),sx(c);const i=Xu(cd.getState().getLayout(l));return void t(i[0]??null)}if("t"===a&&!i.shiftKey){if(!u)return;const e=Xu(h);return void(e.length>0&&cd.getState().cyclePreset(l,e))}if("r"===a&&!i.shiftKey){const e=Xu(h);if(0===e.length)return;let t;t=e.length<=2?"even-vertical":3===e.length?"main-left":"grid";const i=od(e,t);return void(i&&cd.getState().setLayout(l,i))}const d=parseInt(a);if(d>=1&&d<=9){const e=Xu(h)[d-1];if(e){t(e);const i=$u.getState().sessions[e];null==(o=null==i?void 0:i.terminal)||o.focus()}return}};return window.addEventListener("keydown",i,{capture:!0}),()=>window.removeEventListener("keydown",i,{capture:!0})},[e,t])}(),Y.useEffect(()=>{Vu.getState().hydrateFromServer(),hx.getState().hydrateFromServer(),gd.getState().hydrateFromServer()},[]);const e=Vu(e=>e.activeProjectId),t=Vu(e=>e.activeProjectId?e.projects[e.activeProjectId]:null),i=cd(t=>e?t.getLayout(e):null),r=gd(e=>e.focusedTerminalId),s=gd(e=>e.setFocusedTerminal),n=Vu(e=>e.addTerminalToProject),o=Y.useCallback(o=>{if(!e||!t)return;const a=crypto.randomUUID(),l=Xu(i),h=r??l[0];h?cd.getState().addPaneToProject(e,h,a,o):cd.getState().setLayout(e,{type:"leaf",terminalId:a}),n(e,a),s(a)},[e,t,i,r,n,s]),a=Y.useCallback(()=>{o("vertical")},[o]);return re.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-[var(--surface-0)]",children:[re.jsx(oC,{}),re.jsx(SC,{}),re.jsxs("div",{className:"relative flex-1 flex flex-col min-w-0",children:[re.jsx(bC,{}),re.jsx(uC,{onNewPane:o}),re.jsx("div",{className:"flex-1 min-h-0 min-w-0",children:i?re.jsx(mC,{node:i,projectId:e,cwd:(null==t?void 0:t.cwd)??"/"},e):re.jsx(yC,{onNewTerminal:a,projectName:null==t?void 0:t.name})})]})]})}window.__panefulHandleDrop=(e,t,i)=>{var r;let s=gd.getState().focusedTerminalId;if(null!=t&&null!=i){const e=null==(r=document.elementFromPoint(t,i))?void 0:r.closest("[data-terminal-id]");if(e){const t=e.dataset.terminalId;s=t,gd.getState().setFocusedTerminal(t)}}s&&e.length>0&&ox({type:"pty:input",terminalId:s,data:e.map(Gx).join(" ")})},se.createRoot(document.getElementById("root")).render(re.jsx(G.StrictMode,{children:re.jsx(xC,{})}));