paneful 0.9.4 → 0.9.5
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,434 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(s){if(s.ep)return;s.ep=!0;const n=r(s);fetch(s.href,n)}})();function Uf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kf={exports:{}},rl={},Vf={exports:{}},Q={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var mn=Symbol.for("react.element"),kv=Symbol.for("react.portal"),Ev=Symbol.for("react.fragment"),Pv=Symbol.for("react.strict_mode"),Lv=Symbol.for("react.profiler"),Dv=Symbol.for("react.provider"),Tv=Symbol.for("react.context"),Rv=Symbol.for("react.forward_ref"),Mv=Symbol.for("react.suspense"),Nv=Symbol.for("react.memo"),Bv=Symbol.for("react.lazy"),xu=Symbol.iterator;function Ov(e){return e===null||typeof e!="object"?null:(e=xu&&e[xu]||e["@@iterator"],typeof e=="function"?e:null)}var qf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Yf=Object.assign,Xf={};function ns(e,t,r){this.props=e,this.context=t,this.refs=Xf,this.updater=r||qf}ns.prototype.isReactComponent={};ns.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ns.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Gf(){}Gf.prototype=ns.prototype;function ah(e,t,r){this.props=e,this.context=t,this.refs=Xf,this.updater=r||qf}var ch=ah.prototype=new Gf;ch.constructor=ah;Yf(ch,ns.prototype);ch.isPureReactComponent=!0;var Cu=Array.isArray,Qf=Object.prototype.hasOwnProperty,hh={current:null},Jf={key:!0,ref:!0,__self:!0,__source:!0};function Zf(e,t,r){var i,s={},n=null,o=null;if(t!=null)for(i in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(n=""+t.key),t)Qf.call(t,i)&&!Jf.hasOwnProperty(i)&&(s[i]=t[i]);var l=arguments.length-2;if(l===1)s.children=r;else if(1<l){for(var a=Array(l),c=0;c<l;c++)a[c]=arguments[c+2];s.children=a}if(e&&e.defaultProps)for(i in l=e.defaultProps,l)s[i]===void 0&&(s[i]=l[i]);return{$$typeof:mn,type:e,key:n,ref:o,props:s,_owner:hh.current}}function Av(e,t){return{$$typeof:mn,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function uh(e){return typeof e=="object"&&e!==null&&e.$$typeof===mn}function Iv(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var bu=/\/+/g;function Pl(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Iv(""+e.key):t.toString(36)}function eo(e,t,r,i,s){var n=typeof e;(n==="undefined"||n==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(n){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case mn:case kv:o=!0}}if(o)return o=e,s=s(o),e=i===""?"."+Pl(o,0):i,Cu(s)?(r="",e!=null&&(r=e.replace(bu,"$&/")+"/"),eo(s,t,r,"",function(c){return c})):s!=null&&(uh(s)&&(s=Av(s,r+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(bu,"$&/")+"/")+e)),t.push(s)),1;if(o=0,i=i===""?".":i+":",Cu(e))for(var l=0;l<e.length;l++){n=e[l];var a=i+Pl(n,l);o+=eo(n,t,r,a,s)}else if(a=Ov(e),typeof a=="function")for(e=a.call(e),l=0;!(n=e.next()).done;)n=n.value,a=i+Pl(n,l++),o+=eo(n,t,r,a,s);else if(n==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Pn(e,t,r){if(e==null)return e;var i=[],s=0;return eo(e,i,"","",function(n){return t.call(r,n,s++)}),i}function zv(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ot={current:null},to={transition:null},jv={ReactCurrentDispatcher:ot,ReactCurrentBatchConfig:to,ReactCurrentOwner:hh};function e_(){throw Error("act(...) is not supported in production builds of React.")}Q.Children={map:Pn,forEach:function(e,t,r){Pn(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Pn(e,function(){t++}),t},toArray:function(e){return Pn(e,function(t){return t})||[]},only:function(e){if(!uh(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Q.Component=ns;Q.Fragment=Ev;Q.Profiler=Lv;Q.PureComponent=ah;Q.StrictMode=Pv;Q.Suspense=Mv;Q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=jv;Q.act=e_;Q.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=Yf({},e.props),s=e.key,n=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(n=t.ref,o=hh.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)Qf.call(t,a)&&!Jf.hasOwnProperty(a)&&(i[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)i.children=r;else if(1<a){l=Array(a);for(var c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}return{$$typeof:mn,type:e.type,key:s,ref:n,props:i,_owner:o}};Q.createContext=function(e){return e={$$typeof:Tv,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Dv,_context:e},e.Consumer=e};Q.createElement=Zf;Q.createFactory=function(e){var t=Zf.bind(null,e);return t.type=e,t};Q.createRef=function(){return{current:null}};Q.forwardRef=function(e){return{$$typeof:Rv,render:e}};Q.isValidElement=uh;Q.lazy=function(e){return{$$typeof:Bv,_payload:{_status:-1,_result:e},_init:zv}};Q.memo=function(e,t){return{$$typeof:Nv,type:e,compare:t===void 0?null:t}};Q.startTransition=function(e){var t=to.transition;to.transition={};try{e()}finally{to.transition=t}};Q.unstable_act=e_;Q.useCallback=function(e,t){return ot.current.useCallback(e,t)};Q.useContext=function(e){return ot.current.useContext(e)};Q.useDebugValue=function(){};Q.useDeferredValue=function(e){return ot.current.useDeferredValue(e)};Q.useEffect=function(e,t){return ot.current.useEffect(e,t)};Q.useId=function(){return ot.current.useId()};Q.useImperativeHandle=function(e,t,r){return ot.current.useImperativeHandle(e,t,r)};Q.useInsertionEffect=function(e,t){return ot.current.useInsertionEffect(e,t)};Q.useLayoutEffect=function(e,t){return ot.current.useLayoutEffect(e,t)};Q.useMemo=function(e,t){return ot.current.useMemo(e,t)};Q.useReducer=function(e,t,r){return ot.current.useReducer(e,t,r)};Q.useRef=function(e){return ot.current.useRef(e)};Q.useState=function(e){return ot.current.useState(e)};Q.useSyncExternalStore=function(e,t,r){return ot.current.useSyncExternalStore(e,t,r)};Q.useTransition=function(){return ot.current.useTransition()};Q.version="18.3.1";Vf.exports=Q;var N=Vf.exports;const t_=Uf(N);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var $v=N,Fv=Symbol.for("react.element"),Wv=Symbol.for("react.fragment"),Hv=Object.prototype.hasOwnProperty,Uv=$v.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Kv={key:!0,ref:!0,__self:!0,__source:!0};function r_(e,t,r){var i,s={},n=null,o=null;r!==void 0&&(n=""+r),t.key!==void 0&&(n=""+t.key),t.ref!==void 0&&(o=t.ref);for(i in t)Hv.call(t,i)&&!Kv.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps,t)s[i]===void 0&&(s[i]=t[i]);return{$$typeof:Fv,type:e,key:n,ref:o,props:s,_owner:Uv.current}}rl.Fragment=Wv;rl.jsx=r_;rl.jsxs=r_;Kf.exports=rl;var _=Kf.exports,ga={},i_={exports:{}},xt={},s_={exports:{}},n_={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(b,A){var j=b.length;b.push(A);e:for(;0<j;){var V=j-1>>>1,J=b[V];if(0<s(J,A))b[V]=A,b[j]=J,j=V;else break e}}function r(b){return b.length===0?null:b[0]}function i(b){if(b.length===0)return null;var A=b[0],j=b.pop();if(j!==A){b[0]=j;e:for(var V=0,J=b.length,le=J>>>1;V<le;){var ee=2*(V+1)-1,he=b[ee],re=ee+1,Me=b[re];if(0>s(he,j))re<J&&0>s(Me,he)?(b[V]=Me,b[re]=j,V=re):(b[V]=he,b[ee]=j,V=ee);else if(re<J&&0>s(Me,j))b[V]=Me,b[re]=j,V=re;else break e}}return A}function s(b,A){var j=b.sortIndex-A.sortIndex;return j!==0?j:b.id-A.id}if(typeof performance=="object"&&typeof performance.now=="function"){var n=performance;e.unstable_now=function(){return n.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],c=[],u=1,h=null,d=3,m=!1,p=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(b){for(var A=r(c);A!==null;){if(A.callback===null)i(c);else if(A.startTime<=b)i(c),A.sortIndex=A.expirationTime,t(a,A);else break;A=r(c)}}function S(b){if(g=!1,y(b),!p)if(r(a)!==null)p=!0,D(C);else{var A=r(c);A!==null&&O(S,A.startTime-b)}}function C(b,A){p=!1,g&&(g=!1,f(z),z=-1),m=!0;var j=d;try{for(y(A),h=r(a);h!==null&&(!(h.expirationTime>A)||b&&!q());){var V=h.callback;if(typeof V=="function"){h.callback=null,d=h.priorityLevel;var J=V(h.expirationTime<=A);A=e.unstable_now(),typeof J=="function"?h.callback=J:h===r(a)&&i(a),y(A)}else i(a);h=r(a)}if(h!==null)var le=!0;else{var ee=r(c);ee!==null&&O(S,ee.startTime-A),le=!1}return le}finally{h=null,d=j,m=!1}}var P=!1,M=null,z=-1,Y=5,U=-1;function q(){return!(e.unstable_now()-U<Y)}function L(){if(M!==null){var b=e.unstable_now();U=b;var A=!0;try{A=M(!0,b)}finally{A?x():(P=!1,M=null)}}else P=!1}var x;if(typeof v=="function")x=function(){v(L)};else if(typeof MessageChannel<"u"){var E=new MessageChannel,k=E.port2;E.port1.onmessage=L,x=function(){k.postMessage(null)}}else x=function(){w(L,0)};function D(b){M=b,P||(P=!0,x())}function O(b,A){z=w(function(){b(e.unstable_now())},A)}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(b){b.callback=null},e.unstable_continueExecution=function(){p||m||(p=!0,D(C))},e.unstable_forceFrameRate=function(b){0>b||125<b?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<b?Math.floor(1e3/b):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return r(a)},e.unstable_next=function(b){switch(d){case 1:case 2:case 3:var A=3;break;default:A=d}var j=d;d=A;try{return b()}finally{d=j}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(b,A){switch(b){case 1:case 2:case 3:case 4:case 5:break;default:b=3}var j=d;d=b;try{return A()}finally{d=j}},e.unstable_scheduleCallback=function(b,A,j){var V=e.unstable_now();switch(typeof j=="object"&&j!==null?(j=j.delay,j=typeof j=="number"&&0<j?V+j:V):j=V,b){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=j+J,b={id:u++,callback:A,priorityLevel:b,startTime:j,expirationTime:J,sortIndex:-1},j>V?(b.sortIndex=j,t(c,b),r(a)===null&&b===r(c)&&(g?(f(z),z=-1):g=!0,O(S,j-V))):(b.sortIndex=J,t(a,b),p||m||(p=!0,D(C))),b},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(b){var A=d;return function(){var j=d;d=A;try{return b.apply(this,arguments)}finally{d=j}}}})(n_);s_.exports=n_;var Vv=s_.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var qv=N,wt=Vv;function B(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);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 o_=new Set,Ys={};function wi(e,t){Gi(e,t),Gi(e+"Capture",t)}function Gi(e,t){for(Ys[e]=t,e=0;e<t.length;e++)o_.add(t[e])}var _r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ya=Object.prototype.hasOwnProperty,Yv=/^[: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]*$/,ku={},Eu={};function Xv(e){return ya.call(Eu,e)?!0:ya.call(ku,e)?!1:Yv.test(e)?Eu[e]=!0:(ku[e]=!0,!1)}function Gv(e,t,r,i){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return i?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Qv(e,t,r,i){if(t===null||typeof t>"u"||Gv(e,t,r,i))return!0;if(i)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function lt(e,t,r,i,s,n,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=i,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var Qe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Qe[e]=new lt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Qe[t]=new lt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Qe[e]=new lt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Qe[e]=new lt(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){Qe[e]=new lt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Qe[e]=new lt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Qe[e]=new lt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Qe[e]=new lt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Qe[e]=new lt(e,5,!1,e.toLowerCase(),null,!1,!1)});var dh=/[\-:]([a-z])/g;function fh(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(dh,fh);Qe[t]=new lt(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(dh,fh);Qe[t]=new lt(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(dh,fh);Qe[t]=new lt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Qe[e]=new lt(e,1,!1,e.toLowerCase(),null,!1,!1)});Qe.xlinkHref=new lt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Qe[e]=new lt(e,1,!1,e.toLowerCase(),null,!0,!0)});function _h(e,t,r,i){var s=Qe.hasOwnProperty(t)?Qe[t]:null;(s!==null?s.type!==0:i||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Qv(t,r,s,i)&&(r=null),i||s===null?Xv(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):s.mustUseProperty?e[s.propertyName]=r===null?s.type===3?!1:"":r:(t=s.attributeName,i=s.attributeNamespace,r===null?e.removeAttribute(t):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,i?e.setAttributeNS(i,t,r):e.setAttribute(t,r))))}var gr=qv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ln=Symbol.for("react.element"),Di=Symbol.for("react.portal"),Ti=Symbol.for("react.fragment"),ph=Symbol.for("react.strict_mode"),Sa=Symbol.for("react.profiler"),l_=Symbol.for("react.provider"),a_=Symbol.for("react.context"),mh=Symbol.for("react.forward_ref"),wa=Symbol.for("react.suspense"),xa=Symbol.for("react.suspense_list"),vh=Symbol.for("react.memo"),Lr=Symbol.for("react.lazy"),c_=Symbol.for("react.offscreen"),Pu=Symbol.iterator;function ds(e){return e===null||typeof e!="object"?null:(e=Pu&&e[Pu]||e["@@iterator"],typeof e=="function"?e:null)}var xe=Object.assign,Ll;function Ps(e){if(Ll===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Ll=t&&t[1]||""}return`
|
|
34
|
+
`+Ll+e}var Dl=!1;function Tl(e,t){if(!e||Dl)return"";Dl=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var i=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){i=c}e.call(t.prototype)}else{try{throw Error()}catch(c){i=c}e()}}catch(c){if(c&&i&&typeof c.stack=="string"){for(var s=c.stack.split(`
|
|
35
|
+
`),n=i.stack.split(`
|
|
36
|
+
`),o=s.length-1,l=n.length-1;1<=o&&0<=l&&s[o]!==n[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==n[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==n[l]){var a=`
|
|
37
|
+
`+s[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Dl=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Ps(e):""}function Jv(e){switch(e.tag){case 5:return Ps(e.type);case 16:return Ps("Lazy");case 13:return Ps("Suspense");case 19:return Ps("SuspenseList");case 0:case 2:case 15:return e=Tl(e.type,!1),e;case 11:return e=Tl(e.type.render,!1),e;case 1:return e=Tl(e.type,!0),e;default:return""}}function Ca(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ti:return"Fragment";case Di:return"Portal";case Sa:return"Profiler";case ph:return"StrictMode";case wa:return"Suspense";case xa:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case a_:return(e.displayName||"Context")+".Consumer";case l_:return(e._context.displayName||"Context")+".Provider";case mh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vh:return t=e.displayName||null,t!==null?t:Ca(e.type)||"Memo";case Lr:t=e._payload,e=e._init;try{return Ca(e(t))}catch{}}return null}function Zv(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ca(t);case 8:return t===ph?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Vr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function h_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function eg(e){var t=h_(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,n=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){i=""+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Dn(e){e._valueTracker||(e._valueTracker=eg(e))}function u_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i="";return e&&(i=h_(e)?e.checked?"true":"false":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function Co(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ba(e,t){var r=t.checked;return xe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Lu(e,t){var r=t.defaultValue==null?"":t.defaultValue,i=t.checked!=null?t.checked:t.defaultChecked;r=Vr(t.value!=null?t.value:r),e._wrapperState={initialChecked:i,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function d_(e,t){t=t.checked,t!=null&&_h(e,"checked",t,!1)}function ka(e,t){d_(e,t);var r=Vr(t.value),i=t.type;if(r!=null)i==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(i==="submit"||i==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ea(e,t.type,r):t.hasOwnProperty("defaultValue")&&Ea(e,t.type,Vr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Du(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var i=t.type;if(!(i!=="submit"&&i!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Ea(e,t,r){(t!=="number"||Co(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Ls=Array.isArray;function Hi(e,t,r,i){if(e=e.options,t){t={};for(var s=0;s<r.length;s++)t["$"+r[s]]=!0;for(r=0;r<e.length;r++)s=t.hasOwnProperty("$"+e[r].value),e[r].selected!==s&&(e[r].selected=s),s&&i&&(e[r].defaultSelected=!0)}else{for(r=""+Vr(r),t=null,s=0;s<e.length;s++){if(e[s].value===r){e[s].selected=!0,i&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Pa(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(B(91));return xe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Tu(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(B(92));if(Ls(r)){if(1<r.length)throw Error(B(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Vr(r)}}function f_(e,t){var r=Vr(t.value),i=Vr(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),i!=null&&(e.defaultValue=""+i)}function Ru(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function __(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 La(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?__(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Tn,p_=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,i,s){MSApp.execUnsafeLocalFunction(function(){return e(t,r,i,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Tn=Tn||document.createElement("div"),Tn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Tn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xs(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var As={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tg=["Webkit","ms","Moz","O"];Object.keys(As).forEach(function(e){tg.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),As[t]=As[e]})});function m_(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||As.hasOwnProperty(e)&&As[e]?(""+t).trim():t+"px"}function v_(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var i=r.indexOf("--")===0,s=m_(r,t[r],i);r==="float"&&(r="cssFloat"),i?e.setProperty(r,s):e[r]=s}}var rg=xe({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 Da(e,t){if(t){if(rg[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(B(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(B(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(B(61))}if(t.style!=null&&typeof t.style!="object")throw Error(B(62))}}function Ta(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ra=null;function gh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ma=null,Ui=null,Ki=null;function Mu(e){if(e=yn(e)){if(typeof Ma!="function")throw Error(B(280));var t=e.stateNode;t&&(t=ll(t),Ma(e.stateNode,e.type,t))}}function g_(e){Ui?Ki?Ki.push(e):Ki=[e]:Ui=e}function y_(){if(Ui){var e=Ui,t=Ki;if(Ki=Ui=null,Mu(e),t)for(e=0;e<t.length;e++)Mu(t[e])}}function S_(e,t){return e(t)}function w_(){}var Rl=!1;function x_(e,t,r){if(Rl)return e(t,r);Rl=!0;try{return S_(e,t,r)}finally{Rl=!1,(Ui!==null||Ki!==null)&&(w_(),y_())}}function Gs(e,t){var r=e.stateNode;if(r===null)return null;var i=ll(r);if(i===null)return null;r=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(B(231,t,typeof r));return r}var Na=!1;if(_r)try{var fs={};Object.defineProperty(fs,"passive",{get:function(){Na=!0}}),window.addEventListener("test",fs,fs),window.removeEventListener("test",fs,fs)}catch{Na=!1}function ig(e,t,r,i,s,n,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(u){this.onError(u)}}var Is=!1,bo=null,ko=!1,Ba=null,sg={onError:function(e){Is=!0,bo=e}};function ng(e,t,r,i,s,n,o,l,a){Is=!1,bo=null,ig.apply(sg,arguments)}function og(e,t,r,i,s,n,o,l,a){if(ng.apply(this,arguments),Is){if(Is){var c=bo;Is=!1,bo=null}else throw Error(B(198));ko||(ko=!0,Ba=c)}}function xi(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function C_(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Nu(e){if(xi(e)!==e)throw Error(B(188))}function lg(e){var t=e.alternate;if(!t){if(t=xi(e),t===null)throw Error(B(188));return t!==e?null:e}for(var r=e,i=t;;){var s=r.return;if(s===null)break;var n=s.alternate;if(n===null){if(i=s.return,i!==null){r=i;continue}break}if(s.child===n.child){for(n=s.child;n;){if(n===r)return Nu(s),e;if(n===i)return Nu(s),t;n=n.sibling}throw Error(B(188))}if(r.return!==i.return)r=s,i=n;else{for(var o=!1,l=s.child;l;){if(l===r){o=!0,r=s,i=n;break}if(l===i){o=!0,i=s,r=n;break}l=l.sibling}if(!o){for(l=n.child;l;){if(l===r){o=!0,r=n,i=s;break}if(l===i){o=!0,i=n,r=s;break}l=l.sibling}if(!o)throw Error(B(189))}}if(r.alternate!==i)throw Error(B(190))}if(r.tag!==3)throw Error(B(188));return r.stateNode.current===r?e:t}function b_(e){return e=lg(e),e!==null?k_(e):null}function k_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=k_(e);if(t!==null)return t;e=e.sibling}return null}var E_=wt.unstable_scheduleCallback,Bu=wt.unstable_cancelCallback,ag=wt.unstable_shouldYield,cg=wt.unstable_requestPaint,Pe=wt.unstable_now,hg=wt.unstable_getCurrentPriorityLevel,yh=wt.unstable_ImmediatePriority,P_=wt.unstable_UserBlockingPriority,Eo=wt.unstable_NormalPriority,ug=wt.unstable_LowPriority,L_=wt.unstable_IdlePriority,il=null,rr=null;function dg(e){if(rr&&typeof rr.onCommitFiberRoot=="function")try{rr.onCommitFiberRoot(il,e,void 0,(e.current.flags&128)===128)}catch{}}var Wt=Math.clz32?Math.clz32:pg,fg=Math.log,_g=Math.LN2;function pg(e){return e>>>=0,e===0?32:31-(fg(e)/_g|0)|0}var Rn=64,Mn=4194304;function Ds(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Po(e,t){var r=e.pendingLanes;if(r===0)return 0;var i=0,s=e.suspendedLanes,n=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~s;l!==0?i=Ds(l):(n&=o,n!==0&&(i=Ds(n)))}else o=r&~s,o!==0?i=Ds(o):n!==0&&(i=Ds(n));if(i===0)return 0;if(t!==0&&t!==i&&!(t&s)&&(s=i&-i,n=t&-t,s>=n||s===16&&(n&4194240)!==0))return t;if(i&4&&(i|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=i;0<t;)r=31-Wt(t),s=1<<r,i|=e[r],t&=~s;return i}function mg(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function vg(e,t){for(var r=e.suspendedLanes,i=e.pingedLanes,s=e.expirationTimes,n=e.pendingLanes;0<n;){var o=31-Wt(n),l=1<<o,a=s[o];a===-1?(!(l&r)||l&i)&&(s[o]=mg(l,t)):a<=t&&(e.expiredLanes|=l),n&=~l}}function Oa(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function D_(){var e=Rn;return Rn<<=1,!(Rn&4194240)&&(Rn=64),e}function Ml(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function vn(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Wt(t),e[t]=r}function gg(e,t){var r=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 i=e.eventTimes;for(e=e.expirationTimes;0<r;){var s=31-Wt(r),n=1<<s;t[s]=0,i[s]=-1,e[s]=-1,r&=~n}}function Sh(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var i=31-Wt(r),s=1<<i;s&t|e[i]&t&&(e[i]|=t),r&=~s}}var oe=0;function T_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var R_,wh,M_,N_,B_,Aa=!1,Nn=[],Ir=null,zr=null,jr=null,Qs=new Map,Js=new Map,Rr=[],yg="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 Ou(e,t){switch(e){case"focusin":case"focusout":Ir=null;break;case"dragenter":case"dragleave":zr=null;break;case"mouseover":case"mouseout":jr=null;break;case"pointerover":case"pointerout":Qs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Js.delete(t.pointerId)}}function _s(e,t,r,i,s,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:r,eventSystemFlags:i,nativeEvent:n,targetContainers:[s]},t!==null&&(t=yn(t),t!==null&&wh(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function Sg(e,t,r,i,s){switch(t){case"focusin":return Ir=_s(Ir,e,t,r,i,s),!0;case"dragenter":return zr=_s(zr,e,t,r,i,s),!0;case"mouseover":return jr=_s(jr,e,t,r,i,s),!0;case"pointerover":var n=s.pointerId;return Qs.set(n,_s(Qs.get(n)||null,e,t,r,i,s)),!0;case"gotpointercapture":return n=s.pointerId,Js.set(n,_s(Js.get(n)||null,e,t,r,i,s)),!0}return!1}function O_(e){var t=si(e.target);if(t!==null){var r=xi(t);if(r!==null){if(t=r.tag,t===13){if(t=C_(r),t!==null){e.blockedOn=t,B_(e.priority,function(){M_(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Ia(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);Ra=i,r.target.dispatchEvent(i),Ra=null}else return t=yn(r),t!==null&&wh(t),e.blockedOn=r,!1;t.shift()}return!0}function Au(e,t,r){ro(e)&&r.delete(t)}function wg(){Aa=!1,Ir!==null&&ro(Ir)&&(Ir=null),zr!==null&&ro(zr)&&(zr=null),jr!==null&&ro(jr)&&(jr=null),Qs.forEach(Au),Js.forEach(Au)}function ps(e,t){e.blockedOn===t&&(e.blockedOn=null,Aa||(Aa=!0,wt.unstable_scheduleCallback(wt.unstable_NormalPriority,wg)))}function Zs(e){function t(s){return ps(s,e)}if(0<Nn.length){ps(Nn[0],e);for(var r=1;r<Nn.length;r++){var i=Nn[r];i.blockedOn===e&&(i.blockedOn=null)}}for(Ir!==null&&ps(Ir,e),zr!==null&&ps(zr,e),jr!==null&&ps(jr,e),Qs.forEach(t),Js.forEach(t),r=0;r<Rr.length;r++)i=Rr[r],i.blockedOn===e&&(i.blockedOn=null);for(;0<Rr.length&&(r=Rr[0],r.blockedOn===null);)O_(r),r.blockedOn===null&&Rr.shift()}var Vi=gr.ReactCurrentBatchConfig,Lo=!0;function xg(e,t,r,i){var s=oe,n=Vi.transition;Vi.transition=null;try{oe=1,xh(e,t,r,i)}finally{oe=s,Vi.transition=n}}function Cg(e,t,r,i){var s=oe,n=Vi.transition;Vi.transition=null;try{oe=4,xh(e,t,r,i)}finally{oe=s,Vi.transition=n}}function xh(e,t,r,i){if(Lo){var s=Ia(e,t,r,i);if(s===null)Wl(e,t,i,Do,r),Ou(e,i);else if(Sg(s,e,t,r,i))i.stopPropagation();else if(Ou(e,i),t&4&&-1<yg.indexOf(e)){for(;s!==null;){var n=yn(s);if(n!==null&&R_(n),n=Ia(e,t,r,i),n===null&&Wl(e,t,i,Do,r),n===s)break;s=n}s!==null&&i.stopPropagation()}else Wl(e,t,i,null,r)}}var Do=null;function Ia(e,t,r,i){if(Do=null,e=gh(i),e=si(e),e!==null)if(t=xi(e),t===null)e=null;else if(r=t.tag,r===13){if(e=C_(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Do=e,null}function A_(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(hg()){case yh:return 1;case P_:return 4;case Eo:case ug:return 16;case L_:return 536870912;default:return 16}default:return 16}}var Nr=null,Ch=null,io=null;function I_(){if(io)return io;var e,t=Ch,r=t.length,i,s="value"in Nr?Nr.value:Nr.textContent,n=s.length;for(e=0;e<r&&t[e]===s[e];e++);var o=r-e;for(i=1;i<=o&&t[r-i]===s[n-i];i++);return io=s.slice(e,1<i?1-i:void 0)}function so(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Bn(){return!0}function Iu(){return!1}function Ct(e){function t(r,i,s,n,o){this._reactName=r,this._targetInst=s,this.type=i,this.nativeEvent=n,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(n):n[l]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?Bn:Iu,this.isPropagationStopped=Iu,this}return xe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Bn)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Bn)},persist:function(){},isPersistent:Bn}),t}var os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bh=Ct(os),gn=xe({},os,{view:0,detail:0}),bg=Ct(gn),Nl,Bl,ms,sl=xe({},gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kh,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ms&&(ms&&e.type==="mousemove"?(Nl=e.screenX-ms.screenX,Bl=e.screenY-ms.screenY):Bl=Nl=0,ms=e),Nl)},movementY:function(e){return"movementY"in e?e.movementY:Bl}}),zu=Ct(sl),kg=xe({},sl,{dataTransfer:0}),Eg=Ct(kg),Pg=xe({},gn,{relatedTarget:0}),Ol=Ct(Pg),Lg=xe({},os,{animationName:0,elapsedTime:0,pseudoElement:0}),Dg=Ct(Lg),Tg=xe({},os,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Rg=Ct(Tg),Mg=xe({},os,{data:0}),ju=Ct(Mg),Ng={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Bg={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"},Og={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ag(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Og[e])?!!t[e]:!1}function kh(){return Ag}var Ig=xe({},gn,{key:function(e){if(e.key){var t=Ng[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=so(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Bg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kh,charCode:function(e){return e.type==="keypress"?so(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?so(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zg=Ct(Ig),jg=xe({},sl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$u=Ct(jg),$g=xe({},gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kh}),Fg=Ct($g),Wg=xe({},os,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hg=Ct(Wg),Ug=xe({},sl,{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}),Kg=Ct(Ug),Vg=[9,13,27,32],Eh=_r&&"CompositionEvent"in window,zs=null;_r&&"documentMode"in document&&(zs=document.documentMode);var qg=_r&&"TextEvent"in window&&!zs,z_=_r&&(!Eh||zs&&8<zs&&11>=zs),Fu=" ",Wu=!1;function j_(e,t){switch(e){case"keyup":return Vg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ri=!1;function Yg(e,t){switch(e){case"compositionend":return $_(t);case"keypress":return t.which!==32?null:(Wu=!0,Fu);case"textInput":return e=t.data,e===Fu&&Wu?null:e;default:return null}}function Xg(e,t){if(Ri)return e==="compositionend"||!Eh&&j_(e,t)?(e=I_(),io=Ch=Nr=null,Ri=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return z_&&t.locale!=="ko"?null:t.data;default:return null}}var Gg={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 Hu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Gg[e.type]:t==="textarea"}function F_(e,t,r,i){g_(i),t=To(t,"onChange"),0<t.length&&(r=new bh("onChange","change",null,r,i),e.push({event:r,listeners:t}))}var js=null,en=null;function Qg(e){J_(e,0)}function nl(e){var t=Bi(e);if(u_(t))return e}function Jg(e,t){if(e==="change")return t}var W_=!1;if(_r){var Al;if(_r){var Il="oninput"in document;if(!Il){var Uu=document.createElement("div");Uu.setAttribute("oninput","return;"),Il=typeof Uu.oninput=="function"}Al=Il}else Al=!1;W_=Al&&(!document.documentMode||9<document.documentMode)}function Ku(){js&&(js.detachEvent("onpropertychange",H_),en=js=null)}function H_(e){if(e.propertyName==="value"&&nl(en)){var t=[];F_(t,en,e,gh(e)),x_(Qg,t)}}function Zg(e,t,r){e==="focusin"?(Ku(),js=t,en=r,js.attachEvent("onpropertychange",H_)):e==="focusout"&&Ku()}function ey(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return nl(en)}function ty(e,t){if(e==="click")return nl(t)}function ry(e,t){if(e==="input"||e==="change")return nl(t)}function iy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ut=typeof Object.is=="function"?Object.is:iy;function tn(e,t){if(Ut(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var s=r[i];if(!ya.call(t,s)||!Ut(e[s],t[s]))return!1}return!0}function Vu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function qu(e,t){var r=Vu(e);e=0;for(var i;r;){if(r.nodeType===3){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=Vu(r)}}function U_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?U_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function K_(){for(var e=window,t=Co();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Co(e.document)}return t}function Ph(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function sy(e){var t=K_(),r=e.focusedElem,i=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&U_(r.ownerDocument.documentElement,r)){if(i!==null&&Ph(r)){if(t=i.start,e=i.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,n=Math.min(i.start,s);i=i.end===void 0?n:Math.min(i.end,s),!e.extend&&n>i&&(s=i,i=n,n=s),s=qu(r,n);var o=qu(r,i);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),n>i?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var ny=_r&&"documentMode"in document&&11>=document.documentMode,Mi=null,za=null,$s=null,ja=!1;function Yu(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ja||Mi==null||Mi!==Co(i)||(i=Mi,"selectionStart"in i&&Ph(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),$s&&tn($s,i)||($s=i,i=To(za,"onSelect"),0<i.length&&(t=new bh("onSelect","select",null,t,r),e.push({event:t,listeners:i}),t.target=Mi)))}function On(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Ni={animationend:On("Animation","AnimationEnd"),animationiteration:On("Animation","AnimationIteration"),animationstart:On("Animation","AnimationStart"),transitionend:On("Transition","TransitionEnd")},zl={},V_={};_r&&(V_=document.createElement("div").style,"AnimationEvent"in window||(delete Ni.animationend.animation,delete Ni.animationiteration.animation,delete Ni.animationstart.animation),"TransitionEvent"in window||delete Ni.transitionend.transition);function ol(e){if(zl[e])return zl[e];if(!Ni[e])return e;var t=Ni[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in V_)return zl[e]=t[r];return e}var q_=ol("animationend"),Y_=ol("animationiteration"),X_=ol("animationstart"),G_=ol("transitionend"),Q_=new Map,Xu="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 Xr(e,t){Q_.set(e,t),wi(t,[e])}for(var jl=0;jl<Xu.length;jl++){var $l=Xu[jl],oy=$l.toLowerCase(),ly=$l[0].toUpperCase()+$l.slice(1);Xr(oy,"on"+ly)}Xr(q_,"onAnimationEnd");Xr(Y_,"onAnimationIteration");Xr(X_,"onAnimationStart");Xr("dblclick","onDoubleClick");Xr("focusin","onFocus");Xr("focusout","onBlur");Xr(G_,"onTransitionEnd");Gi("onMouseEnter",["mouseout","mouseover"]);Gi("onMouseLeave",["mouseout","mouseover"]);Gi("onPointerEnter",["pointerout","pointerover"]);Gi("onPointerLeave",["pointerout","pointerover"]);wi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));wi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));wi("onBeforeInput",["compositionend","keypress","textInput","paste"]);wi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));wi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));wi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ts="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(" "),ay=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ts));function Gu(e,t,r){var i=e.type||"unknown-event";e.currentTarget=r,og(i,t,void 0,e),e.currentTarget=null}function J_(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var i=e[r],s=i.event;i=i.listeners;e:{var n=void 0;if(t)for(var o=i.length-1;0<=o;o--){var l=i[o],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==n&&s.isPropagationStopped())break e;Gu(s,l,c),n=a}else for(o=0;o<i.length;o++){if(l=i[o],a=l.instance,c=l.currentTarget,l=l.listener,a!==n&&s.isPropagationStopped())break e;Gu(s,l,c),n=a}}}if(ko)throw e=Ba,ko=!1,Ba=null,e}function de(e,t){var r=t[Ua];r===void 0&&(r=t[Ua]=new Set);var i=e+"__bubble";r.has(i)||(Z_(t,e,2,!1),r.add(i))}function Fl(e,t,r){var i=0;t&&(i|=4),Z_(r,e,i,t)}var An="_reactListening"+Math.random().toString(36).slice(2);function rn(e){if(!e[An]){e[An]=!0,o_.forEach(function(r){r!=="selectionchange"&&(ay.has(r)||Fl(r,!1,e),Fl(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[An]||(t[An]=!0,Fl("selectionchange",!1,t))}}function Z_(e,t,r,i){switch(A_(t)){case 1:var s=xg;break;case 4:s=Cg;break;default:s=xh}r=s.bind(null,t,r,e),s=void 0,!Na||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),i?s!==void 0?e.addEventListener(t,r,{capture:!0,passive:s}):e.addEventListener(t,r,!0):s!==void 0?e.addEventListener(t,r,{passive:s}):e.addEventListener(t,r,!1)}function Wl(e,t,r,i,s){var n=i;if(!(t&1)&&!(t&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var l=i.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=i.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===s||a.nodeType===8&&a.parentNode===s))return;o=o.return}for(;l!==null;){if(o=si(l),o===null)return;if(a=o.tag,a===5||a===6){i=n=o;continue e}l=l.parentNode}}i=i.return}x_(function(){var c=n,u=gh(r),h=[];e:{var d=Q_.get(e);if(d!==void 0){var m=bh,p=e;switch(e){case"keypress":if(so(r)===0)break e;case"keydown":case"keyup":m=zg;break;case"focusin":p="focus",m=Ol;break;case"focusout":p="blur",m=Ol;break;case"beforeblur":case"afterblur":m=Ol;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=zu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=Eg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Fg;break;case q_:case Y_:case X_:m=Dg;break;case G_:m=Hg;break;case"scroll":m=bg;break;case"wheel":m=Kg;break;case"copy":case"cut":case"paste":m=Rg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=$u}var g=(t&4)!==0,w=!g&&e==="scroll",f=g?d!==null?d+"Capture":null:d;g=[];for(var v=c,y;v!==null;){y=v;var S=y.stateNode;if(y.tag===5&&S!==null&&(y=S,f!==null&&(S=Gs(v,f),S!=null&&g.push(sn(v,S,y)))),w)break;v=v.return}0<g.length&&(d=new m(d,p,null,r,u),h.push({event:d,listeners:g}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",d&&r!==Ra&&(p=r.relatedTarget||r.fromElement)&&(si(p)||p[pr]))break e;if((m||d)&&(d=u.window===u?u:(d=u.ownerDocument)?d.defaultView||d.parentWindow:window,m?(p=r.relatedTarget||r.toElement,m=c,p=p?si(p):null,p!==null&&(w=xi(p),p!==w||p.tag!==5&&p.tag!==6)&&(p=null)):(m=null,p=c),m!==p)){if(g=zu,S="onMouseLeave",f="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(g=$u,S="onPointerLeave",f="onPointerEnter",v="pointer"),w=m==null?d:Bi(m),y=p==null?d:Bi(p),d=new g(S,v+"leave",m,r,u),d.target=w,d.relatedTarget=y,S=null,si(u)===c&&(g=new g(f,v+"enter",p,r,u),g.target=y,g.relatedTarget=w,S=g),w=S,m&&p)t:{for(g=m,f=p,v=0,y=g;y;y=Ei(y))v++;for(y=0,S=f;S;S=Ei(S))y++;for(;0<v-y;)g=Ei(g),v--;for(;0<y-v;)f=Ei(f),y--;for(;v--;){if(g===f||f!==null&&g===f.alternate)break t;g=Ei(g),f=Ei(f)}g=null}else g=null;m!==null&&Qu(h,d,m,g,!1),p!==null&&w!==null&&Qu(h,w,p,g,!0)}}e:{if(d=c?Bi(c):window,m=d.nodeName&&d.nodeName.toLowerCase(),m==="select"||m==="input"&&d.type==="file")var C=Jg;else if(Hu(d))if(W_)C=ry;else{C=ey;var P=Zg}else(m=d.nodeName)&&m.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(C=ty);if(C&&(C=C(e,c))){F_(h,C,r,u);break e}P&&P(e,d,c),e==="focusout"&&(P=d._wrapperState)&&P.controlled&&d.type==="number"&&Ea(d,"number",d.value)}switch(P=c?Bi(c):window,e){case"focusin":(Hu(P)||P.contentEditable==="true")&&(Mi=P,za=c,$s=null);break;case"focusout":$s=za=Mi=null;break;case"mousedown":ja=!0;break;case"contextmenu":case"mouseup":case"dragend":ja=!1,Yu(h,r,u);break;case"selectionchange":if(ny)break;case"keydown":case"keyup":Yu(h,r,u)}var M;if(Eh)e:{switch(e){case"compositionstart":var z="onCompositionStart";break e;case"compositionend":z="onCompositionEnd";break e;case"compositionupdate":z="onCompositionUpdate";break e}z=void 0}else Ri?j_(e,r)&&(z="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(z="onCompositionStart");z&&(z_&&r.locale!=="ko"&&(Ri||z!=="onCompositionStart"?z==="onCompositionEnd"&&Ri&&(M=I_()):(Nr=u,Ch="value"in Nr?Nr.value:Nr.textContent,Ri=!0)),P=To(c,z),0<P.length&&(z=new ju(z,e,null,r,u),h.push({event:z,listeners:P}),M?z.data=M:(M=$_(r),M!==null&&(z.data=M)))),(M=qg?Yg(e,r):Xg(e,r))&&(c=To(c,"onBeforeInput"),0<c.length&&(u=new ju("onBeforeInput","beforeinput",null,r,u),h.push({event:u,listeners:c}),u.data=M))}J_(h,t)})}function sn(e,t,r){return{instance:e,listener:t,currentTarget:r}}function To(e,t){for(var r=t+"Capture",i=[];e!==null;){var s=e,n=s.stateNode;s.tag===5&&n!==null&&(s=n,n=Gs(e,r),n!=null&&i.unshift(sn(e,n,s)),n=Gs(e,t),n!=null&&i.push(sn(e,n,s))),e=e.return}return i}function Ei(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Qu(e,t,r,i,s){for(var n=t._reactName,o=[];r!==null&&r!==i;){var l=r,a=l.alternate,c=l.stateNode;if(a!==null&&a===i)break;l.tag===5&&c!==null&&(l=c,s?(a=Gs(r,n),a!=null&&o.unshift(sn(r,a,l))):s||(a=Gs(r,n),a!=null&&o.push(sn(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var cy=/\r\n?/g,hy=/\u0000|\uFFFD/g;function Ju(e){return(typeof e=="string"?e:""+e).replace(cy,`
|
|
38
|
+
`).replace(hy,"")}function In(e,t,r){if(t=Ju(t),Ju(e)!==t&&r)throw Error(B(425))}function Ro(){}var $a=null,Fa=null;function Wa(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ha=typeof setTimeout=="function"?setTimeout:void 0,uy=typeof clearTimeout=="function"?clearTimeout:void 0,Zu=typeof Promise=="function"?Promise:void 0,dy=typeof queueMicrotask=="function"?queueMicrotask:typeof Zu<"u"?function(e){return Zu.resolve(null).then(e).catch(fy)}:Ha;function fy(e){setTimeout(function(){throw e})}function Hl(e,t){var r=t,i=0;do{var s=r.nextSibling;if(e.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(i===0){e.removeChild(s),Zs(t);return}i--}else r!=="$"&&r!=="$?"&&r!=="$!"||i++;r=s}while(r);Zs(t)}function $r(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function ed(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var ls=Math.random().toString(36).slice(2),er="__reactFiber$"+ls,nn="__reactProps$"+ls,pr="__reactContainer$"+ls,Ua="__reactEvents$"+ls,_y="__reactListeners$"+ls,py="__reactHandles$"+ls;function si(e){var t=e[er];if(t)return t;for(var r=e.parentNode;r;){if(t=r[pr]||r[er]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=ed(e);e!==null;){if(r=e[er])return r;e=ed(e)}return t}e=r,r=e.parentNode}return null}function yn(e){return e=e[er]||e[pr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Bi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(B(33))}function ll(e){return e[nn]||null}var Ka=[],Oi=-1;function Gr(e){return{current:e}}function _e(e){0>Oi||(e.current=Ka[Oi],Ka[Oi]=null,Oi--)}function ue(e,t){Oi++,Ka[Oi]=e.current,e.current=t}var qr={},rt=Gr(qr),ft=Gr(!1),fi=qr;function Qi(e,t){var r=e.type.contextTypes;if(!r)return qr;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var s={},n;for(n in r)s[n]=t[n];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function _t(e){return e=e.childContextTypes,e!=null}function Mo(){_e(ft),_e(rt)}function td(e,t,r){if(rt.current!==qr)throw Error(B(168));ue(rt,t),ue(ft,r)}function ep(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!="function")return r;i=i.getChildContext();for(var s in i)if(!(s in t))throw Error(B(108,Zv(e)||"Unknown",s));return xe({},r,i)}function No(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qr,fi=rt.current,ue(rt,e),ue(ft,ft.current),!0}function rd(e,t,r){var i=e.stateNode;if(!i)throw Error(B(169));r?(e=ep(e,t,fi),i.__reactInternalMemoizedMergedChildContext=e,_e(ft),_e(rt),ue(rt,e)):_e(ft),ue(ft,r)}var cr=null,al=!1,Ul=!1;function tp(e){cr===null?cr=[e]:cr.push(e)}function my(e){al=!0,tp(e)}function Qr(){if(!Ul&&cr!==null){Ul=!0;var e=0,t=oe;try{var r=cr;for(oe=1;e<r.length;e++){var i=r[e];do i=i(!0);while(i!==null)}cr=null,al=!1}catch(s){throw cr!==null&&(cr=cr.slice(e+1)),E_(yh,Qr),s}finally{oe=t,Ul=!1}}return null}var Ai=[],Ii=0,Bo=null,Oo=0,Dt=[],Tt=0,_i=null,hr=1,ur="";function ei(e,t){Ai[Ii++]=Oo,Ai[Ii++]=Bo,Bo=e,Oo=t}function rp(e,t,r){Dt[Tt++]=hr,Dt[Tt++]=ur,Dt[Tt++]=_i,_i=e;var i=hr;e=ur;var s=32-Wt(i)-1;i&=~(1<<s),r+=1;var n=32-Wt(t)+s;if(30<n){var o=s-s%5;n=(i&(1<<o)-1).toString(32),i>>=o,s-=o,hr=1<<32-Wt(t)+s|r<<s|i,ur=n+e}else hr=1<<n|r<<s|i,ur=e}function Lh(e){e.return!==null&&(ei(e,1),rp(e,1,0))}function Dh(e){for(;e===Bo;)Bo=Ai[--Ii],Ai[Ii]=null,Oo=Ai[--Ii],Ai[Ii]=null;for(;e===_i;)_i=Dt[--Tt],Dt[Tt]=null,ur=Dt[--Tt],Dt[Tt]=null,hr=Dt[--Tt],Dt[Tt]=null}var St=null,yt=null,pe=!1,Ft=null;function ip(e,t){var r=Rt(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function id(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,St=e,yt=$r(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,St=e,yt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=_i!==null?{id:hr,overflow:ur}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Rt(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,St=e,yt=null,!0):!1;default:return!1}}function Va(e){return(e.mode&1)!==0&&(e.flags&128)===0}function qa(e){if(pe){var t=yt;if(t){var r=t;if(!id(e,t)){if(Va(e))throw Error(B(418));t=$r(r.nextSibling);var i=St;t&&id(e,t)?ip(i,r):(e.flags=e.flags&-4097|2,pe=!1,St=e)}}else{if(Va(e))throw Error(B(418));e.flags=e.flags&-4097|2,pe=!1,St=e}}}function sd(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;St=e}function zn(e){if(e!==St)return!1;if(!pe)return sd(e),pe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Wa(e.type,e.memoizedProps)),t&&(t=yt)){if(Va(e))throw sp(),Error(B(418));for(;t;)ip(e,t),t=$r(t.nextSibling)}if(sd(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(B(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){yt=$r(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}yt=null}}else yt=St?$r(e.stateNode.nextSibling):null;return!0}function sp(){for(var e=yt;e;)e=$r(e.nextSibling)}function Ji(){yt=St=null,pe=!1}function Th(e){Ft===null?Ft=[e]:Ft.push(e)}var vy=gr.ReactCurrentBatchConfig;function vs(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(B(309));var i=r.stateNode}if(!i)throw Error(B(147,e));var s=i,n=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===n?t.ref:(t=function(o){var l=s.refs;o===null?delete l[n]:l[n]=o},t._stringRef=n,t)}if(typeof e!="string")throw Error(B(284));if(!r._owner)throw Error(B(290,e))}return e}function jn(e,t){throw e=Object.prototype.toString.call(t),Error(B(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function nd(e){var t=e._init;return t(e._payload)}function np(e){function t(f,v){if(e){var y=f.deletions;y===null?(f.deletions=[v],f.flags|=16):y.push(v)}}function r(f,v){if(!e)return null;for(;v!==null;)t(f,v),v=v.sibling;return null}function i(f,v){for(f=new Map;v!==null;)v.key!==null?f.set(v.key,v):f.set(v.index,v),v=v.sibling;return f}function s(f,v){return f=Ur(f,v),f.index=0,f.sibling=null,f}function n(f,v,y){return f.index=y,e?(y=f.alternate,y!==null?(y=y.index,y<v?(f.flags|=2,v):y):(f.flags|=2,v)):(f.flags|=1048576,v)}function o(f){return e&&f.alternate===null&&(f.flags|=2),f}function l(f,v,y,S){return v===null||v.tag!==6?(v=Ql(y,f.mode,S),v.return=f,v):(v=s(v,y),v.return=f,v)}function a(f,v,y,S){var C=y.type;return C===Ti?u(f,v,y.props.children,S,y.key):v!==null&&(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Lr&&nd(C)===v.type)?(S=s(v,y.props),S.ref=vs(f,v,y),S.return=f,S):(S=uo(y.type,y.key,y.props,null,f.mode,S),S.ref=vs(f,v,y),S.return=f,S)}function c(f,v,y,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==y.containerInfo||v.stateNode.implementation!==y.implementation?(v=Jl(y,f.mode,S),v.return=f,v):(v=s(v,y.children||[]),v.return=f,v)}function u(f,v,y,S,C){return v===null||v.tag!==7?(v=ci(y,f.mode,S,C),v.return=f,v):(v=s(v,y),v.return=f,v)}function h(f,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Ql(""+v,f.mode,y),v.return=f,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ln:return y=uo(v.type,v.key,v.props,null,f.mode,y),y.ref=vs(f,null,v),y.return=f,y;case Di:return v=Jl(v,f.mode,y),v.return=f,v;case Lr:var S=v._init;return h(f,S(v._payload),y)}if(Ls(v)||ds(v))return v=ci(v,f.mode,y,null),v.return=f,v;jn(f,v)}return null}function d(f,v,y,S){var C=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return C!==null?null:l(f,v,""+y,S);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Ln:return y.key===C?a(f,v,y,S):null;case Di:return y.key===C?c(f,v,y,S):null;case Lr:return C=y._init,d(f,v,C(y._payload),S)}if(Ls(y)||ds(y))return C!==null?null:u(f,v,y,S,null);jn(f,y)}return null}function m(f,v,y,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return f=f.get(y)||null,l(v,f,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Ln:return f=f.get(S.key===null?y:S.key)||null,a(v,f,S,C);case Di:return f=f.get(S.key===null?y:S.key)||null,c(v,f,S,C);case Lr:var P=S._init;return m(f,v,y,P(S._payload),C)}if(Ls(S)||ds(S))return f=f.get(y)||null,u(v,f,S,C,null);jn(v,S)}return null}function p(f,v,y,S){for(var C=null,P=null,M=v,z=v=0,Y=null;M!==null&&z<y.length;z++){M.index>z?(Y=M,M=null):Y=M.sibling;var U=d(f,M,y[z],S);if(U===null){M===null&&(M=Y);break}e&&M&&U.alternate===null&&t(f,M),v=n(U,v,z),P===null?C=U:P.sibling=U,P=U,M=Y}if(z===y.length)return r(f,M),pe&&ei(f,z),C;if(M===null){for(;z<y.length;z++)M=h(f,y[z],S),M!==null&&(v=n(M,v,z),P===null?C=M:P.sibling=M,P=M);return pe&&ei(f,z),C}for(M=i(f,M);z<y.length;z++)Y=m(M,f,z,y[z],S),Y!==null&&(e&&Y.alternate!==null&&M.delete(Y.key===null?z:Y.key),v=n(Y,v,z),P===null?C=Y:P.sibling=Y,P=Y);return e&&M.forEach(function(q){return t(f,q)}),pe&&ei(f,z),C}function g(f,v,y,S){var C=ds(y);if(typeof C!="function")throw Error(B(150));if(y=C.call(y),y==null)throw Error(B(151));for(var P=C=null,M=v,z=v=0,Y=null,U=y.next();M!==null&&!U.done;z++,U=y.next()){M.index>z?(Y=M,M=null):Y=M.sibling;var q=d(f,M,U.value,S);if(q===null){M===null&&(M=Y);break}e&&M&&q.alternate===null&&t(f,M),v=n(q,v,z),P===null?C=q:P.sibling=q,P=q,M=Y}if(U.done)return r(f,M),pe&&ei(f,z),C;if(M===null){for(;!U.done;z++,U=y.next())U=h(f,U.value,S),U!==null&&(v=n(U,v,z),P===null?C=U:P.sibling=U,P=U);return pe&&ei(f,z),C}for(M=i(f,M);!U.done;z++,U=y.next())U=m(M,f,z,U.value,S),U!==null&&(e&&U.alternate!==null&&M.delete(U.key===null?z:U.key),v=n(U,v,z),P===null?C=U:P.sibling=U,P=U);return e&&M.forEach(function(L){return t(f,L)}),pe&&ei(f,z),C}function w(f,v,y,S){if(typeof y=="object"&&y!==null&&y.type===Ti&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Ln:e:{for(var C=y.key,P=v;P!==null;){if(P.key===C){if(C=y.type,C===Ti){if(P.tag===7){r(f,P.sibling),v=s(P,y.props.children),v.return=f,f=v;break e}}else if(P.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Lr&&nd(C)===P.type){r(f,P.sibling),v=s(P,y.props),v.ref=vs(f,P,y),v.return=f,f=v;break e}r(f,P);break}else t(f,P);P=P.sibling}y.type===Ti?(v=ci(y.props.children,f.mode,S,y.key),v.return=f,f=v):(S=uo(y.type,y.key,y.props,null,f.mode,S),S.ref=vs(f,v,y),S.return=f,f=S)}return o(f);case Di:e:{for(P=y.key;v!==null;){if(v.key===P)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){r(f,v.sibling),v=s(v,y.children||[]),v.return=f,f=v;break e}else{r(f,v);break}else t(f,v);v=v.sibling}v=Jl(y,f.mode,S),v.return=f,f=v}return o(f);case Lr:return P=y._init,w(f,v,P(y._payload),S)}if(Ls(y))return p(f,v,y,S);if(ds(y))return g(f,v,y,S);jn(f,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(r(f,v.sibling),v=s(v,y),v.return=f,f=v):(r(f,v),v=Ql(y,f.mode,S),v.return=f,f=v),o(f)):r(f,v)}return w}var Zi=np(!0),op=np(!1),Ao=Gr(null),Io=null,zi=null,Rh=null;function Mh(){Rh=zi=Io=null}function Nh(e){var t=Ao.current;_e(Ao),e._currentValue=t}function Ya(e,t,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function qi(e,t){Io=e,Rh=zi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(dt=!0),e.firstContext=null)}function Bt(e){var t=e._currentValue;if(Rh!==e)if(e={context:e,memoizedValue:t,next:null},zi===null){if(Io===null)throw Error(B(308));zi=e,Io.dependencies={lanes:0,firstContext:e}}else zi=zi.next=e;return t}var ni=null;function Bh(e){ni===null?ni=[e]:ni.push(e)}function lp(e,t,r,i){var s=t.interleaved;return s===null?(r.next=r,Bh(t)):(r.next=s.next,s.next=r),t.interleaved=r,mr(e,i)}function mr(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Dr=!1;function Oh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ap(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 fr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Fr(e,t,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,Z&2){var s=i.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),i.pending=t,mr(e,r)}return s=i.interleaved,s===null?(t.next=t,Bh(i)):(t.next=s.next,s.next=t),i.interleaved=t,mr(e,r)}function no(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Sh(e,r)}}function od(e,t){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var s=null,n=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};n===null?s=n=o:n=n.next=o,r=r.next}while(r!==null);n===null?s=n=t:n=n.next=t}else s=n=t;r={baseState:i.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:i.shared,effects:i.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function zo(e,t,r,i){var s=e.updateQueue;Dr=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var a=l,c=a.next;a.next=null,o===null?n=c:o.next=c,o=a;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=c:l.next=c,u.lastBaseUpdate=a))}if(n!==null){var h=s.baseState;o=0,u=c=a=null,l=n;do{var d=l.lane,m=l.eventTime;if((i&d)===d){u!==null&&(u=u.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=e,g=l;switch(d=t,m=r,g.tag){case 1:if(p=g.payload,typeof p=="function"){h=p.call(m,h,d);break e}h=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=g.payload,d=typeof p=="function"?p.call(m,h,d):p,d==null)break e;h=xe({},h,d);break e;case 2:Dr=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,d=s.effects,d===null?s.effects=[l]:d.push(l))}else m={eventTime:m,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(c=u=m,a=h):u=u.next=m,o|=d;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;d=l,l=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(u===null&&(a=h),s.baseState=a,s.firstBaseUpdate=c,s.lastBaseUpdate=u,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else n===null&&(s.shared.lanes=0);mi|=o,e.lanes=o,e.memoizedState=h}}function ld(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],s=i.callback;if(s!==null){if(i.callback=null,i=r,typeof s!="function")throw Error(B(191,s));s.call(i)}}}var Sn={},ir=Gr(Sn),on=Gr(Sn),ln=Gr(Sn);function oi(e){if(e===Sn)throw Error(B(174));return e}function Ah(e,t){switch(ue(ln,t),ue(on,e),ue(ir,Sn),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:La(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=La(t,e)}_e(ir),ue(ir,t)}function es(){_e(ir),_e(on),_e(ln)}function cp(e){oi(ln.current);var t=oi(ir.current),r=La(t,e.type);t!==r&&(ue(on,e),ue(ir,r))}function Ih(e){on.current===e&&(_e(ir),_e(on))}var Se=Gr(0);function jo(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Kl=[];function zh(){for(var e=0;e<Kl.length;e++)Kl[e]._workInProgressVersionPrimary=null;Kl.length=0}var oo=gr.ReactCurrentDispatcher,Vl=gr.ReactCurrentBatchConfig,pi=0,we=null,Oe=null,$e=null,$o=!1,Fs=!1,an=0,gy=0;function Je(){throw Error(B(321))}function jh(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Ut(e[r],t[r]))return!1;return!0}function $h(e,t,r,i,s,n){if(pi=n,we=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,oo.current=e===null||e.memoizedState===null?xy:Cy,e=r(i,s),Fs){n=0;do{if(Fs=!1,an=0,25<=n)throw Error(B(301));n+=1,$e=Oe=null,t.updateQueue=null,oo.current=by,e=r(i,s)}while(Fs)}if(oo.current=Fo,t=Oe!==null&&Oe.next!==null,pi=0,$e=Oe=we=null,$o=!1,t)throw Error(B(300));return e}function Fh(){var e=an!==0;return an=0,e}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $e===null?we.memoizedState=$e=e:$e=$e.next=e,$e}function Ot(){if(Oe===null){var e=we.alternate;e=e!==null?e.memoizedState:null}else e=Oe.next;var t=$e===null?we.memoizedState:$e.next;if(t!==null)$e=t,Oe=e;else{if(e===null)throw Error(B(310));Oe=e,e={memoizedState:Oe.memoizedState,baseState:Oe.baseState,baseQueue:Oe.baseQueue,queue:Oe.queue,next:null},$e===null?we.memoizedState=$e=e:$e=$e.next=e}return $e}function cn(e,t){return typeof t=="function"?t(e):t}function ql(e){var t=Ot(),r=t.queue;if(r===null)throw Error(B(311));r.lastRenderedReducer=e;var i=Oe,s=i.baseQueue,n=r.pending;if(n!==null){if(s!==null){var o=s.next;s.next=n.next,n.next=o}i.baseQueue=s=n,r.pending=null}if(s!==null){n=s.next,i=i.baseState;var l=o=null,a=null,c=n;do{var u=c.lane;if((pi&u)===u)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:e(i,c.action);else{var h={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=h,o=i):a=a.next=h,we.lanes|=u,mi|=u}c=c.next}while(c!==null&&c!==n);a===null?o=i:a.next=l,Ut(i,t.memoizedState)||(dt=!0),t.memoizedState=i,t.baseState=o,t.baseQueue=a,r.lastRenderedState=i}if(e=r.interleaved,e!==null){s=e;do n=s.lane,we.lanes|=n,mi|=n,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Yl(e){var t=Ot(),r=t.queue;if(r===null)throw Error(B(311));r.lastRenderedReducer=e;var i=r.dispatch,s=r.pending,n=t.memoizedState;if(s!==null){r.pending=null;var o=s=s.next;do n=e(n,o.action),o=o.next;while(o!==s);Ut(n,t.memoizedState)||(dt=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),r.lastRenderedState=n}return[n,i]}function hp(){}function up(e,t){var r=we,i=Ot(),s=t(),n=!Ut(i.memoizedState,s);if(n&&(i.memoizedState=s,dt=!0),i=i.queue,Wh(_p.bind(null,r,i,e),[e]),i.getSnapshot!==t||n||$e!==null&&$e.memoizedState.tag&1){if(r.flags|=2048,hn(9,fp.bind(null,r,i,s,t),void 0,null),Ue===null)throw Error(B(349));pi&30||dp(r,t,s)}return s}function dp(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=we.updateQueue,t===null?(t={lastEffect:null,stores:null},we.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function fp(e,t,r,i){t.value=r,t.getSnapshot=i,pp(t)&&mp(e)}function _p(e,t,r){return r(function(){pp(t)&&mp(e)})}function pp(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Ut(e,r)}catch{return!0}}function mp(e){var t=mr(e,1);t!==null&&Ht(t,e,1,-1)}function ad(e){var t=Jt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:cn,lastRenderedState:e},t.queue=e,e=e.dispatch=wy.bind(null,we,e),[t.memoizedState,e]}function hn(e,t,r,i){return e={tag:e,create:t,destroy:r,deps:i,next:null},t=we.updateQueue,t===null?(t={lastEffect:null,stores:null},we.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,t.lastEffect=e)),e}function vp(){return Ot().memoizedState}function lo(e,t,r,i){var s=Jt();we.flags|=e,s.memoizedState=hn(1|t,r,void 0,i===void 0?null:i)}function cl(e,t,r,i){var s=Ot();i=i===void 0?null:i;var n=void 0;if(Oe!==null){var o=Oe.memoizedState;if(n=o.destroy,i!==null&&jh(i,o.deps)){s.memoizedState=hn(t,r,n,i);return}}we.flags|=e,s.memoizedState=hn(1|t,r,n,i)}function cd(e,t){return lo(8390656,8,e,t)}function Wh(e,t){return cl(2048,8,e,t)}function gp(e,t){return cl(4,2,e,t)}function yp(e,t){return cl(4,4,e,t)}function Sp(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function wp(e,t,r){return r=r!=null?r.concat([e]):null,cl(4,4,Sp.bind(null,t,e),r)}function Hh(){}function xp(e,t){var r=Ot();t=t===void 0?null:t;var i=r.memoizedState;return i!==null&&t!==null&&jh(t,i[1])?i[0]:(r.memoizedState=[e,t],e)}function Cp(e,t){var r=Ot();t=t===void 0?null:t;var i=r.memoizedState;return i!==null&&t!==null&&jh(t,i[1])?i[0]:(e=e(),r.memoizedState=[e,t],e)}function bp(e,t,r){return pi&21?(Ut(r,t)||(r=D_(),we.lanes|=r,mi|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,dt=!0),e.memoizedState=r)}function yy(e,t){var r=oe;oe=r!==0&&4>r?r:4,e(!0);var i=Vl.transition;Vl.transition={};try{e(!1),t()}finally{oe=r,Vl.transition=i}}function kp(){return Ot().memoizedState}function Sy(e,t,r){var i=Hr(e);if(r={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null},Ep(e))Pp(t,r);else if(r=lp(e,t,r,i),r!==null){var s=nt();Ht(r,e,i,s),Lp(r,t,i)}}function wy(e,t,r){var i=Hr(e),s={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null};if(Ep(e))Pp(t,s);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var o=t.lastRenderedState,l=n(o,r);if(s.hasEagerState=!0,s.eagerState=l,Ut(l,o)){var a=t.interleaved;a===null?(s.next=s,Bh(t)):(s.next=a.next,a.next=s),t.interleaved=s;return}}catch{}finally{}r=lp(e,t,s,i),r!==null&&(s=nt(),Ht(r,e,i,s),Lp(r,t,i))}}function Ep(e){var t=e.alternate;return e===we||t!==null&&t===we}function Pp(e,t){Fs=$o=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Lp(e,t,r){if(r&4194240){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Sh(e,r)}}var Fo={readContext:Bt,useCallback:Je,useContext:Je,useEffect:Je,useImperativeHandle:Je,useInsertionEffect:Je,useLayoutEffect:Je,useMemo:Je,useReducer:Je,useRef:Je,useState:Je,useDebugValue:Je,useDeferredValue:Je,useTransition:Je,useMutableSource:Je,useSyncExternalStore:Je,useId:Je,unstable_isNewReconciler:!1},xy={readContext:Bt,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:Bt,useEffect:cd,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,lo(4194308,4,Sp.bind(null,t,e),r)},useLayoutEffect:function(e,t){return lo(4194308,4,e,t)},useInsertionEffect:function(e,t){return lo(4,2,e,t)},useMemo:function(e,t){var r=Jt();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var i=Jt();return t=r!==void 0?r(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=Sy.bind(null,we,e),[i.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:ad,useDebugValue:Hh,useDeferredValue:function(e){return Jt().memoizedState=e},useTransition:function(){var e=ad(!1),t=e[0];return e=yy.bind(null,e[1]),Jt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=we,s=Jt();if(pe){if(r===void 0)throw Error(B(407));r=r()}else{if(r=t(),Ue===null)throw Error(B(349));pi&30||dp(i,t,r)}s.memoizedState=r;var n={value:r,getSnapshot:t};return s.queue=n,cd(_p.bind(null,i,n,e),[e]),i.flags|=2048,hn(9,fp.bind(null,i,n,r,t),void 0,null),r},useId:function(){var e=Jt(),t=Ue.identifierPrefix;if(pe){var r=ur,i=hr;r=(i&~(1<<32-Wt(i)-1)).toString(32)+r,t=":"+t+"R"+r,r=an++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=gy++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Cy={readContext:Bt,useCallback:xp,useContext:Bt,useEffect:Wh,useImperativeHandle:wp,useInsertionEffect:gp,useLayoutEffect:yp,useMemo:Cp,useReducer:ql,useRef:vp,useState:function(){return ql(cn)},useDebugValue:Hh,useDeferredValue:function(e){var t=Ot();return bp(t,Oe.memoizedState,e)},useTransition:function(){var e=ql(cn)[0],t=Ot().memoizedState;return[e,t]},useMutableSource:hp,useSyncExternalStore:up,useId:kp,unstable_isNewReconciler:!1},by={readContext:Bt,useCallback:xp,useContext:Bt,useEffect:Wh,useImperativeHandle:wp,useInsertionEffect:gp,useLayoutEffect:yp,useMemo:Cp,useReducer:Yl,useRef:vp,useState:function(){return Yl(cn)},useDebugValue:Hh,useDeferredValue:function(e){var t=Ot();return Oe===null?t.memoizedState=e:bp(t,Oe.memoizedState,e)},useTransition:function(){var e=Yl(cn)[0],t=Ot().memoizedState;return[e,t]},useMutableSource:hp,useSyncExternalStore:up,useId:kp,unstable_isNewReconciler:!1};function jt(e,t){if(e&&e.defaultProps){t=xe({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Xa(e,t,r,i){t=e.memoizedState,r=r(i,t),r=r==null?t:xe({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var hl={isMounted:function(e){return(e=e._reactInternals)?xi(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var i=nt(),s=Hr(e),n=fr(i,s);n.payload=t,r!=null&&(n.callback=r),t=Fr(e,n,s),t!==null&&(Ht(t,e,s,i),no(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var i=nt(),s=Hr(e),n=fr(i,s);n.tag=1,n.payload=t,r!=null&&(n.callback=r),t=Fr(e,n,s),t!==null&&(Ht(t,e,s,i),no(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=nt(),i=Hr(e),s=fr(r,i);s.tag=2,t!=null&&(s.callback=t),t=Fr(e,s,i),t!==null&&(Ht(t,e,i,r),no(t,e,i))}};function hd(e,t,r,i,s,n,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,n,o):t.prototype&&t.prototype.isPureReactComponent?!tn(r,i)||!tn(s,n):!0}function Dp(e,t,r){var i=!1,s=qr,n=t.contextType;return typeof n=="object"&&n!==null?n=Bt(n):(s=_t(t)?fi:rt.current,i=t.contextTypes,n=(i=i!=null)?Qi(e,s):qr),t=new t(r,n),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=hl,e.stateNode=t,t._reactInternals=e,i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=n),t}function ud(e,t,r,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,i),t.state!==e&&hl.enqueueReplaceState(t,t.state,null)}function Ga(e,t,r,i){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},Oh(e);var n=t.contextType;typeof n=="object"&&n!==null?s.context=Bt(n):(n=_t(t)?fi:rt.current,s.context=Qi(e,n)),s.state=e.memoizedState,n=t.getDerivedStateFromProps,typeof n=="function"&&(Xa(e,t,n,r),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&hl.enqueueReplaceState(s,s.state,null),zo(e,r,s,i),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function ts(e,t){try{var r="",i=t;do r+=Jv(i),i=i.return;while(i);var s=r}catch(n){s=`
|
|
39
|
+
Error generating stack: `+n.message+`
|
|
40
|
+
`+n.stack}return{value:e,source:t,stack:s,digest:null}}function Xl(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Qa(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var ky=typeof WeakMap=="function"?WeakMap:Map;function Tp(e,t,r){r=fr(-1,r),r.tag=3,r.payload={element:null};var i=t.value;return r.callback=function(){Ho||(Ho=!0,lc=i),Qa(e,t)},r}function Rp(e,t,r){r=fr(-1,r),r.tag=3;var i=e.type.getDerivedStateFromError;if(typeof i=="function"){var s=t.value;r.payload=function(){return i(s)},r.callback=function(){Qa(e,t)}}var n=e.stateNode;return n!==null&&typeof n.componentDidCatch=="function"&&(r.callback=function(){Qa(e,t),typeof i!="function"&&(Wr===null?Wr=new Set([this]):Wr.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function dd(e,t,r){var i=e.pingCache;if(i===null){i=e.pingCache=new ky;var s=new Set;i.set(t,s)}else s=i.get(t),s===void 0&&(s=new Set,i.set(t,s));s.has(r)||(s.add(r),e=jy.bind(null,e,t,r),t.then(e,e))}function fd(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function _d(e,t,r,i,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=fr(-1,1),t.tag=2,Fr(r,t,1))),r.lanes|=1),e)}var Ey=gr.ReactCurrentOwner,dt=!1;function st(e,t,r,i){t.child=e===null?op(t,null,r,i):Zi(t,e.child,r,i)}function pd(e,t,r,i,s){r=r.render;var n=t.ref;return qi(t,s),i=$h(e,t,r,i,n,s),r=Fh(),e!==null&&!dt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vr(e,t,s)):(pe&&r&&Lh(t),t.flags|=1,st(e,t,i,s),t.child)}function md(e,t,r,i,s){if(e===null){var n=r.type;return typeof n=="function"&&!Qh(n)&&n.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=n,Mp(e,t,n,i,s)):(e=uo(r.type,null,i,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!(e.lanes&s)){var o=n.memoizedProps;if(r=r.compare,r=r!==null?r:tn,r(o,i)&&e.ref===t.ref)return vr(e,t,s)}return t.flags|=1,e=Ur(n,i),e.ref=t.ref,e.return=t,t.child=e}function Mp(e,t,r,i,s){if(e!==null){var n=e.memoizedProps;if(tn(n,i)&&e.ref===t.ref)if(dt=!1,t.pendingProps=i=n,(e.lanes&s)!==0)e.flags&131072&&(dt=!0);else return t.lanes=e.lanes,vr(e,t,s)}return Ja(e,t,r,i,s)}function Np(e,t,r){var i=t.pendingProps,s=i.children,n=e!==null?e.memoizedState:null;if(i.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ue($i,gt),gt|=r;else{if(!(r&1073741824))return e=n!==null?n.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ue($i,gt),gt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=n!==null?n.baseLanes:r,ue($i,gt),gt|=i}else n!==null?(i=n.baseLanes|r,t.memoizedState=null):i=r,ue($i,gt),gt|=i;return st(e,t,s,r),t.child}function Bp(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ja(e,t,r,i,s){var n=_t(r)?fi:rt.current;return n=Qi(t,n),qi(t,s),r=$h(e,t,r,i,n,s),i=Fh(),e!==null&&!dt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vr(e,t,s)):(pe&&i&&Lh(t),t.flags|=1,st(e,t,r,s),t.child)}function vd(e,t,r,i,s){if(_t(r)){var n=!0;No(t)}else n=!1;if(qi(t,s),t.stateNode===null)ao(e,t),Dp(t,r,i),Ga(t,r,i,s),i=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,c=r.contextType;typeof c=="object"&&c!==null?c=Bt(c):(c=_t(r)?fi:rt.current,c=Qi(t,c));var u=r.getDerivedStateFromProps,h=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==i||a!==c)&&ud(t,o,i,c),Dr=!1;var d=t.memoizedState;o.state=d,zo(t,i,o,s),a=t.memoizedState,l!==i||d!==a||ft.current||Dr?(typeof u=="function"&&(Xa(t,r,u,i),a=t.memoizedState),(l=Dr||hd(t,r,l,i,d,a,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=a),o.props=i,o.state=a,o.context=c,i=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{o=t.stateNode,ap(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:jt(t.type,l),o.props=c,h=t.pendingProps,d=o.context,a=r.contextType,typeof a=="object"&&a!==null?a=Bt(a):(a=_t(r)?fi:rt.current,a=Qi(t,a));var m=r.getDerivedStateFromProps;(u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||d!==a)&&ud(t,o,i,a),Dr=!1,d=t.memoizedState,o.state=d,zo(t,i,o,s);var p=t.memoizedState;l!==h||d!==p||ft.current||Dr?(typeof m=="function"&&(Xa(t,r,m,i),p=t.memoizedState),(c=Dr||hd(t,r,c,i,d,p,a)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,p,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,p,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=p),o.props=i,o.state=p,o.context=a,i=c):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),i=!1)}return Za(e,t,r,i,n,s)}function Za(e,t,r,i,s,n){Bp(e,t);var o=(t.flags&128)!==0;if(!i&&!o)return s&&rd(t,r,!1),vr(e,t,n);i=t.stateNode,Ey.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:i.render();return t.flags|=1,e!==null&&o?(t.child=Zi(t,e.child,null,n),t.child=Zi(t,null,l,n)):st(e,t,l,n),t.memoizedState=i.state,s&&rd(t,r,!0),t.child}function Op(e){var t=e.stateNode;t.pendingContext?td(e,t.pendingContext,t.pendingContext!==t.context):t.context&&td(e,t.context,!1),Ah(e,t.containerInfo)}function gd(e,t,r,i,s){return Ji(),Th(s),t.flags|=256,st(e,t,r,i),t.child}var ec={dehydrated:null,treeContext:null,retryLane:0};function tc(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ap(e,t,r){var i=t.pendingProps,s=Se.current,n=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(n=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),ue(Se,s&1),e===null)return qa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=i.children,e=i.fallback,n?(i=t.mode,n=t.child,o={mode:"hidden",children:o},!(i&1)&&n!==null?(n.childLanes=0,n.pendingProps=o):n=fl(o,i,0,null),e=ci(e,i,r,null),n.return=t,e.return=t,n.sibling=e,t.child=n,t.child.memoizedState=tc(r),t.memoizedState=ec,e):Uh(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Py(e,t,o,i,l,s,r);if(n){n=i.fallback,o=t.mode,s=e.child,l=s.sibling;var a={mode:"hidden",children:i.children};return!(o&1)&&t.child!==s?(i=t.child,i.childLanes=0,i.pendingProps=a,t.deletions=null):(i=Ur(s,a),i.subtreeFlags=s.subtreeFlags&14680064),l!==null?n=Ur(l,n):(n=ci(n,o,r,null),n.flags|=2),n.return=t,i.return=t,i.sibling=n,t.child=i,i=n,n=t.child,o=e.child.memoizedState,o=o===null?tc(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},n.memoizedState=o,n.childLanes=e.childLanes&~r,t.memoizedState=ec,i}return n=e.child,e=n.sibling,i=Ur(n,{mode:"visible",children:i.children}),!(t.mode&1)&&(i.lanes=r),i.return=t,i.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=i,t.memoizedState=null,i}function Uh(e,t){return t=fl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function $n(e,t,r,i){return i!==null&&Th(i),Zi(t,e.child,null,r),e=Uh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Py(e,t,r,i,s,n,o){if(r)return t.flags&256?(t.flags&=-257,i=Xl(Error(B(422))),$n(e,t,o,i)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(n=i.fallback,s=t.mode,i=fl({mode:"visible",children:i.children},s,0,null),n=ci(n,s,o,null),n.flags|=2,i.return=t,n.return=t,i.sibling=n,t.child=i,t.mode&1&&Zi(t,e.child,null,o),t.child.memoizedState=tc(o),t.memoizedState=ec,n);if(!(t.mode&1))return $n(e,t,o,null);if(s.data==="$!"){if(i=s.nextSibling&&s.nextSibling.dataset,i)var l=i.dgst;return i=l,n=Error(B(419)),i=Xl(n,i,void 0),$n(e,t,o,i)}if(l=(o&e.childLanes)!==0,dt||l){if(i=Ue,i!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(i.suspendedLanes|o)?0:s,s!==0&&s!==n.retryLane&&(n.retryLane=s,mr(e,s),Ht(i,e,s,-1))}return Gh(),i=Xl(Error(B(421))),$n(e,t,o,i)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=$y.bind(null,e),s._reactRetry=t,null):(e=n.treeContext,yt=$r(s.nextSibling),St=t,pe=!0,Ft=null,e!==null&&(Dt[Tt++]=hr,Dt[Tt++]=ur,Dt[Tt++]=_i,hr=e.id,ur=e.overflow,_i=t),t=Uh(t,i.children),t.flags|=4096,t)}function yd(e,t,r){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Ya(e.return,t,r)}function Gl(e,t,r,i,s){var n=e.memoizedState;n===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:s}:(n.isBackwards=t,n.rendering=null,n.renderingStartTime=0,n.last=i,n.tail=r,n.tailMode=s)}function Ip(e,t,r){var i=t.pendingProps,s=i.revealOrder,n=i.tail;if(st(e,t,i.children,r),i=Se.current,i&2)i=i&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yd(e,r,t);else if(e.tag===19)yd(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}i&=1}if(ue(Se,i),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(r=t.child,s=null;r!==null;)e=r.alternate,e!==null&&jo(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),Gl(t,!1,s,r,n);break;case"backwards":for(r=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&jo(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}Gl(t,!0,r,null,n);break;case"together":Gl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ao(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function vr(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),mi|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(B(153));if(t.child!==null){for(e=t.child,r=Ur(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Ur(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Ly(e,t,r){switch(t.tag){case 3:Op(t),Ji();break;case 5:cp(t);break;case 1:_t(t.type)&&No(t);break;case 4:Ah(t,t.stateNode.containerInfo);break;case 10:var i=t.type._context,s=t.memoizedProps.value;ue(Ao,i._currentValue),i._currentValue=s;break;case 13:if(i=t.memoizedState,i!==null)return i.dehydrated!==null?(ue(Se,Se.current&1),t.flags|=128,null):r&t.child.childLanes?Ap(e,t,r):(ue(Se,Se.current&1),e=vr(e,t,r),e!==null?e.sibling:null);ue(Se,Se.current&1);break;case 19:if(i=(r&t.childLanes)!==0,e.flags&128){if(i)return Ip(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ue(Se,Se.current),i)break;return null;case 22:case 23:return t.lanes=0,Np(e,t,r)}return vr(e,t,r)}var zp,rc,jp,$p;zp=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};rc=function(){};jp=function(e,t,r,i){var s=e.memoizedProps;if(s!==i){e=t.stateNode,oi(ir.current);var n=null;switch(r){case"input":s=ba(e,s),i=ba(e,i),n=[];break;case"select":s=xe({},s,{value:void 0}),i=xe({},i,{value:void 0}),n=[];break;case"textarea":s=Pa(e,s),i=Pa(e,i),n=[];break;default:typeof s.onClick!="function"&&typeof i.onClick=="function"&&(e.onclick=Ro)}Da(r,i);var o;r=null;for(c in s)if(!i.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var l=s[c];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ys.hasOwnProperty(c)?n||(n=[]):(n=n||[]).push(c,null));for(c in i){var a=i[c];if(l=s!=null?s[c]:void 0,i.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(r||(r={}),r[o]=a[o])}else r||(n||(n=[]),n.push(c,r)),r=a;else c==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(n=n||[]).push(c,a)):c==="children"?typeof a!="string"&&typeof a!="number"||(n=n||[]).push(c,""+a):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ys.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&de("scroll",e),n||l===a||(n=[])):(n=n||[]).push(c,a))}r&&(n=n||[]).push("style",r);var c=n;(t.updateQueue=c)&&(t.flags|=4)}};$p=function(e,t,r,i){r!==i&&(t.flags|=4)};function gs(e,t){if(!pe)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,i=0;if(t)for(var s=e.child;s!==null;)r|=s.lanes|s.childLanes,i|=s.subtreeFlags&14680064,i|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)r|=s.lanes|s.childLanes,i|=s.subtreeFlags,i|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=i,e.childLanes=r,t}function Dy(e,t,r){var i=t.pendingProps;switch(Dh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return _t(t.type)&&Mo(),Ze(t),null;case 3:return i=t.stateNode,es(),_e(ft),_e(rt),zh(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(zn(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ft!==null&&(hc(Ft),Ft=null))),rc(e,t),Ze(t),null;case 5:Ih(t);var s=oi(ln.current);if(r=t.type,e!==null&&t.stateNode!=null)jp(e,t,r,i,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(B(166));return Ze(t),null}if(e=oi(ir.current),zn(t)){i=t.stateNode,r=t.type;var n=t.memoizedProps;switch(i[er]=t,i[nn]=n,e=(t.mode&1)!==0,r){case"dialog":de("cancel",i),de("close",i);break;case"iframe":case"object":case"embed":de("load",i);break;case"video":case"audio":for(s=0;s<Ts.length;s++)de(Ts[s],i);break;case"source":de("error",i);break;case"img":case"image":case"link":de("error",i),de("load",i);break;case"details":de("toggle",i);break;case"input":Lu(i,n),de("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!n.multiple},de("invalid",i);break;case"textarea":Tu(i,n),de("invalid",i)}Da(r,n),s=null;for(var o in n)if(n.hasOwnProperty(o)){var l=n[o];o==="children"?typeof l=="string"?i.textContent!==l&&(n.suppressHydrationWarning!==!0&&In(i.textContent,l,e),s=["children",l]):typeof l=="number"&&i.textContent!==""+l&&(n.suppressHydrationWarning!==!0&&In(i.textContent,l,e),s=["children",""+l]):Ys.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&de("scroll",i)}switch(r){case"input":Dn(i),Du(i,n,!0);break;case"textarea":Dn(i),Ru(i);break;case"select":case"option":break;default:typeof n.onClick=="function"&&(i.onclick=Ro)}i=s,t.updateQueue=i,i!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=__(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=o.createElement(r,{is:i.is}):(e=o.createElement(r),r==="select"&&(o=e,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):e=o.createElementNS(e,r),e[er]=t,e[nn]=i,zp(e,t,!1,!1),t.stateNode=e;e:{switch(o=Ta(r,i),r){case"dialog":de("cancel",e),de("close",e),s=i;break;case"iframe":case"object":case"embed":de("load",e),s=i;break;case"video":case"audio":for(s=0;s<Ts.length;s++)de(Ts[s],e);s=i;break;case"source":de("error",e),s=i;break;case"img":case"image":case"link":de("error",e),de("load",e),s=i;break;case"details":de("toggle",e),s=i;break;case"input":Lu(e,i),s=ba(e,i),de("invalid",e);break;case"option":s=i;break;case"select":e._wrapperState={wasMultiple:!!i.multiple},s=xe({},i,{value:void 0}),de("invalid",e);break;case"textarea":Tu(e,i),s=Pa(e,i),de("invalid",e);break;default:s=i}Da(r,s),l=s;for(n in l)if(l.hasOwnProperty(n)){var a=l[n];n==="style"?v_(e,a):n==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&p_(e,a)):n==="children"?typeof a=="string"?(r!=="textarea"||a!=="")&&Xs(e,a):typeof a=="number"&&Xs(e,""+a):n!=="suppressContentEditableWarning"&&n!=="suppressHydrationWarning"&&n!=="autoFocus"&&(Ys.hasOwnProperty(n)?a!=null&&n==="onScroll"&&de("scroll",e):a!=null&&_h(e,n,a,o))}switch(r){case"input":Dn(e),Du(e,i,!1);break;case"textarea":Dn(e),Ru(e);break;case"option":i.value!=null&&e.setAttribute("value",""+Vr(i.value));break;case"select":e.multiple=!!i.multiple,n=i.value,n!=null?Hi(e,!!i.multiple,n,!1):i.defaultValue!=null&&Hi(e,!!i.multiple,i.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Ro)}switch(r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ze(t),null;case 6:if(e&&t.stateNode!=null)$p(e,t,e.memoizedProps,i);else{if(typeof i!="string"&&t.stateNode===null)throw Error(B(166));if(r=oi(ln.current),oi(ir.current),zn(t)){if(i=t.stateNode,r=t.memoizedProps,i[er]=t,(n=i.nodeValue!==r)&&(e=St,e!==null))switch(e.tag){case 3:In(i.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&In(i.nodeValue,r,(e.mode&1)!==0)}n&&(t.flags|=4)}else i=(r.nodeType===9?r:r.ownerDocument).createTextNode(i),i[er]=t,t.stateNode=i}return Ze(t),null;case 13:if(_e(Se),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(pe&&yt!==null&&t.mode&1&&!(t.flags&128))sp(),Ji(),t.flags|=98560,n=!1;else if(n=zn(t),i!==null&&i.dehydrated!==null){if(e===null){if(!n)throw Error(B(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(B(317));n[er]=t}else Ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ze(t),n=!1}else Ft!==null&&(hc(Ft),Ft=null),n=!0;if(!n)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||Se.current&1?Ae===0&&(Ae=3):Gh())),t.updateQueue!==null&&(t.flags|=4),Ze(t),null);case 4:return es(),rc(e,t),e===null&&rn(t.stateNode.containerInfo),Ze(t),null;case 10:return Nh(t.type._context),Ze(t),null;case 17:return _t(t.type)&&Mo(),Ze(t),null;case 19:if(_e(Se),n=t.memoizedState,n===null)return Ze(t),null;if(i=(t.flags&128)!==0,o=n.rendering,o===null)if(i)gs(n,!1);else{if(Ae!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=jo(e),o!==null){for(t.flags|=128,gs(n,!1),i=o.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=r,r=t.child;r!==null;)n=r,e=i,n.flags&=14680066,o=n.alternate,o===null?(n.childLanes=0,n.lanes=e,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,e=o.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return ue(Se,Se.current&1|2),t.child}e=e.sibling}n.tail!==null&&Pe()>rs&&(t.flags|=128,i=!0,gs(n,!1),t.lanes=4194304)}else{if(!i)if(e=jo(o),e!==null){if(t.flags|=128,i=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),gs(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!pe)return Ze(t),null}else 2*Pe()-n.renderingStartTime>rs&&r!==1073741824&&(t.flags|=128,i=!0,gs(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(r=n.last,r!==null?r.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(t=n.tail,n.rendering=t,n.tail=t.sibling,n.renderingStartTime=Pe(),t.sibling=null,r=Se.current,ue(Se,i?r&1|2:r&1),t):(Ze(t),null);case 22:case 23:return Xh(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?gt&1073741824&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),null;case 24:return null;case 25:return null}throw Error(B(156,t.tag))}function Ty(e,t){switch(Dh(t),t.tag){case 1:return _t(t.type)&&Mo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return es(),_e(ft),_e(rt),zh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ih(t),null;case 13:if(_e(Se),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(B(340));Ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(Se),null;case 4:return es(),null;case 10:return Nh(t.type._context),null;case 22:case 23:return Xh(),null;case 24:return null;default:return null}}var Fn=!1,tt=!1,Ry=typeof WeakSet=="function"?WeakSet:Set,F=null;function ji(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(i){be(e,t,i)}else r.current=null}function ic(e,t,r){try{r()}catch(i){be(e,t,i)}}var Sd=!1;function My(e,t){if($a=Lo,e=K_(),Ph(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var s=i.anchorOffset,n=i.focusNode;i=i.focusOffset;try{r.nodeType,n.nodeType}catch{r=null;break e}var o=0,l=-1,a=-1,c=0,u=0,h=e,d=null;t:for(;;){for(var m;h!==r||s!==0&&h.nodeType!==3||(l=o+s),h!==n||i!==0&&h.nodeType!==3||(a=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)d=h,h=m;for(;;){if(h===e)break t;if(d===r&&++c===s&&(l=o),d===n&&++u===i&&(a=o),(m=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=m}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Fa={focusedElem:e,selectionRange:r},Lo=!1,F=t;F!==null;)if(t=F,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,F=e;else for(;F!==null;){t=F;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var g=p.memoizedProps,w=p.memoizedState,f=t.stateNode,v=f.getSnapshotBeforeUpdate(t.elementType===t.type?g:jt(t.type,g),w);f.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(B(163))}}catch(S){be(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,F=e;break}F=t.return}return p=Sd,Sd=!1,p}function Ws(e,t,r){var i=t.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var s=i=i.next;do{if((s.tag&e)===e){var n=s.destroy;s.destroy=void 0,n!==void 0&&ic(t,r,n)}s=s.next}while(s!==i)}}function ul(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var i=r.create;r.destroy=i()}r=r.next}while(r!==t)}}function sc(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Fp(e){var t=e.alternate;t!==null&&(e.alternate=null,Fp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[er],delete t[nn],delete t[Ua],delete t[_y],delete t[py])),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 Wp(e){return e.tag===5||e.tag===3||e.tag===4}function wd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Wp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function nc(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Ro));else if(i!==4&&(e=e.child,e!==null))for(nc(e,t,r),e=e.sibling;e!==null;)nc(e,t,r),e=e.sibling}function oc(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(oc(e,t,r),e=e.sibling;e!==null;)oc(e,t,r),e=e.sibling}var Ve=null,$t=!1;function Cr(e,t,r){for(r=r.child;r!==null;)Hp(e,t,r),r=r.sibling}function Hp(e,t,r){if(rr&&typeof rr.onCommitFiberUnmount=="function")try{rr.onCommitFiberUnmount(il,r)}catch{}switch(r.tag){case 5:tt||ji(r,t);case 6:var i=Ve,s=$t;Ve=null,Cr(e,t,r),Ve=i,$t=s,Ve!==null&&($t?(e=Ve,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ve.removeChild(r.stateNode));break;case 18:Ve!==null&&($t?(e=Ve,r=r.stateNode,e.nodeType===8?Hl(e.parentNode,r):e.nodeType===1&&Hl(e,r),Zs(e)):Hl(Ve,r.stateNode));break;case 4:i=Ve,s=$t,Ve=r.stateNode.containerInfo,$t=!0,Cr(e,t,r),Ve=i,$t=s;break;case 0:case 11:case 14:case 15:if(!tt&&(i=r.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){s=i=i.next;do{var n=s,o=n.destroy;n=n.tag,o!==void 0&&(n&2||n&4)&&ic(r,t,o),s=s.next}while(s!==i)}Cr(e,t,r);break;case 1:if(!tt&&(ji(r,t),i=r.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=r.memoizedProps,i.state=r.memoizedState,i.componentWillUnmount()}catch(l){be(r,t,l)}Cr(e,t,r);break;case 21:Cr(e,t,r);break;case 22:r.mode&1?(tt=(i=tt)||r.memoizedState!==null,Cr(e,t,r),tt=i):Cr(e,t,r);break;default:Cr(e,t,r)}}function xd(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Ry),t.forEach(function(i){var s=Fy.bind(null,e,i);r.has(i)||(r.add(i),i.then(s,s))})}}function At(e,t){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var s=r[i];try{var n=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ve=l.stateNode,$t=!1;break e;case 3:Ve=l.stateNode.containerInfo,$t=!0;break e;case 4:Ve=l.stateNode.containerInfo,$t=!0;break e}l=l.return}if(Ve===null)throw Error(B(160));Hp(n,o,s),Ve=null,$t=!1;var a=s.alternate;a!==null&&(a.return=null),s.return=null}catch(c){be(s,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Up(t,e),t=t.sibling}function Up(e,t){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(At(t,e),Yt(e),i&4){try{Ws(3,e,e.return),ul(3,e)}catch(g){be(e,e.return,g)}try{Ws(5,e,e.return)}catch(g){be(e,e.return,g)}}break;case 1:At(t,e),Yt(e),i&512&&r!==null&&ji(r,r.return);break;case 5:if(At(t,e),Yt(e),i&512&&r!==null&&ji(r,r.return),e.flags&32){var s=e.stateNode;try{Xs(s,"")}catch(g){be(e,e.return,g)}}if(i&4&&(s=e.stateNode,s!=null)){var n=e.memoizedProps,o=r!==null?r.memoizedProps:n,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&n.type==="radio"&&n.name!=null&&d_(s,n),Ta(l,o);var c=Ta(l,n);for(o=0;o<a.length;o+=2){var u=a[o],h=a[o+1];u==="style"?v_(s,h):u==="dangerouslySetInnerHTML"?p_(s,h):u==="children"?Xs(s,h):_h(s,u,h,c)}switch(l){case"input":ka(s,n);break;case"textarea":f_(s,n);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!n.multiple;var m=n.value;m!=null?Hi(s,!!n.multiple,m,!1):d!==!!n.multiple&&(n.defaultValue!=null?Hi(s,!!n.multiple,n.defaultValue,!0):Hi(s,!!n.multiple,n.multiple?[]:"",!1))}s[nn]=n}catch(g){be(e,e.return,g)}}break;case 6:if(At(t,e),Yt(e),i&4){if(e.stateNode===null)throw Error(B(162));s=e.stateNode,n=e.memoizedProps;try{s.nodeValue=n}catch(g){be(e,e.return,g)}}break;case 3:if(At(t,e),Yt(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Zs(t.containerInfo)}catch(g){be(e,e.return,g)}break;case 4:At(t,e),Yt(e);break;case 13:At(t,e),Yt(e),s=e.child,s.flags&8192&&(n=s.memoizedState!==null,s.stateNode.isHidden=n,!n||s.alternate!==null&&s.alternate.memoizedState!==null||(qh=Pe())),i&4&&xd(e);break;case 22:if(u=r!==null&&r.memoizedState!==null,e.mode&1?(tt=(c=tt)||u,At(t,e),tt=c):At(t,e),Yt(e),i&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(F=e,u=e.child;u!==null;){for(h=F=u;F!==null;){switch(d=F,m=d.child,d.tag){case 0:case 11:case 14:case 15:Ws(4,d,d.return);break;case 1:ji(d,d.return);var p=d.stateNode;if(typeof p.componentWillUnmount=="function"){i=d,r=d.return;try{t=i,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(g){be(i,r,g)}}break;case 5:ji(d,d.return);break;case 22:if(d.memoizedState!==null){bd(h);continue}}m!==null?(m.return=d,F=m):bd(h)}u=u.sibling}e:for(u=null,h=e;;){if(h.tag===5){if(u===null){u=h;try{s=h.stateNode,c?(n=s.style,typeof n.setProperty=="function"?n.setProperty("display","none","important"):n.display="none"):(l=h.stateNode,a=h.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=m_("display",o))}catch(g){be(e,e.return,g)}}}else if(h.tag===6){if(u===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(g){be(e,e.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:At(t,e),Yt(e),i&4&&xd(e);break;case 21:break;default:At(t,e),Yt(e)}}function Yt(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(Wp(r)){var i=r;break e}r=r.return}throw Error(B(160))}switch(i.tag){case 5:var s=i.stateNode;i.flags&32&&(Xs(s,""),i.flags&=-33);var n=wd(e);oc(e,n,s);break;case 3:case 4:var o=i.stateNode.containerInfo,l=wd(e);nc(e,l,o);break;default:throw Error(B(161))}}catch(a){be(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ny(e,t,r){F=e,Kp(e)}function Kp(e,t,r){for(var i=(e.mode&1)!==0;F!==null;){var s=F,n=s.child;if(s.tag===22&&i){var o=s.memoizedState!==null||Fn;if(!o){var l=s.alternate,a=l!==null&&l.memoizedState!==null||tt;l=Fn;var c=tt;if(Fn=o,(tt=a)&&!c)for(F=s;F!==null;)o=F,a=o.child,o.tag===22&&o.memoizedState!==null?kd(s):a!==null?(a.return=o,F=a):kd(s);for(;n!==null;)F=n,Kp(n),n=n.sibling;F=s,Fn=l,tt=c}Cd(e)}else s.subtreeFlags&8772&&n!==null?(n.return=s,F=n):Cd(e)}}function Cd(e){for(;F!==null;){var t=F;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:tt||ul(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!tt)if(r===null)i.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:jt(t.type,r.memoizedProps);i.componentDidUpdate(s,r.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var n=t.updateQueue;n!==null&&ld(t,n,i);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}ld(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break;case"img":a.src&&(r.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var h=u.dehydrated;h!==null&&Zs(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(B(163))}tt||t.flags&512&&sc(t)}catch(d){be(t,t.return,d)}}if(t===e){F=null;break}if(r=t.sibling,r!==null){r.return=t.return,F=r;break}F=t.return}}function bd(e){for(;F!==null;){var t=F;if(t===e){F=null;break}var r=t.sibling;if(r!==null){r.return=t.return,F=r;break}F=t.return}}function kd(e){for(;F!==null;){var t=F;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{ul(4,t)}catch(a){be(t,r,a)}break;case 1:var i=t.stateNode;if(typeof i.componentDidMount=="function"){var s=t.return;try{i.componentDidMount()}catch(a){be(t,s,a)}}var n=t.return;try{sc(t)}catch(a){be(t,n,a)}break;case 5:var o=t.return;try{sc(t)}catch(a){be(t,o,a)}}}catch(a){be(t,t.return,a)}if(t===e){F=null;break}var l=t.sibling;if(l!==null){l.return=t.return,F=l;break}F=t.return}}var By=Math.ceil,Wo=gr.ReactCurrentDispatcher,Kh=gr.ReactCurrentOwner,Mt=gr.ReactCurrentBatchConfig,Z=0,Ue=null,Re=null,Ge=0,gt=0,$i=Gr(0),Ae=0,un=null,mi=0,dl=0,Vh=0,Hs=null,ut=null,qh=0,rs=1/0,ar=null,Ho=!1,lc=null,Wr=null,Wn=!1,Br=null,Uo=0,Us=0,ac=null,co=-1,ho=0;function nt(){return Z&6?Pe():co!==-1?co:co=Pe()}function Hr(e){return e.mode&1?Z&2&&Ge!==0?Ge&-Ge:vy.transition!==null?(ho===0&&(ho=D_()),ho):(e=oe,e!==0||(e=window.event,e=e===void 0?16:A_(e.type)),e):1}function Ht(e,t,r,i){if(50<Us)throw Us=0,ac=null,Error(B(185));vn(e,r,i),(!(Z&2)||e!==Ue)&&(e===Ue&&(!(Z&2)&&(dl|=r),Ae===4&&Mr(e,Ge)),pt(e,i),r===1&&Z===0&&!(t.mode&1)&&(rs=Pe()+500,al&&Qr()))}function pt(e,t){var r=e.callbackNode;vg(e,t);var i=Po(e,e===Ue?Ge:0);if(i===0)r!==null&&Bu(r),e.callbackNode=null,e.callbackPriority=0;else if(t=i&-i,e.callbackPriority!==t){if(r!=null&&Bu(r),t===1)e.tag===0?my(Ed.bind(null,e)):tp(Ed.bind(null,e)),dy(function(){!(Z&6)&&Qr()}),r=null;else{switch(T_(i)){case 1:r=yh;break;case 4:r=P_;break;case 16:r=Eo;break;case 536870912:r=L_;break;default:r=Eo}r=Zp(r,Vp.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function Vp(e,t){if(co=-1,ho=0,Z&6)throw Error(B(327));var r=e.callbackNode;if(Yi()&&e.callbackNode!==r)return null;var i=Po(e,e===Ue?Ge:0);if(i===0)return null;if(i&30||i&e.expiredLanes||t)t=Ko(e,i);else{t=i;var s=Z;Z|=2;var n=Yp();(Ue!==e||Ge!==t)&&(ar=null,rs=Pe()+500,ai(e,t));do try{Iy();break}catch(l){qp(e,l)}while(!0);Mh(),Wo.current=n,Z=s,Re!==null?t=0:(Ue=null,Ge=0,t=Ae)}if(t!==0){if(t===2&&(s=Oa(e),s!==0&&(i=s,t=cc(e,s))),t===1)throw r=un,ai(e,0),Mr(e,i),pt(e,Pe()),r;if(t===6)Mr(e,i);else{if(s=e.current.alternate,!(i&30)&&!Oy(s)&&(t=Ko(e,i),t===2&&(n=Oa(e),n!==0&&(i=n,t=cc(e,n))),t===1))throw r=un,ai(e,0),Mr(e,i),pt(e,Pe()),r;switch(e.finishedWork=s,e.finishedLanes=i,t){case 0:case 1:throw Error(B(345));case 2:ti(e,ut,ar);break;case 3:if(Mr(e,i),(i&130023424)===i&&(t=qh+500-Pe(),10<t)){if(Po(e,0)!==0)break;if(s=e.suspendedLanes,(s&i)!==i){nt(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Ha(ti.bind(null,e,ut,ar),t);break}ti(e,ut,ar);break;case 4:if(Mr(e,i),(i&4194240)===i)break;for(t=e.eventTimes,s=-1;0<i;){var o=31-Wt(i);n=1<<o,o=t[o],o>s&&(s=o),i&=~n}if(i=s,i=Pe()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*By(i/1960))-i,10<i){e.timeoutHandle=Ha(ti.bind(null,e,ut,ar),i);break}ti(e,ut,ar);break;case 5:ti(e,ut,ar);break;default:throw Error(B(329))}}}return pt(e,Pe()),e.callbackNode===r?Vp.bind(null,e):null}function cc(e,t){var r=Hs;return e.current.memoizedState.isDehydrated&&(ai(e,t).flags|=256),e=Ko(e,t),e!==2&&(t=ut,ut=r,t!==null&&hc(t)),e}function hc(e){ut===null?ut=e:ut.push.apply(ut,e)}function Oy(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var i=0;i<r.length;i++){var s=r[i],n=s.getSnapshot;s=s.value;try{if(!Ut(n(),s))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Mr(e,t){for(t&=~Vh,t&=~dl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Wt(t),i=1<<r;e[r]=-1,t&=~i}}function Ed(e){if(Z&6)throw Error(B(327));Yi();var t=Po(e,0);if(!(t&1))return pt(e,Pe()),null;var r=Ko(e,t);if(e.tag!==0&&r===2){var i=Oa(e);i!==0&&(t=i,r=cc(e,i))}if(r===1)throw r=un,ai(e,0),Mr(e,t),pt(e,Pe()),r;if(r===6)throw Error(B(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ti(e,ut,ar),pt(e,Pe()),null}function Yh(e,t){var r=Z;Z|=1;try{return e(t)}finally{Z=r,Z===0&&(rs=Pe()+500,al&&Qr())}}function vi(e){Br!==null&&Br.tag===0&&!(Z&6)&&Yi();var t=Z;Z|=1;var r=Mt.transition,i=oe;try{if(Mt.transition=null,oe=1,e)return e()}finally{oe=i,Mt.transition=r,Z=t,!(Z&6)&&Qr()}}function Xh(){gt=$i.current,_e($i)}function ai(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,uy(r)),Re!==null)for(r=Re.return;r!==null;){var i=r;switch(Dh(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&Mo();break;case 3:es(),_e(ft),_e(rt),zh();break;case 5:Ih(i);break;case 4:es();break;case 13:_e(Se);break;case 19:_e(Se);break;case 10:Nh(i.type._context);break;case 22:case 23:Xh()}r=r.return}if(Ue=e,Re=e=Ur(e.current,null),Ge=gt=t,Ae=0,un=null,Vh=dl=mi=0,ut=Hs=null,ni!==null){for(t=0;t<ni.length;t++)if(r=ni[t],i=r.interleaved,i!==null){r.interleaved=null;var s=i.next,n=r.pending;if(n!==null){var o=n.next;n.next=s,i.next=o}r.pending=i}ni=null}return e}function qp(e,t){do{var r=Re;try{if(Mh(),oo.current=Fo,$o){for(var i=we.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}$o=!1}if(pi=0,$e=Oe=we=null,Fs=!1,an=0,Kh.current=null,r===null||r.return===null){Ae=1,un=t,Re=null;break}e:{var n=e,o=r.return,l=r,a=t;if(t=Ge,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var c=a,u=l,h=u.tag;if(!(u.mode&1)&&(h===0||h===11||h===15)){var d=u.alternate;d?(u.updateQueue=d.updateQueue,u.memoizedState=d.memoizedState,u.lanes=d.lanes):(u.updateQueue=null,u.memoizedState=null)}var m=fd(o);if(m!==null){m.flags&=-257,_d(m,o,l,n,t),m.mode&1&&dd(n,c,t),t=m,a=c;var p=t.updateQueue;if(p===null){var g=new Set;g.add(a),t.updateQueue=g}else p.add(a);break e}else{if(!(t&1)){dd(n,c,t),Gh();break e}a=Error(B(426))}}else if(pe&&l.mode&1){var w=fd(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),_d(w,o,l,n,t),Th(ts(a,l));break e}}n=a=ts(a,l),Ae!==4&&(Ae=2),Hs===null?Hs=[n]:Hs.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,t&=-t,n.lanes|=t;var f=Tp(n,a,t);od(n,f);break e;case 1:l=a;var v=n.type,y=n.stateNode;if(!(n.flags&128)&&(typeof v.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Wr===null||!Wr.has(y)))){n.flags|=65536,t&=-t,n.lanes|=t;var S=Rp(n,l,t);od(n,S);break e}}n=n.return}while(n!==null)}Gp(r)}catch(C){t=C,Re===r&&r!==null&&(Re=r=r.return);continue}break}while(!0)}function Yp(){var e=Wo.current;return Wo.current=Fo,e===null?Fo:e}function Gh(){(Ae===0||Ae===3||Ae===2)&&(Ae=4),Ue===null||!(mi&268435455)&&!(dl&268435455)||Mr(Ue,Ge)}function Ko(e,t){var r=Z;Z|=2;var i=Yp();(Ue!==e||Ge!==t)&&(ar=null,ai(e,t));do try{Ay();break}catch(s){qp(e,s)}while(!0);if(Mh(),Z=r,Wo.current=i,Re!==null)throw Error(B(261));return Ue=null,Ge=0,Ae}function Ay(){for(;Re!==null;)Xp(Re)}function Iy(){for(;Re!==null&&!ag();)Xp(Re)}function Xp(e){var t=Jp(e.alternate,e,gt);e.memoizedProps=e.pendingProps,t===null?Gp(e):Re=t,Kh.current=null}function Gp(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=Ty(r,t),r!==null){r.flags&=32767,Re=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ae=6,Re=null;return}}else if(r=Dy(r,t,gt),r!==null){Re=r;return}if(t=t.sibling,t!==null){Re=t;return}Re=t=e}while(t!==null);Ae===0&&(Ae=5)}function ti(e,t,r){var i=oe,s=Mt.transition;try{Mt.transition=null,oe=1,zy(e,t,r,i)}finally{Mt.transition=s,oe=i}return null}function zy(e,t,r,i){do Yi();while(Br!==null);if(Z&6)throw Error(B(327));r=e.finishedWork;var s=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(B(177));e.callbackNode=null,e.callbackPriority=0;var n=r.lanes|r.childLanes;if(gg(e,n),e===Ue&&(Re=Ue=null,Ge=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Wn||(Wn=!0,Zp(Eo,function(){return Yi(),null})),n=(r.flags&15990)!==0,r.subtreeFlags&15990||n){n=Mt.transition,Mt.transition=null;var o=oe;oe=1;var l=Z;Z|=4,Kh.current=null,My(e,r),Up(r,e),sy(Fa),Lo=!!$a,Fa=$a=null,e.current=r,Ny(r),cg(),Z=l,oe=o,Mt.transition=n}else e.current=r;if(Wn&&(Wn=!1,Br=e,Uo=s),n=e.pendingLanes,n===0&&(Wr=null),dg(r.stateNode),pt(e,Pe()),t!==null)for(i=e.onRecoverableError,r=0;r<t.length;r++)s=t[r],i(s.value,{componentStack:s.stack,digest:s.digest});if(Ho)throw Ho=!1,e=lc,lc=null,e;return Uo&1&&e.tag!==0&&Yi(),n=e.pendingLanes,n&1?e===ac?Us++:(Us=0,ac=e):Us=0,Qr(),null}function Yi(){if(Br!==null){var e=T_(Uo),t=Mt.transition,r=oe;try{if(Mt.transition=null,oe=16>e?16:e,Br===null)var i=!1;else{if(e=Br,Br=null,Uo=0,Z&6)throw Error(B(331));var s=Z;for(Z|=4,F=e.current;F!==null;){var n=F,o=n.child;if(F.flags&16){var l=n.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(F=c;F!==null;){var u=F;switch(u.tag){case 0:case 11:case 15:Ws(8,u,n)}var h=u.child;if(h!==null)h.return=u,F=h;else for(;F!==null;){u=F;var d=u.sibling,m=u.return;if(Fp(u),u===c){F=null;break}if(d!==null){d.return=m,F=d;break}F=m}}}var p=n.alternate;if(p!==null){var g=p.child;if(g!==null){p.child=null;do{var w=g.sibling;g.sibling=null,g=w}while(g!==null)}}F=n}}if(n.subtreeFlags&2064&&o!==null)o.return=n,F=o;else e:for(;F!==null;){if(n=F,n.flags&2048)switch(n.tag){case 0:case 11:case 15:Ws(9,n,n.return)}var f=n.sibling;if(f!==null){f.return=n.return,F=f;break e}F=n.return}}var v=e.current;for(F=v;F!==null;){o=F;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,F=y;else e:for(o=v;F!==null;){if(l=F,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:ul(9,l)}}catch(C){be(l,l.return,C)}if(l===o){F=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,F=S;break e}F=l.return}}if(Z=s,Qr(),rr&&typeof rr.onPostCommitFiberRoot=="function")try{rr.onPostCommitFiberRoot(il,e)}catch{}i=!0}return i}finally{oe=r,Mt.transition=t}}return!1}function Pd(e,t,r){t=ts(r,t),t=Tp(e,t,1),e=Fr(e,t,1),t=nt(),e!==null&&(vn(e,1,t),pt(e,t))}function be(e,t,r){if(e.tag===3)Pd(e,e,r);else for(;t!==null;){if(t.tag===3){Pd(t,e,r);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Wr===null||!Wr.has(i))){e=ts(r,e),e=Rp(t,e,1),t=Fr(t,e,1),e=nt(),t!==null&&(vn(t,1,e),pt(t,e));break}}t=t.return}}function jy(e,t,r){var i=e.pingCache;i!==null&&i.delete(t),t=nt(),e.pingedLanes|=e.suspendedLanes&r,Ue===e&&(Ge&r)===r&&(Ae===4||Ae===3&&(Ge&130023424)===Ge&&500>Pe()-qh?ai(e,0):Vh|=r),pt(e,t)}function Qp(e,t){t===0&&(e.mode&1?(t=Mn,Mn<<=1,!(Mn&130023424)&&(Mn=4194304)):t=1);var r=nt();e=mr(e,t),e!==null&&(vn(e,t,r),pt(e,r))}function $y(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Qp(e,r)}function Fy(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(B(314))}i!==null&&i.delete(t),Qp(e,r)}var Jp;Jp=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||ft.current)dt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return dt=!1,Ly(e,t,r);dt=!!(e.flags&131072)}else dt=!1,pe&&t.flags&1048576&&rp(t,Oo,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ao(e,t),e=t.pendingProps;var s=Qi(t,rt.current);qi(t,r),s=$h(null,t,i,e,s,r);var n=Fh();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_t(i)?(n=!0,No(t)):n=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Oh(t),s.updater=hl,t.stateNode=s,s._reactInternals=t,Ga(t,i,e,r),t=Za(null,t,i,!0,n,r)):(t.tag=0,pe&&n&&Lh(t),st(null,t,s,r),t=t.child),t;case 16:i=t.elementType;e:{switch(ao(e,t),e=t.pendingProps,s=i._init,i=s(i._payload),t.type=i,s=t.tag=Hy(i),e=jt(i,e),s){case 0:t=Ja(null,t,i,e,r);break e;case 1:t=vd(null,t,i,e,r);break e;case 11:t=pd(null,t,i,e,r);break e;case 14:t=md(null,t,i,jt(i.type,e),r);break e}throw Error(B(306,i,""))}return t;case 0:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:jt(i,s),Ja(e,t,i,s,r);case 1:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:jt(i,s),vd(e,t,i,s,r);case 3:e:{if(Op(t),e===null)throw Error(B(387));i=t.pendingProps,n=t.memoizedState,s=n.element,ap(e,t),zo(t,i,null,r);var o=t.memoizedState;if(i=o.element,n.isDehydrated)if(n={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){s=ts(Error(B(423)),t),t=gd(e,t,i,r,s);break e}else if(i!==s){s=ts(Error(B(424)),t),t=gd(e,t,i,r,s);break e}else for(yt=$r(t.stateNode.containerInfo.firstChild),St=t,pe=!0,Ft=null,r=op(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Ji(),i===s){t=vr(e,t,r);break e}st(e,t,i,r)}t=t.child}return t;case 5:return cp(t),e===null&&qa(t),i=t.type,s=t.pendingProps,n=e!==null?e.memoizedProps:null,o=s.children,Wa(i,s)?o=null:n!==null&&Wa(i,n)&&(t.flags|=32),Bp(e,t),st(e,t,o,r),t.child;case 6:return e===null&&qa(t),null;case 13:return Ap(e,t,r);case 4:return Ah(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Zi(t,null,i,r):st(e,t,i,r),t.child;case 11:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:jt(i,s),pd(e,t,i,s,r);case 7:return st(e,t,t.pendingProps,r),t.child;case 8:return st(e,t,t.pendingProps.children,r),t.child;case 12:return st(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(i=t.type._context,s=t.pendingProps,n=t.memoizedProps,o=s.value,ue(Ao,i._currentValue),i._currentValue=o,n!==null)if(Ut(n.value,o)){if(n.children===s.children&&!ft.current){t=vr(e,t,r);break e}}else for(n=t.child,n!==null&&(n.return=t);n!==null;){var l=n.dependencies;if(l!==null){o=n.child;for(var a=l.firstContext;a!==null;){if(a.context===i){if(n.tag===1){a=fr(-1,r&-r),a.tag=2;var c=n.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?a.next=a:(a.next=u.next,u.next=a),c.pending=a}}n.lanes|=r,a=n.alternate,a!==null&&(a.lanes|=r),Ya(n.return,r,t),l.lanes|=r;break}a=a.next}}else if(n.tag===10)o=n.type===t.type?null:n.child;else if(n.tag===18){if(o=n.return,o===null)throw Error(B(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),Ya(o,r,t),o=n.sibling}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===t){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}st(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,i=t.pendingProps.children,qi(t,r),s=Bt(s),i=i(s),t.flags|=1,st(e,t,i,r),t.child;case 14:return i=t.type,s=jt(i,t.pendingProps),s=jt(i.type,s),md(e,t,i,s,r);case 15:return Mp(e,t,t.type,t.pendingProps,r);case 17:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:jt(i,s),ao(e,t),t.tag=1,_t(i)?(e=!0,No(t)):e=!1,qi(t,r),Dp(t,i,s),Ga(t,i,s,r),Za(null,t,i,!0,e,r);case 19:return Ip(e,t,r);case 22:return Np(e,t,r)}throw Error(B(156,t.tag))};function Zp(e,t){return E_(e,t)}function Wy(e,t,r,i){this.tag=e,this.key=r,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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rt(e,t,r,i){return new Wy(e,t,r,i)}function Qh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hy(e){if(typeof e=="function")return Qh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===mh)return 11;if(e===vh)return 14}return 2}function Ur(e,t){var r=e.alternate;return r===null?(r=Rt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function uo(e,t,r,i,s,n){var o=2;if(i=e,typeof e=="function")Qh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ti:return ci(r.children,s,n,t);case ph:o=8,s|=8;break;case Sa:return e=Rt(12,r,t,s|2),e.elementType=Sa,e.lanes=n,e;case wa:return e=Rt(13,r,t,s),e.elementType=wa,e.lanes=n,e;case xa:return e=Rt(19,r,t,s),e.elementType=xa,e.lanes=n,e;case c_:return fl(r,s,n,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case l_:o=10;break e;case a_:o=9;break e;case mh:o=11;break e;case vh:o=14;break e;case Lr:o=16,i=null;break e}throw Error(B(130,e==null?e:typeof e,""))}return t=Rt(o,r,t,s),t.elementType=e,t.type=i,t.lanes=n,t}function ci(e,t,r,i){return e=Rt(7,e,i,t),e.lanes=r,e}function fl(e,t,r,i){return e=Rt(22,e,i,t),e.elementType=c_,e.lanes=r,e.stateNode={isHidden:!1},e}function Ql(e,t,r){return e=Rt(6,e,null,t),e.lanes=r,e}function Jl(e,t,r){return t=Rt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Uy(e,t,r,i,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=Ml(0),this.expirationTimes=Ml(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ml(0),this.identifierPrefix=i,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Jh(e,t,r,i,s,n,o,l,a){return e=new Uy(e,t,r,l,a),t===1?(t=1,n===!0&&(t|=8)):t=0,n=Rt(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:i,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oh(n),e}function Ky(e,t,r){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Di,key:i==null?null:""+i,children:e,containerInfo:t,implementation:r}}function em(e){if(!e)return qr;e=e._reactInternals;e:{if(xi(e)!==e||e.tag!==1)throw Error(B(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(_t(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(B(171))}if(e.tag===1){var r=e.type;if(_t(r))return ep(e,r,t)}return t}function tm(e,t,r,i,s,n,o,l,a){return e=Jh(r,i,!0,e,s,n,o,l,a),e.context=em(null),r=e.current,i=nt(),s=Hr(r),n=fr(i,s),n.callback=t??null,Fr(r,n,s),e.current.lanes=s,vn(e,s,i),pt(e,i),e}function _l(e,t,r,i){var s=t.current,n=nt(),o=Hr(s);return r=em(r),t.context===null?t.context=r:t.pendingContext=r,t=fr(n,o),t.payload={element:e},i=i===void 0?null:i,i!==null&&(t.callback=i),e=Fr(s,t,o),e!==null&&(Ht(e,s,o,n),no(e,s,o)),o}function Vo(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Ld(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Zh(e,t){Ld(e,t),(e=e.alternate)&&Ld(e,t)}function Vy(){return null}var rm=typeof reportError=="function"?reportError:function(e){console.error(e)};function eu(e){this._internalRoot=e}pl.prototype.render=eu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(B(409));_l(e,t,null,null)};pl.prototype.unmount=eu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vi(function(){_l(null,e,null,null)}),t[pr]=null}};function pl(e){this._internalRoot=e}pl.prototype.unstable_scheduleHydration=function(e){if(e){var t=N_();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Rr.length&&t!==0&&t<Rr[r].priority;r++);Rr.splice(r,0,e),r===0&&O_(e)}};function tu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ml(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Dd(){}function qy(e,t,r,i,s){if(s){if(typeof i=="function"){var n=i;i=function(){var c=Vo(o);n.call(c)}}var o=tm(t,i,e,0,null,!1,!1,"",Dd);return e._reactRootContainer=o,e[pr]=o.current,rn(e.nodeType===8?e.parentNode:e),vi(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof i=="function"){var l=i;i=function(){var c=Vo(a);l.call(c)}}var a=Jh(e,0,!1,null,null,!1,!1,"",Dd);return e._reactRootContainer=a,e[pr]=a.current,rn(e.nodeType===8?e.parentNode:e),vi(function(){_l(t,a,r,i)}),a}function vl(e,t,r,i,s){var n=r._reactRootContainer;if(n){var o=n;if(typeof s=="function"){var l=s;s=function(){var a=Vo(o);l.call(a)}}_l(t,o,e,s)}else o=qy(r,t,e,s,i);return Vo(o)}R_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Ds(t.pendingLanes);r!==0&&(Sh(t,r|1),pt(t,Pe()),!(Z&6)&&(rs=Pe()+500,Qr()))}break;case 13:vi(function(){var i=mr(e,1);if(i!==null){var s=nt();Ht(i,e,1,s)}}),Zh(e,1)}};wh=function(e){if(e.tag===13){var t=mr(e,134217728);if(t!==null){var r=nt();Ht(t,e,134217728,r)}Zh(e,134217728)}};M_=function(e){if(e.tag===13){var t=Hr(e),r=mr(e,t);if(r!==null){var i=nt();Ht(r,e,t,i)}Zh(e,t)}};N_=function(){return oe};B_=function(e,t){var r=oe;try{return oe=e,t()}finally{oe=r}};Ma=function(e,t,r){switch(t){case"input":if(ka(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var i=r[t];if(i!==e&&i.form===e.form){var s=ll(i);if(!s)throw Error(B(90));u_(i),ka(i,s)}}}break;case"textarea":f_(e,r);break;case"select":t=r.value,t!=null&&Hi(e,!!r.multiple,t,!1)}};S_=Yh;w_=vi;var Yy={usingClientEntryPoint:!1,Events:[yn,Bi,ll,g_,y_,Yh]},ys={findFiberByHostInstance:si,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Xy={bundleType:ys.bundleType,version:ys.version,rendererPackageName:ys.rendererPackageName,rendererConfig:ys.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:gr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=b_(e),e===null?null:e.stateNode},findFiberByHostInstance:ys.findFiberByHostInstance||Vy,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hn=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hn.isDisabled&&Hn.supportsFiber)try{il=Hn.inject(Xy),rr=Hn}catch{}}xt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Yy;xt.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tu(t))throw Error(B(200));return Ky(e,t,null,r)};xt.createRoot=function(e,t){if(!tu(e))throw Error(B(299));var r=!1,i="",s=rm;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Jh(e,1,!1,null,null,r,!1,i,s),e[pr]=t.current,rn(e.nodeType===8?e.parentNode:e),new eu(t)};xt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(B(188)):(e=Object.keys(e).join(","),Error(B(268,e)));return e=b_(t),e=e===null?null:e.stateNode,e};xt.flushSync=function(e){return vi(e)};xt.hydrate=function(e,t,r){if(!ml(t))throw Error(B(200));return vl(null,e,t,!0,r)};xt.hydrateRoot=function(e,t,r){if(!tu(e))throw Error(B(405));var i=r!=null&&r.hydratedSources||null,s=!1,n="",o=rm;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(n=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=tm(t,null,e,1,r??null,s,!1,n,o),e[pr]=t.current,rn(e),i)for(e=0;e<i.length;e++)r=i[e],s=r._getVersion,s=s(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,s]:t.mutableSourceEagerHydrationData.push(r,s);return new pl(t)};xt.render=function(e,t,r){if(!ml(t))throw Error(B(200));return vl(null,e,t,!1,r)};xt.unmountComponentAtNode=function(e){if(!ml(e))throw Error(B(40));return e._reactRootContainer?(vi(function(){vl(null,null,e,!1,function(){e._reactRootContainer=null,e[pr]=null})}),!0):!1};xt.unstable_batchedUpdates=Yh;xt.unstable_renderSubtreeIntoContainer=function(e,t,r,i){if(!ml(r))throw Error(B(200));if(e==null||e._reactInternals===void 0)throw Error(B(38));return vl(e,t,r,!1,i)};xt.version="18.3.1-next-f1338f8080-20240426";function im(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(im)}catch(e){console.error(e)}}im(),i_.exports=xt;var Gy=i_.exports,Td=Gy;ga.createRoot=Td.createRoot,ga.hydrateRoot=Td.hydrateRoot;const Qy={},Rd=e=>{let t;const r=new Set,i=(u,h)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const m=t;t=h??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(p=>p(t,m))}},s=()=>t,a={setState:i,getState:s,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(Qy?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},c=t=e(i,s,a);return a},Jy=e=>e?Rd(e):Rd;var sm={exports:{}},nm={},om={exports:{}},lm={};/**
|
|
41
|
+
* @license React
|
|
42
|
+
* use-sync-external-store-shim.production.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/var is=N;function Zy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var eS=typeof Object.is=="function"?Object.is:Zy,tS=is.useState,rS=is.useEffect,iS=is.useLayoutEffect,sS=is.useDebugValue;function nS(e,t){var r=t(),i=tS({inst:{value:r,getSnapshot:t}}),s=i[0].inst,n=i[1];return iS(function(){s.value=r,s.getSnapshot=t,Zl(s)&&n({inst:s})},[e,r,t]),rS(function(){return Zl(s)&&n({inst:s}),e(function(){Zl(s)&&n({inst:s})})},[e]),sS(r),r}function Zl(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!eS(e,r)}catch{return!0}}function oS(e,t){return t()}var lS=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?oS:nS;lm.useSyncExternalStore=is.useSyncExternalStore!==void 0?is.useSyncExternalStore:lS;om.exports=lm;var aS=om.exports;/**
|
|
49
|
+
* @license React
|
|
50
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/var gl=N,cS=aS;function hS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uS=typeof Object.is=="function"?Object.is:hS,dS=cS.useSyncExternalStore,fS=gl.useRef,_S=gl.useEffect,pS=gl.useMemo,mS=gl.useDebugValue;nm.useSyncExternalStoreWithSelector=function(e,t,r,i,s){var n=fS(null);if(n.current===null){var o={hasValue:!1,value:null};n.current=o}else o=n.current;n=pS(function(){function a(m){if(!c){if(c=!0,u=m,m=i(m),s!==void 0&&o.hasValue){var p=o.value;if(s(p,m))return h=p}return h=m}if(p=h,uS(u,m))return p;var g=i(m);return s!==void 0&&s(p,g)?(u=m,p):(u=m,h=g)}var c=!1,u,h,d=r===void 0?null:r;return[function(){return a(t())},d===null?void 0:function(){return a(d())}]},[t,r,i,s]);var l=dS(e,n[0],n[1]);return _S(function(){o.hasValue=!0,o.value=l},[l]),mS(l),l};sm.exports=nm;var vS=sm.exports;const gS=Uf(vS),am={},{useDebugValue:yS}=t_,{useSyncExternalStoreWithSelector:SS}=gS;let Md=!1;const wS=e=>e;function xS(e,t=wS,r){(am?"production":void 0)!=="production"&&r&&!Md&&(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"),Md=!0);const i=SS(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return yS(i),i}const Nd=e=>{(am?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Jy(e):e,r=(i,s)=>xS(t,i,s);return Object.assign(r,t),r},wn=e=>e?Nd(e):Nd,ne=wn((e,t)=>({sessions:{},activePorts:{},claudeStatus:{},gitBranches:{},createSession:(r,i)=>e(s=>({sessions:{...s.sessions,[r]:{terminalId:r,projectId:i,terminal:null,title:"Terminal",alive:!0}}})),setTerminalInstance:(r,i)=>e(s=>{const n=s.sessions[r];return n?{sessions:{...s.sessions,[r]:{...n,terminal:i}}}:s}),setTitle:(r,i)=>e(s=>{const n=s.sessions[r];return n?{sessions:{...s.sessions,[r]:{...n,title:i}}}:s}),markDead:r=>e(i=>{const s=i.sessions[r];return s?{sessions:{...i.sessions,[r]:{...s,alive:!1}}}:i}),removeSession:r=>e(i=>{const{[r]:s,...n}=i.sessions;return{sessions:n}}),getSession:r=>t().sessions[r],getProjectSessions:r=>Object.values(t().sessions).filter(i=>i.projectId===r),setActivePorts:r=>e({activePorts:r}),setClaudeStatus:r=>e({claudeStatus:r}),setGitBranches:r=>e({gitBranches:r})}));let Un=null,Ss=null;function Ks(e){Ss=Ss?{...Ss,...e}:{...e},Un&&clearTimeout(Un),Un=setTimeout(()=>{const t=Ss;Ss=null,Un=null,fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).catch(()=>{})},300)}const se=wn()((e,t)=>({projects:{},activeProjectId:null,setActiveProject:r=>{e({activeProjectId:r}),Ks({activeProjectId:r})},addProject:r=>e(i=>({projects:{...i.projects,[r.id]:r},activeProjectId:i.activeProjectId??r.id})),removeProject:r=>e(i=>{const{[r]:s,...n}=i.projects,o=i.activeProjectId===r?Object.keys(n)[0]??null:i.activeProjectId;return{projects:n,activeProjectId:o}}),addTerminalToProject:(r,i)=>e(s=>{const n=s.projects[r];return!n||n.terminalIds.includes(i)?s:{projects:{...s.projects,[r]:{...n,terminalIds:[...n.terminalIds,i]}}}}),removeTerminalFromProject:(r,i)=>e(s=>{const n=s.projects[r];return n?{projects:{...s.projects,[r]:{...n,terminalIds:n.terminalIds.filter(o=>o!==i)}}}:s}),clearProjectTerminals:r=>e(i=>{const s=i.projects[r];return s?{projects:{...i.projects,[r]:{...s,terminalIds:[]}}}:i}),getActiveProject:()=>{const{projects:r,activeProjectId:i}=t();return i?r[i]??null:null},hydrateFromServer:async()=>{try{const[r,i]=await Promise.all([fetch("/api/projects"),fetch("/api/settings")]),s=await r.json(),n=await i.json(),o={};for(const a of s)o[a.id]={id:a.id,name:a.name,cwd:a.cwd,terminalIds:[]};const l=n.activeProjectId&&o[n.activeProjectId]?n.activeProjectId:Object.keys(o)[0]??null;e({projects:o,activeProjectId:l})}catch{}}})),CS=.1,bS=.9,kS=50,ES={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"},PS={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 ce(e){return e?e.type==="leaf"?[e.terminalId]:[...ce(e.first),...ce(e.second)]:[]}function uc(e,t){if(e.type==="leaf")return null;const r=ce(e.first),i=ce(e.second);return r.includes(t)||i.includes(t)?e.direction:uc(e.first,t)??uc(e.second,t)}function LS(e,t,r,i){if(!e)return{type:"leaf",terminalId:r};const s=i??(uc(e,t)==="vertical"?"horizontal":"vertical");return dc(e,t,r,s)}function dc(e,t,r,i){return e.type==="leaf"?e.terminalId===t?{type:"split",direction:i,ratio:.5,first:e,second:{type:"leaf",terminalId:r}}:e:{...e,first:dc(e.first,t,r,i),second:dc(e.second,t,r,i)}}function qo(e,t){if(!e)return null;if(e.type==="leaf")return e.terminalId===t?null:e;const r=ce(e.first),i=ce(e.second);if(e.first.type==="leaf"&&e.first.terminalId===t)return e.second;if(e.second.type==="leaf"&&e.second.terminalId===t)return e.first;if(r.includes(t)){const s=qo(e.first,t);return s?{...e,first:s}:e.second}if(i.includes(t)){const s=qo(e.second,t);return s?{...e,second:s}:e.first}return e}function fc(e,t,r){const i=Math.max(CS,Math.min(bS,r));if(t.length===0)return e.type==="split"?{...e,ratio:i}:e;if(e.type==="leaf")return e;const[s,...n]=t;return s===0?{...e,first:fc(e.first,n,i)}:{...e,second:fc(e.second,n,i)}}function _c(e,t,r){return e.type==="leaf"?e.terminalId===t?{...e,terminalId:r}:e.terminalId===r?{...e,terminalId:t}:e:{...e,first:_c(e.first,t,r),second:_c(e.second,t,r)}}function DS(e,t,r,i){const s=qo(e,t);return s?pc(s,r,t,i==="left"||i==="right"?"vertical":"horizontal",i==="left"||i==="top"):null}function pc(e,t,r,i,s){if(e.type==="leaf"){if(e.terminalId===t){const n={type:"leaf",terminalId:r};return{type:"split",direction:i,ratio:.5,first:s?n:e,second:s?e:n}}return e}return{...e,first:pc(e.first,t,r,i,s),second:pc(e.second,t,r,i,s)}}const Xi=["even-horizontal","even-vertical","main-left","main-top","grid"];function gi(e,t){if(e.length===0)return null;if(e.length===1)return{type:"leaf",terminalId:e[0]};switch(t){case"even-horizontal":return hi(e,"horizontal");case"even-vertical":return hi(e,"vertical");case"main-left":return Bd(e,"vertical");case"main-top":return Bd(e,"horizontal");case"grid":return TS(e)}}function hi(e,t){if(e.length===1)return{type:"leaf",terminalId:e[0]};if(e.length===2)return{type:"split",direction:t,ratio:.5,first:{type:"leaf",terminalId:e[0]},second:{type:"leaf",terminalId:e[1]}};const r=1/e.length;return{type:"split",direction:t,ratio:r,first:{type:"leaf",terminalId:e[0]},second:hi(e.slice(1),t)}}function Bd(e,t,r){const[i,...s]=e,o=hi(s,t==="vertical"?"horizontal":"vertical");return{type:"split",direction:t,ratio:.6,first:{type:"leaf",terminalId:i},second:o}}function TS(e){if(e.length<=2)return hi(e,"vertical");const t=Math.ceil(e.length/2),r=e.slice(0,t),i=e.slice(t);return{type:"split",direction:"horizontal",ratio:.5,first:hi(r,"vertical"),second:i.length>0?hi(i,"vertical"):{type:"leaf",terminalId:r[r.length-1]}}}function Od(e,t,r){const i=ce(e),s=i.indexOf(t);return s===-1?null:r==="left"||r==="up"?s>0?i[s-1]:null:s<i.length-1?i[s+1]:null}const K=wn((e,t)=>({layouts:{},currentPresetIndex:0,getLayout:r=>t().layouts[r]??null,setLayout:(r,i)=>e(s=>({layouts:{...s.layouts,[r]:i}})),addPaneToProject:(r,i,s,n)=>e(o=>{const l=o.layouts[r]??null,a=LS(l,i,s,n);return{layouts:{...o.layouts,[r]:a}}}),removePaneFromProject:(r,i)=>e(s=>{const n=s.layouts[r];if(!n)return s;const o=qo(n,i);return{layouts:{...s.layouts,[r]:o}}}),resizePaneInProject:(r,i,s)=>e(n=>{const o=n.layouts[r];if(!o)return n;const l=fc(o,i,s);return{layouts:{...n.layouts,[r]:l}}}),swapPanesInProject:(r,i,s)=>e(n=>{const o=n.layouts[r];if(!o)return n;const l=_c(o,i,s);return{layouts:{...n.layouts,[r]:l}}}),movePaneInProject:(r,i,s,n)=>e(o=>{const l=o.layouts[r];if(!l)return o;const a=DS(l,i,s,n);return{layouts:{...o.layouts,[r]:a}}}),applyPresetToProject:(r,i)=>e(s=>{const n=Xi[s.currentPresetIndex],o=gi(i,n);return{layouts:{...s.layouts,[r]:o}}}),cyclePreset:(r,i)=>e(s=>{const n=(s.currentPresetIndex+1)%Xi.length,o=Xi[n],l=gi(i,o);return{currentPresetIndex:n,layouts:{...s.layouts,[r]:l}}}),removeProjectLayout:r=>e(i=>{const{[r]:s,...n}=i.layouts;return{layouts:n}})}));function fo(e){document.documentElement.setAttribute("data-theme",e)}function mc(e){return e==="system"?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":e}function RS(){const e=document.cookie.match(/(?:^|; )paneful_theme=(system|dark|light)/);return(e==null?void 0:e[1])??"system"}function ea(e){document.cookie=`paneful_theme=${e};path=/;max-age=31536000;SameSite=Lax`}const cm=RS();fo(cm);function Kn(e){const{theme:t,sidebarWidth:r,editorSyncEnabled:i}=e();Ks({ui:{theme:t,sidebarWidth:r,editorSyncEnabled:i}})}const W=wn((e,t)=>({focusedTerminalId:null,sidebarOpen:!0,sidebarWidth:224,draggingTerminalId:null,dropTarget:null,connectionStatus:"connecting",editorSyncEnabled:!0,theme:cm,syncToast:null,searchTerminalId:null,commandPaletteOpen:!1,pendingFavouriteLaunchId:null,setFocusedTerminal:r=>e({focusedTerminalId:r}),toggleSidebar:()=>e(r=>({sidebarOpen:!r.sidebarOpen})),setSidebarOpen:r=>e({sidebarOpen:r}),setSidebarWidth:r=>{const i=Math.min(400,Math.max(160,r));e({sidebarWidth:i}),Kn(t)},setDragging:r=>e({draggingTerminalId:r}),setDropTarget:r=>e({dropTarget:r}),setConnectionStatus:r=>e({connectionStatus:r}),toggleEditorSync:()=>{e(r=>({editorSyncEnabled:!r.editorSyncEnabled})),Kn(t)},setTheme:r=>{ea(r),fo(r),e({theme:r}),Kn(t)},cycleTheme:()=>{const r=["system","light","dark"],i=t().theme,s=r[(r.indexOf(i)+1)%r.length];ea(s),fo(s),e({theme:s}),Kn(t)},openSearch:r=>e({searchTerminalId:r}),closeSearch:()=>e({searchTerminalId:null}),toggleCommandPalette:()=>e(r=>({commandPaletteOpen:!r.commandPaletteOpen})),closeCommandPalette:()=>e({commandPaletteOpen:!1}),requestFavouriteLaunch:r=>e({pendingFavouriteLaunchId:r}),clearPendingFavouriteLaunch:()=>e({pendingFavouriteLaunchId:null}),showSyncToast:r=>{e({syncToast:{projectName:r,id:Date.now()}})},dismissSyncToast:()=>e({syncToast:null}),hydrateFromServer:async()=>{try{const i=await(await fetch("/api/settings")).json();if(i.ui){const{theme:s,sidebarWidth:n,editorSyncEnabled:o}=i.ui;s&&(ea(s),fo(s)),e({...s?{theme:s}:{},...n!==void 0?{sidebarWidth:n}:{},...o!==void 0?{editorSyncEnabled:o}:{}})}}catch{}}}));/**
|
|
57
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
58
|
+
* @license MIT
|
|
59
|
+
*
|
|
60
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
61
|
+
* @license MIT
|
|
62
|
+
*
|
|
63
|
+
* Originally forked from (with the author's permission):
|
|
64
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
65
|
+
* http://bellard.org/jslinux/
|
|
66
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
67
|
+
*/var hm=Object.defineProperty,MS=Object.getOwnPropertyDescriptor,NS=(e,t)=>{for(var r in t)hm(e,r,{get:t[r],enumerable:!0})},ke=(e,t,r,i)=>{for(var s=i>1?void 0:i?MS(t,r):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=(i?o(t,r,s):o(s))||s);return i&&s&&hm(t,r,s),s},$=(e,t)=>(r,i)=>t(r,i,e),Ad="Terminal input",vc={get:()=>Ad,set:e=>Ad=e},Id="Too much output to announce, navigate to rows manually to read",gc={get:()=>Id,set:e=>Id=e};function BS(e){return e.replace(/\r?\n/g,"\r")}function OS(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function AS(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function IS(e,t,r,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");um(s,t,r,i)}}function um(e,t,r,i){e=BS(e),e=OS(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function dm(e,t,r){let i=r.getBoundingClientRect(),s=e.clientX-i.left-10,n=e.clientY-i.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 zd(e,t,r,i,s){dm(e,t,r),s&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Tr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function yl(e,t=0,r=e.length){let i="";for(let s=t;s<r;++s){let n=e[s];n>65535?(n-=65536,i+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):i+=String.fromCharCode(n)}return i}var zS=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let i=0,s=0;if(this._interim){let n=e.charCodeAt(s++);56320<=n&&n<=57343?t[i++]=(this._interim-55296)*1024+n-56320+65536:(t[i++]=this._interim,t[i++]=n),this._interim=0}for(let n=s;n<r;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return this._interim=o,i;let l=e.charCodeAt(n);56320<=l&&l<=57343?t[i++]=(o-55296)*1024+l-56320+65536:(t[i++]=o,t[i++]=l);continue}o!==65279&&(t[i++]=o)}return i}},jS=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let i=0,s,n,o,l,a=0,c=0;if(this.interim[0]){let d=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,f=w-p;for(;c<f;){if(c>=r)return 0;if(g=e[c++],(g&192)!==128){c--,d=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}d||(w===2?m<128?c--:t[i++]=m:w===3?m<2048||m>=55296&&m<=57343||m===65279||(t[i++]=m):m<65536||m>1114111||(t[i++]=m)),this.interim.fill(0)}let u=r-4,h=c;for(;h<r;){for(;h<u&&!((s=e[h])&128)&&!((n=e[h+1])&128)&&!((o=e[h+2])&128)&&!((l=e[h+3])&128);)t[i++]=s,t[i++]=n,t[i++]=o,t[i++]=l,h+=4;if(s=e[h++],s<128)t[i++]=s;else if((s&224)===192){if(h>=r)return this.interim[0]=s,i;if(n=e[h++],(n&192)!==128){h--;continue}if(a=(s&31)<<6|n&63,a<128){h--;continue}t[i++]=a}else if((s&240)===224){if(h>=r)return this.interim[0]=s,i;if(n=e[h++],(n&192)!==128){h--;continue}if(h>=r)return this.interim[0]=s,this.interim[1]=n,i;if(o=e[h++],(o&192)!==128){h--;continue}if(a=(s&15)<<12|(n&63)<<6|o&63,a<2048||a>=55296&&a<=57343||a===65279)continue;t[i++]=a}else if((s&248)===240){if(h>=r)return this.interim[0]=s,i;if(n=e[h++],(n&192)!==128){h--;continue}if(h>=r)return this.interim[0]=s,this.interim[1]=n,i;if(o=e[h++],(o&192)!==128){h--;continue}if(h>=r)return this.interim[0]=s,this.interim[1]=n,this.interim[2]=o,i;if(l=e[h++],(l&192)!==128){h--;continue}if(a=(s&7)<<18|(n&63)<<12|(o&63)<<6|l&63,a<65536||a>1114111)continue;t[i++]=a}}return i}},fm="",Or=" ",xn=class _m{constructor(){this.fg=0,this.bg=0,this.extended=new Yo}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new _m;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Yo=class pm{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new pm(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Nt=class mm extends xn{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Yo,this.combinedData=""}static fromCharData(t){let r=new mm;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Tr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},jd="di$target",yc="di$dependencies",ta=new Map;function $S(e){return e[yc]||[]}function Ke(e){if(ta.has(e))return ta.get(e);let t=function(r,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");FS(t,r,s)};return t._id=e,ta.set(e,t),t}function FS(e,t,r){t[jd]===t?t[yc].push({id:e,index:r}):(t[yc]=[{id:e,index:r}],t[jd]=t)}var at=Ke("BufferService"),vm=Ke("CoreMouseService"),Ci=Ke("CoreService"),WS=Ke("CharsetService"),ru=Ke("InstantiationService"),gm=Ke("LogService"),ct=Ke("OptionsService"),ym=Ke("OscLinkService"),HS=Ke("UnicodeService"),Cn=Ke("DecorationService"),Sc=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var u;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let i=[],s=this._optionsService.rawOptions.linkHandler,n=new Nt,o=r.getTrimmedLength(),l=-1,a=-1,c=!1;for(let h=0;h<o;h++)if(!(a===-1&&!r.hasContent(h))){if(r.loadCell(h,n),n.hasExtendedAttrs()&&n.extended.urlId)if(a===-1){a=h,l=n.extended.urlId;continue}else c=n.extended.urlId!==l;else a!==-1&&(c=!0);if(c||a!==-1&&h===o-1){let d=(u=this._oscLinkService.getLinkData(l))==null?void 0:u.uri;if(d){let m={start:{x:a+1,y:e},end:{x:h+(!c&&h===o-1?1:0),y:e}},p=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let g=new URL(d);["http:","https:"].includes(g.protocol)||(p=!0)}catch{p=!0}p||i.push({text:d,range:m,activate:(g,w)=>s?s.activate(g,w,m):US(g,w),hover:(g,w)=>{var f;return(f=s==null?void 0:s.hover)==null?void 0:f.call(s,g,w,m)},leave:(g,w)=>{var f;return(f=s==null?void 0:s.leave)==null?void 0:f.call(s,g,w,m)}})}c=!1,n.hasExtendedAttrs()&&n.extended.urlId?(a=h,l=n.extended.urlId):(a=-1,l=-1)}}t(i)}};Sc=ke([$(0,at),$(1,ct),$(2,ym)],Sc);function US(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
68
|
+
|
|
69
|
+
WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Sl=Ke("CharSizeService"),yr=Ke("CoreBrowserService"),iu=Ke("MouseService"),Sr=Ke("RenderService"),KS=Ke("SelectionService"),Sm=Ke("CharacterJoinerService"),as=Ke("ThemeService"),wm=Ke("LinkProviderService"),VS=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?$d.isErrorNoTelemetry(e)?new $d(e.message+`
|
|
70
|
+
|
|
71
|
+
`+e.stack):new Error(e.message+`
|
|
72
|
+
|
|
73
|
+
`+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)}},qS=new VS;function _o(e){YS(e)||qS.onUnexpectedError(e)}var wc="Canceled";function YS(e){return e instanceof XS?!0:e instanceof Error&&e.name===wc&&e.message===wc}var XS=class extends Error{constructor(){super(wc),this.name=this.message}};function GS(e){return new Error(`Illegal argument: ${e}`)}var $d=class xc extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof xc)return t;let r=new xc;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Cc=class xm extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,xm.prototype)}};function mt(e,t=0){return e[e.length-(1+t)]}var QS;(e=>{function t(n){return n<0}e.isLessThan=t;function r(n){return n<=0}e.isLessThanOrEqual=r;function i(n){return n>0}e.isGreaterThan=i;function s(n){return n===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(QS||(QS={}));function JS(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var Cm;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(S){yield S}e.single=s;function n(S){return t(S)?S:s(S)}e.wrap=n;function o(S){return S||r}e.from=o;function*l(S){for(let C=S.length-1;C>=0;C--)yield S[C]}e.reverse=l;function a(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(S){return S[Symbol.iterator]().next().value}e.first=c;function u(S,C){let P=0;for(let M of S)if(C(M,P++))return!0;return!1}e.some=u;function h(S,C){for(let P of S)if(C(P))return P}e.find=h;function*d(S,C){for(let P of S)C(P)&&(yield P)}e.filter=d;function*m(S,C){let P=0;for(let M of S)yield C(M,P++)}e.map=m;function*p(S,C){let P=0;for(let M of S)yield*C(M,P++)}e.flatMap=p;function*g(...S){for(let C of S)yield*C}e.concat=g;function w(S,C,P){let M=P;for(let z of S)M=C(M,z);return M}e.reduce=w;function*f(S,C,P=S.length){for(C<0&&(C+=S.length),P<0?P+=S.length:P>S.length&&(P=S.length);C<P;C++)yield S[C]}e.slice=f;function v(S,C=Number.POSITIVE_INFINITY){let P=[];if(C===0)return[P,S];let M=S[Symbol.iterator]();for(let z=0;z<C;z++){let Y=M.next();if(Y.done)return[P,e.empty()];P.push(Y.value)}return[P,{[Symbol.iterator](){return M}}]}e.consume=v;async function y(S){let C=[];for await(let P of S)C.push(P);return Promise.resolve(C)}e.asyncToArray=y})(Cm||(Cm={}));function yi(e){if(Cm.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function ZS(...e){return me(()=>yi(e))}function me(e){return{dispose:JS(()=>{e()})}}var bm=class km{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{yi(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?km.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};bm.DISABLE_DISPOSED_WARNING=!1;var Kr=bm,G=class{constructor(){this._store=new Kr,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};G.None=Object.freeze({dispose(){}});var ss=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var r;this._isDisposed||t===this._value||((r=this._value)==null||r.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},dr=typeof window=="object"?window:globalThis,bc=class kc{constructor(t){this.element=t,this.next=kc.Undefined,this.prev=kc.Undefined}};bc.Undefined=new bc(void 0);var ge=bc,Fd=class{constructor(){this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ge.Undefined}clear(){let e=this._first;for(;e!==ge.Undefined;){let t=e.next;e.prev=ge.Undefined,e.next=ge.Undefined,e=t}this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ge(e);if(this._first===ge.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==ge.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ge.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ge.Undefined&&e.next!==ge.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ge.Undefined&&e.next===ge.Undefined?(this._first=ge.Undefined,this._last=ge.Undefined):e.next===ge.Undefined?(this._last=this._last.prev,this._last.next=ge.Undefined):e.prev===ge.Undefined&&(this._first=this._first.next,this._first.prev=ge.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ge.Undefined;)yield e.element,e=e.next}},e0=globalThis.performance&&typeof globalThis.performance.now=="function",t0=class Em{static create(t){return new Em(t)}constructor(t){this._now=e0&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Xe;(e=>{e.None=()=>G.None;function t(L,x){return h(L,()=>{},0,void 0,!0,void 0,x)}e.defer=t;function r(L){return(x,E=null,k)=>{let D=!1,O;return O=L(b=>{if(!D)return O?O.dispose():D=!0,x.call(E,b)},null,k),D&&O.dispose(),O}}e.once=r;function i(L,x,E){return c((k,D=null,O)=>L(b=>k.call(D,x(b)),null,O),E)}e.map=i;function s(L,x,E){return c((k,D=null,O)=>L(b=>{x(b),k.call(D,b)},null,O),E)}e.forEach=s;function n(L,x,E){return c((k,D=null,O)=>L(b=>x(b)&&k.call(D,b),null,O),E)}e.filter=n;function o(L){return L}e.signal=o;function l(...L){return(x,E=null,k)=>{let D=ZS(...L.map(O=>O(b=>x.call(E,b))));return u(D,k)}}e.any=l;function a(L,x,E,k){let D=E;return i(L,O=>(D=x(D,O),D),k)}e.reduce=a;function c(L,x){let E,k={onWillAddFirstListener(){E=L(D.fire,D)},onDidRemoveLastListener(){E==null||E.dispose()}},D=new I(k);return x==null||x.add(D),D.event}function u(L,x){return x instanceof Array?x.push(L):x&&x.add(L),L}function h(L,x,E=100,k=!1,D=!1,O,b){let A,j,V,J=0,le,ee={leakWarningThreshold:O,onWillAddFirstListener(){A=L(re=>{J++,j=x(j,re),k&&!V&&(he.fire(j),j=void 0),le=()=>{let Me=j;j=void 0,V=void 0,(!k||J>1)&&he.fire(Me),J=0},typeof E=="number"?(clearTimeout(V),V=setTimeout(le,E)):V===void 0&&(V=0,queueMicrotask(le))})},onWillRemoveListener(){D&&J>0&&(le==null||le())},onDidRemoveLastListener(){le=void 0,A.dispose()}},he=new I(ee);return b==null||b.add(he),he.event}e.debounce=h;function d(L,x=0,E){return e.debounce(L,(k,D)=>k?(k.push(D),k):[D],x,void 0,!0,void 0,E)}e.accumulate=d;function m(L,x=(k,D)=>k===D,E){let k=!0,D;return n(L,O=>{let b=k||!x(O,D);return k=!1,D=O,b},E)}e.latch=m;function p(L,x,E){return[e.filter(L,x,E),e.filter(L,k=>!x(k),E)]}e.split=p;function g(L,x=!1,E=[],k){let D=E.slice(),O=L(j=>{D?D.push(j):A.fire(j)});k&&k.add(O);let b=()=>{D==null||D.forEach(j=>A.fire(j)),D=null},A=new I({onWillAddFirstListener(){O||(O=L(j=>A.fire(j)),k&&k.add(O))},onDidAddFirstListener(){D&&(x?setTimeout(b):b())},onDidRemoveLastListener(){O&&O.dispose(),O=null}});return k&&k.add(A),A.event}e.buffer=g;function w(L,x){return(E,k,D)=>{let O=x(new v);return L(function(b){let A=O.evaluate(b);A!==f&&E.call(k,A)},void 0,D)}}e.chain=w;let f=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(x){return this.steps.push(x),this}forEach(x){return this.steps.push(E=>(x(E),E)),this}filter(x){return this.steps.push(E=>x(E)?E:f),this}reduce(x,E){let k=E;return this.steps.push(D=>(k=x(k,D),k)),this}latch(x=(E,k)=>E===k){let E=!0,k;return this.steps.push(D=>{let O=E||!x(D,k);return E=!1,k=D,O?D:f}),this}evaluate(x){for(let E of this.steps)if(x=E(x),x===f)break;return x}}function y(L,x,E=k=>k){let k=(...A)=>b.fire(E(...A)),D=()=>L.on(x,k),O=()=>L.removeListener(x,k),b=new I({onWillAddFirstListener:D,onDidRemoveLastListener:O});return b.event}e.fromNodeEventEmitter=y;function S(L,x,E=k=>k){let k=(...A)=>b.fire(E(...A)),D=()=>L.addEventListener(x,k),O=()=>L.removeEventListener(x,k),b=new I({onWillAddFirstListener:D,onDidRemoveLastListener:O});return b.event}e.fromDOMEventEmitter=S;function C(L){return new Promise(x=>r(L)(x))}e.toPromise=C;function P(L){let x=new I;return L.then(E=>{x.fire(E)},()=>{x.fire(void 0)}).finally(()=>{x.dispose()}),x.event}e.fromPromise=P;function M(L,x){return L(E=>x.fire(E))}e.forward=M;function z(L,x,E){return x(E),L(k=>x(k))}e.runAndSubscribe=z;class Y{constructor(x,E){this._observable=x,this._counter=0,this._hasChanged=!1;let k={onWillAddFirstListener:()=>{x.addObserver(this)},onDidRemoveLastListener:()=>{x.removeObserver(this)}};this.emitter=new I(k),E&&E.add(this.emitter)}beginUpdate(x){this._counter++}handlePossibleChange(x){}handleChange(x,E){this._hasChanged=!0}endUpdate(x){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function U(L,x){return new Y(L,x).emitter.event}e.fromObservable=U;function q(L){return(x,E,k)=>{let D=0,O=!1,b={beginUpdate(){D++},endUpdate(){D--,D===0&&(L.reportChanges(),O&&(O=!1,x.call(E)))},handlePossibleChange(){},handleChange(){O=!0}};L.addObserver(b),L.reportChanges();let A={dispose(){L.removeObserver(b)}};return k instanceof Kr?k.add(A):Array.isArray(k)&&k.push(A),A}}e.fromObservableLight=q})(Xe||(Xe={}));var Ec=class Pc{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Pc._idPool++}`,Pc.all.add(this)}start(t){this._stopWatch=new t0,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Ec.all=new Set,Ec._idPool=0;var r0=Ec,i0=-1,Pm=class Lm{constructor(t,r,i=(Lm._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let a=new o0(l,n);this._errorHandler(a)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,s]of this._stacks)(!t||r<s)&&(t=[i,s],r=s);return t}};Pm._idPool=1;var s0=Pm,n0=class Dm{constructor(t){this.value=t}static create(){let t=new Error;return new Dm(t.stack??"")}print(){console.warn(this.value.split(`
|
|
74
|
+
`).slice(2).join(`
|
|
75
|
+
`))}},o0=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},l0=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},a0=0,ra=class{constructor(e){this.value=e,this.id=a0++}},c0=2,h0,I=class{constructor(t){var r,i,s,n;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new s0((t==null?void 0:t.onListenerError)??_o,((i=this._options)==null?void 0:i.leakWarningThreshold)??i0):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new r0(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var t,r,i,s;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||i.call(r),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(t,r,i)=>{var l,a,c,u,h;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let m=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new l0(`${d}. HINT: Stack shows most frequent listener (${m[1]}-times)`,m[0]);return(((l=this._options)==null?void 0:l.onListenerError)||_o)(p),G.None}if(this._disposed)return G.None;r&&(t=t.bind(r));let s=new ra(t),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=n0.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof ra?(this._deliveryQueue??(this._deliveryQueue=new u0),this._listeners=[this._listeners,s]):this._listeners.push(s):((c=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||c.call(a,this),this._listeners=s,(h=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||h.call(u,this)),this._size++;let o=me(()=>{n==null||n(),this._removeListener(s)});return i instanceof Kr?i.add(o):Array.isArray(i)&&i.push(o),o}),this._event}_removeListener(t){var n,o,l,a;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||a.call(l,this),this._size=0;return}let r=this._listeners,i=r.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*c0<=r.length){let c=0;for(let u=0;u<r.length;u++)r[u]?r[c++]=r[u]:s&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=c}}_deliver(t,r){var s;if(!t)return;let i=((s=this._options)==null?void 0:s.onListenerError)||_o;if(!i){t.value(r);return}try{t.value(r)}catch(n){i(n)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,i,s,n;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof ra)this._deliver(this._listeners,t);else{let o=this._deliveryQueue;o.enqueue(this,t,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},u0=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Lc=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new I,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new I,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Lc.INSTANCE=new Lc;var su=Lc;function d0(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}su.INSTANCE.onDidChangeZoomLevel;function f0(e){return su.INSTANCE.getZoomFactor(e)}su.INSTANCE.onDidChangeFullscreen;var cs=typeof navigator=="object"?navigator.userAgent:"",Dc=cs.indexOf("Firefox")>=0,_0=cs.indexOf("AppleWebKit")>=0,nu=cs.indexOf("Chrome")>=0,p0=!nu&&cs.indexOf("Safari")>=0;cs.indexOf("Electron/")>=0;cs.indexOf("Android")>=0;var ia=!1;if(typeof dr.matchMedia=="function"){let e=dr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=dr.matchMedia("(display-mode: fullscreen)");ia=e.matches,d0(dr,e,({matches:r})=>{ia&&t.matches||(ia=r)})}var Fi="en",Tc=!1,Rc=!1,po=!1,Tm=!1,Vn,mo=Fi,Wd=Fi,m0,It,ui=globalThis,qe,zf;typeof ui.vscode<"u"&&typeof ui.vscode.process<"u"?qe=ui.vscode.process:typeof process<"u"&&typeof((zf=process==null?void 0:process.versions)==null?void 0:zf.node)=="string"&&(qe=process);var jf,v0=typeof((jf=qe==null?void 0:qe.versions)==null?void 0:jf.electron)=="string",g0=v0&&(qe==null?void 0:qe.type)==="renderer",$f;if(typeof qe=="object"){Tc=qe.platform==="win32",Rc=qe.platform==="darwin",po=qe.platform==="linux",po&&qe.env.SNAP&&qe.env.SNAP_REVISION,qe.env.CI||qe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Vn=Fi,mo=Fi;let e=qe.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Vn=t.userLocale,Wd=t.osLocale,mo=t.resolvedLanguage||Fi,m0=($f=t.languagePack)==null?void 0:$f.translationsConfigFile}catch{}Tm=!0}else typeof navigator=="object"&&!g0?(It=navigator.userAgent,Tc=It.indexOf("Windows")>=0,Rc=It.indexOf("Macintosh")>=0,(It.indexOf("Macintosh")>=0||It.indexOf("iPad")>=0||It.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,po=It.indexOf("Linux")>=0,(It==null?void 0:It.indexOf("Mobi"))>=0,mo=globalThis._VSCODE_NLS_LANGUAGE||Fi,Vn=navigator.language.toLowerCase(),Wd=Vn):console.error("Unable to resolve platform.");var Rm=Tc,sr=Rc,y0=po,Hd=Tm,nr=It,br=mo,S0;(e=>{function t(){return br}e.value=t;function r(){return br.length===2?br==="en":br.length>=3?br[0]==="e"&&br[1]==="n"&&br[2]==="-":!1}e.isDefaultVariant=r;function i(){return br==="en"}e.isDefault=i})(S0||(S0={}));var w0=typeof ui.postMessage=="function"&&!ui.importScripts;(()=>{if(w0){let e=[];ui.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),n.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),ui.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var x0=!!(nr&&nr.indexOf("Chrome")>=0);nr&&nr.indexOf("Firefox")>=0;!x0&&nr&&nr.indexOf("Safari")>=0;nr&&nr.indexOf("Edg/")>=0;nr&&nr.indexOf("Android")>=0;var Pi=typeof navigator=="object"?navigator:{};Hd||document.queryCommandSupported&&document.queryCommandSupported("copy")||Pi&&Pi.clipboard&&Pi.clipboard.writeText,Hd||Pi&&Pi.clipboard&&Pi.clipboard.readText;var ou=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}},sa=new ou,Ud=new ou,Kd=new ou,C0=new Array(230),Mm;(e=>{function t(l){return sa.keyCodeToStr(l)}e.toString=t;function r(l){return sa.strToKeyCode(l)}e.fromString=r;function i(l){return Ud.keyCodeToStr(l)}e.toUserSettingsUS=i;function s(l){return Kd.keyCodeToStr(l)}e.toUserSettingsGeneral=s;function n(l){return Ud.strToKeyCode(l)||Kd.strToKeyCode(l)}e.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return sa.keyCodeToStr(l)}e.toElectronAccelerator=o})(Mm||(Mm={}));var b0=class Nm{constructor(t,r,i,s,n){this.ctrlKey=t,this.shiftKey=r,this.altKey=i,this.metaKey=s,this.keyCode=n}equals(t){return t instanceof Nm&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",i=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${r}${i}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new k0([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},k0=class{constructor(e){if(e.length===0)throw GS("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function E0(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return Mm.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Dc)switch(t){case 59:return 85;case 60:if(y0)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(sr)return 57;break}else if(_0&&(sr&&t===93||!sr&&t===92))return 57;return C0[t]||0}var P0=sr?256:2048,L0=512,D0=1024,T0=sr?2048:256,Vd=class{constructor(t){var i;this._standardKeyboardEventBrand=!0;let r=t;this.browserEvent=r,this.target=r.target,this.ctrlKey=r.ctrlKey,this.shiftKey=r.shiftKey,this.altKey=r.altKey,this.metaKey=r.metaKey,this.altGraphKey=(i=r.getModifierState)==null?void 0:i.call(r,"AltGraph"),this.keyCode=E0(r),this.code=r.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(t){return this._asKeybinding===t}_computeKeybinding(){let t=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode);let r=0;return this.ctrlKey&&(r|=P0),this.altKey&&(r|=L0),this.shiftKey&&(r|=D0),this.metaKey&&(r|=T0),r|=t,r}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new b0(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},qd=new WeakMap;function R0(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var M0=class{static getSameOriginWindowChain(e){let t=qd.get(e);if(!t){t=[],qd.set(e,t);let r=e,i;do i=R0(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 r=0,i=0,s=this.getSameOriginWindowChain(e);for(let n of s){let o=n.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,i+=(o==null?void 0:o.scrollX)??0,o===t||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();r+=l.top,i+=l.left}return{top:r,left:i}}},qn=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=M0.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Yd=class{constructor(e,t=0,r=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let i=!1;if(nu){let n=navigator.userAgent.match(/Chrome\/(\d+)/);i=(n?parseInt(n[1]):123)<=122}if(e){let n=e,o=e,l=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")i?this.deltaY=n.wheelDeltaY/(120*l):this.deltaY=n.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Dc&&!sr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")p0&&Rm?this.deltaX=-(n.wheelDeltaX/120):i?this.deltaX=n.wheelDeltaX/(120*l):this.deltaX=n.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Dc&&!sr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Bm=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),N0;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof B0?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Xe.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Bm})})(N0||(N0={}));var B0=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?Bm:(this._emitter||(this._emitter=new I),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},lu=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Cc("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Cc("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},O0=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new Cc("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},t);this.disposable=me(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},A0;(e=>{async function t(i){let s,n=await Promise.all(i.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return n}e.settled=t;function r(i){return new Promise(async(s,n)=>{try{await i(s,n)}catch(o){n(o)}})}e.withAsyncBody=r})(A0||(A0={}));var Xd=class kt{static fromArray(t){return new kt(r=>{r.emitMany(t)})}static fromPromise(t){return new kt(async r=>{r.emitMany(await t)})}static fromPromises(t){return new kt(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new kt(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new I,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Xe.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new kt(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return kt.map(this,t)}static filter(t,r){return new kt(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return kt.filter(this,t)}static coalesce(t){return kt.filter(t,r=>!!r)}coalesce(){return kt.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return kt.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Xd.EMPTY=Xd.fromArray([]);var{getWindow:tr,getWindowId:I0,onDidRegisterWindow:z0}=function(){let e=new Map,t={window:dr,disposables:new Kr};e.set(dr.vscodeWindowId,t);let r=new I,i=new I,s=new I;function n(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(o){if(e.has(o.vscodeWindowId))return G.None;let l=new Kr,a={window:o,disposables:l.add(new Kr)};return e.set(o.vscodeWindowId,a),l.add(me(()=>{e.delete(o.vscodeWindowId),i.fire(o)})),l.add(H(o,ze.BEFORE_UNLOAD,()=>{s.fire(o)})),r.fire(a),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){var c;let l=o;if((c=l==null?void 0:l.ownerDocument)!=null&&c.defaultView)return l.ownerDocument.defaultView.window;let a=o;return a!=null&&a.view?a.view.window:dr},getDocument(o){return tr(o).document}}}(),j0=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!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 H(e,t,r,i){return new j0(e,t,r,i)}var Gd=function(e,t,r,i){return H(e,t,r,i)},au,$0=class extends O0{constructor(e){super(),this.defaultTarget=e&&tr(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},Qd=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){_o(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,s=n=>{r.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),i.set(n,!0);o.length>0;)o.sort(Qd.sort),o.shift().execute();i.set(n,!1)};au=(n,o,l=0)=>{let a=I0(n),c=new Qd(o,l),u=e.get(a);return u||(u=[],e.set(a,u)),u.push(c),r.get(a)||(r.set(a,!0),n.requestAnimationFrame(()=>s(a))),c}})();function F0(e){let t=e.getBoundingClientRect(),r=tr(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var ze={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"},W0=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=ht(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ht(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ht(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ht(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ht(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ht(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ht(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ht(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ht(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ht(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ht(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=ht(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=ht(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ht(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 ht(e){return typeof e=="number"?`${e}px`:e}function Vs(e){return new W0(e)}var Om=class{constructor(){this._hooks=new Kr,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 r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,i,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=s;let n=e;try{e.setPointerCapture(t),this._hooks.add(me(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=tr(e)}this._hooks.add(H(n,ze.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(H(n,ze.POINTER_UP,o=>this.stopMonitoring(!0)))}};function H0(e,t,r){let i=null,s=null;if(typeof r.value=="function"?(i="value",s=r.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",s=r.get),!s)throw new Error("not supported");let n=`$memoize$${t}`;r[i]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var Qt;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Qt||(Qt={}));var Rs=class et extends G{constructor(){super(),this.dispatched=!1,this.targets=new Fd,this.ignoreTargets=new Fd,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Xe.runAndSubscribe(z0,({window:t,disposables:r})=>{r.add(H(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(H(t.document,"touchend",i=>this.onTouchEnd(t,i))),r.add(H(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:dr,disposables:this._store}))}static addTarget(t){if(!et.isTouchDevice())return G.None;et.INSTANCE||(et.INSTANCE=new et);let r=et.INSTANCE.targets.push(t);return me(r)}static ignoreTarget(t){if(!et.isTouchDevice())return G.None;et.INSTANCE||(et.INSTANCE=new et);let r=et.INSTANCE.ignoreTargets.push(t);return me(r)}static isTouchDevice(){return"ontouchstart"in dr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=t.targetTouches.length;i<s;i++){let n=t.targetTouches.item(i);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:r,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[r],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(Qt.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let i=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=r.changedTouches.length;n<o;n++){let l=r.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let a=this.activeTouches[l.identifier],c=Date.now()-a.initialTimeStamp;if(c<et.HOLD_DELAY&&Math.abs(a.initialPageX-mt(a.rollingPageX))<30&&Math.abs(a.initialPageY-mt(a.rollingPageY))<30){let u=this.newGestureEvent(Qt.Tap,a.initialTarget);u.pageX=mt(a.rollingPageX),u.pageY=mt(a.rollingPageY),this.dispatchEvent(u)}else if(c>=et.HOLD_DELAY&&Math.abs(a.initialPageX-mt(a.rollingPageX))<30&&Math.abs(a.initialPageY-mt(a.rollingPageY))<30){let u=this.newGestureEvent(Qt.Contextmenu,a.initialTarget);u.pageX=mt(a.rollingPageX),u.pageY=mt(a.rollingPageY),this.dispatchEvent(u)}else if(s===1){let u=mt(a.rollingPageX),h=mt(a.rollingPageY),d=mt(a.rollingTimestamps)-a.rollingTimestamps[0],m=u-a.rollingPageX[0],p=h-a.rollingPageY[0],g=[...this.targets].filter(w=>a.initialTarget instanceof Node&&w.contains(a.initialTarget));this.inertia(t,g,i,Math.abs(m)/d,m>0?1:-1,u,Math.abs(p)/d,p>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Qt.End,a.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=r,i.tapCount=0,i}dispatchEvent(t){if(t.type===Qt.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>et.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,t.tapCount=i}else(t.type===Qt.Change||t.type===Qt.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let s=0,n=t.initialTarget;for(;n&&n!==i;)s++,n=n.parentElement;r.push([s,i])}r.sort((i,s)=>i[0]-s[0]);for(let[i,s]of r)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,i,s,n,o,l,a,c){this.handle=au(t,()=>{let u=Date.now(),h=u-i,d=0,m=0,p=!0;s+=et.SCROLL_FRICTION*h,l+=et.SCROLL_FRICTION*h,s>0&&(p=!1,d=n*s*h),l>0&&(p=!1,m=a*l*h);let g=this.newGestureEvent(Qt.Change);g.translationX=d,g.translationY=m,r.forEach(w=>w.dispatchEvent(g)),p||this.inertia(t,r,u,s,n,o+d,l,a,c+m)})}onTouchMove(t){let r=Date.now();for(let i=0,s=t.changedTouches.length;i<s;i++){let n=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],l=this.newGestureEvent(Qt.Change,o.initialTarget);l.translationX=n.pageX-mt(o.rollingPageX),l.translationY=n.pageY-mt(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Rs.SCROLL_FRICTION=-.005,Rs.HOLD_DELAY=700,Rs.CLEAR_TAP_COUNT_TIME=400,ke([H0],Rs,"isTouchDevice",1);var U0=Rs,cu=class extends G{onclick(e,t){this._register(H(e,ze.CLICK,r=>t(new qn(tr(e),r))))}onmousedown(e,t){this._register(H(e,ze.MOUSE_DOWN,r=>t(new qn(tr(e),r))))}onmouseover(e,t){this._register(H(e,ze.MOUSE_OVER,r=>t(new qn(tr(e),r))))}onmouseleave(e,t){this._register(H(e,ze.MOUSE_LEAVE,r=>t(new qn(tr(e),r))))}onkeydown(e,t){this._register(H(e,ze.KEY_DOWN,r=>t(new Vd(r))))}onkeyup(e,t){this._register(H(e,ze.KEY_UP,r=>t(new Vd(r))))}oninput(e,t){this._register(H(e,ze.INPUT,t))}onblur(e,t){this._register(H(e,ze.BLUR,t))}onfocus(e,t){this._register(H(e,ze.FOCUS,t))}onchange(e,t){this._register(H(e,ze.CHANGE,t))}ignoreGesture(e){return U0.ignoreTarget(e)}},Jd=11,K0=class extends cu{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=Jd+"px",this.domNode.style.height=Jd+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Om),this._register(Gd(this.bgDomNode,ze.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Gd(this.domNode,ze.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new $0),this._pointerdownScheduleRepeatTimer=this._register(new lu)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,tr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},V0=class Mc{constructor(t,r,i,s,n,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,s=s|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,r<0&&(r=0),s+r>i&&(s=i-r),s<0&&(s=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=r,this.scrollWidth=i,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Mc(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Mc(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let i=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,a=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},q0=class extends G{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new I),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new V0(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),(i=this._smoothScrolling)==null||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(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let i;t?i=new ef(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=ef.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},Zd=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function na(e,t){let r=t-e;return function(i){return e+r*G0(i)}}function Y0(e,t,r){return function(i){return i<r?e(i/r):t((i-r)/(1-r))}}var ef=class Nc{constructor(t,r,i,s){this.from=t,this.to=r,this.duration=s,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(t,r,i){if(Math.abs(t-r)>2.5*i){let s,n;return t<r?(s=t+.75*i,n=r-.75*i):(s=t-.75*i,n=r+.75*i),Y0(na(t,s),na(n,r),.33)}return na(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let i=this.scrollLeft(r),s=this.scrollTop(r);return new Zd(i,s,!1)}return new Zd(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,i){return Nc.start(t,r,i)}static start(t,r,i){i=i+10;let s=Date.now()-10;return new Nc(t,r,s,i)}};function X0(e){return Math.pow(e,3)}function G0(e){return 1-X0(1-e)}var Q0=class extends G{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new lu)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},J0=140,Am=class extends cu{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 Q0(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Om),this._shouldRender=!0,this.domNode=Vs(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(H(this.domNode.domNode,ze.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new K0(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,i){this.slider=Vs(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(H(this.slider.domNode,ze.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);r<=s&&s<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let s=F0(this.domNode.domNode);t=e.pageX-s.left,r=e.pageY-s.top}let i=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let n=this._sliderOrthogonalPointerPosition(s),o=Math.abs(n-r);if(Rm&&o>J0){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let l=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Im=class Bc{constructor(t,r,i,s,n,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Bc(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,i,s,n){let o=Math.max(0,i-t),l=Math.max(0,o-2*r),a=s>0&&s>i;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(i*l/s))),u=(l-c)/(s-i),h=n*u;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=Bc._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,i=this._scrollPosition;return r<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},Z0=class extends Am{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Im(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},e1=class extends Am{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Im(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},t1=500,tf=50,r1=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Oc=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,i=1,s=this._rear;do{let n=s===this._front?t:Math.pow(2,-i);if(t-=n,r+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(nu){let r=tr(t.browserEvent),i=f0(r);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,i){let s=null,n=new r1(t,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,s)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),r){let s=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(r.deltaX),l=Math.abs(r.deltaY),a=Math.max(Math.min(s,o),1),c=Math.max(Math.min(n,l),1),u=Math.max(s,o),h=Math.max(n,l);u%a===0&&h%c===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Oc.INSTANCE=new Oc;var i1=Oc,s1=class extends cu{constructor(e,t,r){super(),this._onScroll=this._register(new I),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new I),this.onWillScroll=this._onWillScroll.event,this._options=o1(t),this._scrollable=r,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let i={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new e1(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new Z0(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Vs(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Vs(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Vs(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new lu),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=yi(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,sr&&(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 Yd(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=yi(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Yd(r))};this._mouseWheelToDispose.push(H(this._listenOnDomNode,ze.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=i1.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let l=!sr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),c={};if(n){let u=tf*n,h=a.scrollTop-(u<0?Math.floor(u):Math.ceil(u));this._verticalScrollbar.writeScrollPosition(c,h)}if(o){let u=tf*o,h=a.scrollLeft-(u<0?Math.floor(u):Math.ceil(u));this._horizontalScrollbar.writeScrollPosition(c,h)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),r=!0)}let i=r;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(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,r=e.scrollLeft>0,i=r?" left":"",s=t?" top":"",n=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${i}`)}}_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(),t1)}},n1=class extends s1{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function o1(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,sr&&(t.className+=" mac"),t}var Ac=class extends G{constructor(e,t,r,i,s,n,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new I),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new q0({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>au(i.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new n1(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Xe.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(me(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(me(()=>this._styleElement.remove())),this._register(Xe.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(`
|
|
76
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Ac=ke([$(2,at),$(3,yr),$(4,vm),$(5,as),$(6,ct),$(7,Sr)],Ac);var Ic=class extends G{constructor(e,t,r,i,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=i,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(n=>this._removeDecoration(n))),this._register(me(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Ic=ke([$(1,at),$(2,yr),$(3,Cn),$(4,Sr)],Ic);var l1=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Xt={full:0,left:0,center:0,right:0},kr={full:0,left:0,center:0,right:0},ws={full:0,left:0,center:0,right:0},Xo=class extends G{constructor(e,t,r,i,s,n,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=i,this._renderService=s,this._optionsService=n,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new l1,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(me(()=>{var u;return(u=this._canvas)==null?void 0:u.remove()}));let a=this._canvas.getContext("2d");if(a)this._ctx=a;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);kr.full=this._canvas.width,kr.left=e,kr.center=t,kr.right=e,this._refreshDrawHeightConstants(),ws.full=1,ws.left=1,ws.center=1+kr.left,ws.right=1+kr.left+kr.center}_refreshDrawHeightConstants(){Xt.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);Xt.left=t,Xt.center=t,Xt.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xt.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xt.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xt.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Xt.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(ws[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Xt[e.position||"full"]/2),kr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Xt[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Xo=ke([$(2,at),$(3,Cn),$(4,Sr),$(5,ct),$(6,as),$(7,yr)],Xo);var R;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
77
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(R||(R={}));var vo;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(vo||(vo={}));var zm;(e=>e.ST=`${R.ESC}\\`)(zm||(zm={}));var zc=class{constructor(e,t,r,i,s,n){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._coreService=s,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${R.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};zc=ke([$(2,at),$(3,ct),$(4,Ci),$(5,Sr)],zc);var Fe=0,We=0,He=0,Ce=0,rf={css:"#00000000",rgba:0},Te;(e=>{function t(s,n,o,l){return l!==void 0?`#${Zr(s)}${Zr(n)}${Zr(o)}${Zr(l)}`:`#${Zr(s)}${Zr(n)}${Zr(o)}`}e.toCss=t;function r(s,n,o,l=255){return(s<<24|n<<16|o<<8|l)>>>0}e.toRgba=r;function i(s,n,o,l){return{css:e.toCss(s,n,o,l),rgba:e.toRgba(s,n,o,l)}}e.toColor=i})(Te||(Te={}));var fe;(e=>{function t(a,c){if(Ce=(c.rgba&255)/255,Ce===1)return{css:c.css,rgba:c.rgba};let u=c.rgba>>24&255,h=c.rgba>>16&255,d=c.rgba>>8&255,m=a.rgba>>24&255,p=a.rgba>>16&255,g=a.rgba>>8&255;Fe=m+Math.round((u-m)*Ce),We=p+Math.round((h-p)*Ce),He=g+Math.round((d-g)*Ce);let w=Te.toCss(Fe,We,He),f=Te.toRgba(Fe,We,He);return{css:w,rgba:f}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function i(a,c,u){let h=go.ensureContrastRatio(a.rgba,c.rgba,u);if(h)return Te.toColor(h>>24&255,h>>16&255,h>>8&255)}e.ensureContrastRatio=i;function s(a){let c=(a.rgba|255)>>>0;return[Fe,We,He]=go.toChannels(c),{css:Te.toCss(Fe,We,He),rgba:c}}e.opaque=s;function n(a,c){return Ce=Math.round(c*255),[Fe,We,He]=go.toChannels(a.rgba),{css:Te.toCss(Fe,We,He,Ce),rgba:Te.toRgba(Fe,We,He,Ce)}}e.opacity=n;function o(a,c){return Ce=a.rgba&255,n(a,Ce*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(fe||(fe={}));var ye;(e=>{let t,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Fe=parseInt(s.slice(1,2).repeat(2),16),We=parseInt(s.slice(2,3).repeat(2),16),He=parseInt(s.slice(3,4).repeat(2),16),Te.toColor(Fe,We,He);case 5:return Fe=parseInt(s.slice(1,2).repeat(2),16),We=parseInt(s.slice(2,3).repeat(2),16),He=parseInt(s.slice(3,4).repeat(2),16),Ce=parseInt(s.slice(4,5).repeat(2),16),Te.toColor(Fe,We,He,Ce);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Fe=parseInt(n[1]),We=parseInt(n[2]),He=parseInt(n[3]),Ce=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Te.toColor(Fe,We,He,Ce);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Fe,We,He,Ce]=t.getImageData(0,0,1,1).data,Ce!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Te.toRgba(Fe,We,He,Ce),css:s}}e.toColor=i})(ye||(ye={}));var it;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,s,n){let o=i/255,l=s/255,a=n/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),u=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return c*.2126+u*.7152+h*.0722}e.relativeLuminance2=r})(it||(it={}));var go;(e=>{function t(o,l){if(Ce=(l&255)/255,Ce===1)return l;let a=l>>24&255,c=l>>16&255,u=l>>8&255,h=o>>24&255,d=o>>16&255,m=o>>8&255;return Fe=h+Math.round((a-h)*Ce),We=d+Math.round((c-d)*Ce),He=m+Math.round((u-m)*Ce),Te.toRgba(Fe,We,He)}e.blend=t;function r(o,l,a){let c=it.relativeLuminance(o>>8),u=it.relativeLuminance(l>>8);if(lr(c,u)<a){if(u<c){let m=i(o,l,a),p=lr(c,it.relativeLuminance(m>>8));if(p<a){let g=s(o,l,a),w=lr(c,it.relativeLuminance(g>>8));return p>w?m:g}return m}let h=s(o,l,a),d=lr(c,it.relativeLuminance(h>>8));if(d<a){let m=i(o,l,a),p=lr(c,it.relativeLuminance(m>>8));return d>p?h:m}return h}}e.ensureContrastRatio=r;function i(o,l,a){let c=o>>24&255,u=o>>16&255,h=o>>8&255,d=l>>24&255,m=l>>16&255,p=l>>8&255,g=lr(it.relativeLuminance2(d,m,p),it.relativeLuminance2(c,u,h));for(;g<a&&(d>0||m>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),m-=Math.max(0,Math.ceil(m*.1)),p-=Math.max(0,Math.ceil(p*.1)),g=lr(it.relativeLuminance2(d,m,p),it.relativeLuminance2(c,u,h));return(d<<24|m<<16|p<<8|255)>>>0}e.reduceLuminance=i;function s(o,l,a){let c=o>>24&255,u=o>>16&255,h=o>>8&255,d=l>>24&255,m=l>>16&255,p=l>>8&255,g=lr(it.relativeLuminance2(d,m,p),it.relativeLuminance2(c,u,h));for(;g<a&&(d<255||m<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),g=lr(it.relativeLuminance2(d,m,p),it.relativeLuminance2(c,u,h));return(d<<24|m<<16|p<<8|255)>>>0}e.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(go||(go={}));function Zr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function lr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var a1=class extends xn{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Go=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Nt}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],i=t.translateToString(!0),s=0,n=0,o=0,l=t.getFg(0),a=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==a){if(c-s>1){let u=this._getJoinedRanges(i,o,n,t,s);for(let h=0;h<u.length;h++)r.push(u[h])}s=c,o=n,l=this._workCell.fg,a=this._workCell.bg}n+=this._workCell.getChars().length||Or.length}if(this._bufferService.cols-s>1){let c=this._getJoinedRanges(i,o,n,t,s);for(let u=0;u<c.length;u++)r.push(c[u])}return r}_getJoinedRanges(e,t,r,i,s){let n=e.substring(t,r),o=[];try{o=this._characterJoiners[0].handler(n)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let a=this._characterJoiners[l].handler(n);for(let c=0;c<a.length;c++)Go._mergeRanges(o,a[c])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,i,s),o}_stringRangesToCellRanges(e,t,r){let i=0,s=!1,n=0,o=e[i];if(o){for(let l=r;l<this._bufferService.cols;l++){let a=t.getWidth(l),c=t.getString(l).length||Or.length;if(a!==0){if(!s&&o[0]<=n&&(o[0]=l,s=!0),o[1]<=n){if(o[1]=l,o=e[++i],!o)break;o[0]<=n?(o[0]=l,s=!0):s=!1}n+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){if(t[1]<=s[0])return e[i-1][1]=t[1],e;if(t[1]<=s[1])return e[i-1][1]=Math.max(t[1],s[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=s[0])return e.splice(i,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]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Go=ke([$(0,at)],Go);function c1(e){return 57508<=e&&e<=57558}function h1(e){return 9472<=e&&e<=9631}function u1(e){return c1(e)||h1(e)}function d1(){return{css:{canvas:Yn(),cell:Yn()},device:{canvas:Yn(),cell:Yn(),char:{width:0,height:0,left:0,top:0}}}}function Yn(){return{width:0,height:0}}var jc=class{constructor(e,t,r,i,s,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=i,this._coreService=s,this._decorationService=n,this._themeService=o,this._workCell=new Nt,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,i,s,n,o,l,a,c,u){let h=[],d=this._characterJoinerService.getJoinedCharacters(t),m=this._themeService.colors,p=e.getNoBgTrimmedLength();r&&p<n+1&&(p=n+1);let g,w=0,f="",v=0,y=0,S=0,C=0,P=!1,M=0,z=!1,Y=0,U=0,q=[],L=c!==-1&&u!==-1;for(let x=0;x<p;x++){e.loadCell(x,this._workCell);let E=this._workCell.getWidth();if(E===0)continue;let k=!1,D=x>=U,O=x,b=this._workCell;if(d.length>0&&x===d[0][0]&&D){let ie=d.shift(),Jr=this._isCellInSelection(ie[0],t);for(v=ie[0]+1;v<ie[1];v++)D&&(D=Jr===this._isCellInSelection(v,t));D&&(D=!r||n<ie[0]||n>=ie[1]),D?(k=!0,b=new a1(this._workCell,e.translateToString(!0,ie[0],ie[1]),ie[1]-ie[0]),O=ie[1]-1,E=b.getWidth()):U=ie[1]}let A=this._isCellInSelection(x,t),j=r&&x===n,V=L&&x>=c&&x<=u,J=!1;this._decorationService.forEachDecorationAtCell(x,t,void 0,ie=>{J=!0});let le=b.getChars()||Or;if(le===" "&&(b.isUnderline()||b.isOverline())&&(le=" "),Y=E*l-a.get(le,b.isBold(),b.isItalic()),!g)g=this._document.createElement("span");else if(w&&(A&&z||!A&&!z&&b.bg===y)&&(A&&z&&m.selectionForeground||b.fg===S)&&b.extended.ext===C&&V===P&&Y===M&&!j&&!k&&!J&&D){b.isInvisible()?f+=Or:f+=le,w++;continue}else w&&(g.textContent=f),g=this._document.createElement("span"),w=0,f="";if(y=b.bg,S=b.fg,C=b.extended.ext,P=V,M=Y,z=A,k&&n>=x&&n<=O&&(n=x),!this._coreService.isCursorHidden&&j&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&q.push("xterm-cursor-blink"),q.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break}}if(b.isBold()&&q.push("xterm-bold"),b.isItalic()&&q.push("xterm-italic"),b.isDim()&&q.push("xterm-dim"),b.isInvisible()?f=Or:f=b.getChars()||Or,b.isUnderline()&&(q.push(`xterm-underline-${b.extended.underlineStyle}`),f===" "&&(f=" "),!b.isUnderlineColorDefault()))if(b.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${xn.toColorRGB(b.getUnderlineColor()).join(",")})`;else{let ie=b.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&b.isBold()&&ie<8&&(ie+=8),g.style.textDecorationColor=m.ansi[ie].css}b.isOverline()&&(q.push("xterm-overline"),f===" "&&(f=" ")),b.isStrikethrough()&&q.push("xterm-strikethrough"),V&&(g.style.textDecoration="underline");let ee=b.getFgColor(),he=b.getFgColorMode(),re=b.getBgColor(),Me=b.getBgColorMode(),us=!!b.isInverse();if(us){let ie=ee;ee=re,re=ie;let Jr=he;he=Me,Me=Jr}let Kt,ki,wr=!1;this._decorationService.forEachDecorationAtCell(x,t,void 0,ie=>{ie.options.layer!=="top"&&wr||(ie.backgroundColorRGB&&(Me=50331648,re=ie.backgroundColorRGB.rgba>>8&16777215,Kt=ie.backgroundColorRGB),ie.foregroundColorRGB&&(he=50331648,ee=ie.foregroundColorRGB.rgba>>8&16777215,ki=ie.foregroundColorRGB),wr=ie.options.layer==="top")}),!wr&&A&&(Kt=this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque,re=Kt.rgba>>8&16777215,Me=50331648,wr=!0,m.selectionForeground&&(he=50331648,ee=m.selectionForeground.rgba>>8&16777215,ki=m.selectionForeground)),wr&&q.push("xterm-decoration-top");let Vt;switch(Me){case 16777216:case 33554432:Vt=m.ansi[re],q.push(`xterm-bg-${re}`);break;case 50331648:Vt=Te.toColor(re>>16,re>>8&255,re&255),this._addStyle(g,`background-color:#${sf((re>>>0).toString(16),"0",6)}`);break;case 0:default:us?(Vt=m.foreground,q.push("xterm-bg-257")):Vt=m.background}switch(Kt||b.isDim()&&(Kt=fe.multiplyOpacity(Vt,.5)),he){case 16777216:case 33554432:b.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(g,Vt,m.ansi[ee],b,Kt,void 0)||q.push(`xterm-fg-${ee}`);break;case 50331648:let ie=Te.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(g,Vt,ie,b,Kt,ki)||this._addStyle(g,`color:#${sf(ee.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,Vt,m.foreground,b,Kt,ki)||us&&q.push("xterm-fg-257")}q.length&&(g.className=q.join(" "),q.length=0),!j&&!k&&!J&&D?w++:g.textContent=f,Y!==this.defaultSpacing&&(g.style.letterSpacing=`${Y}px`),h.push(g),x=O}return g&&w&&(g.textContent=f),h}_applyMinimumContrast(e,t,r,i,s,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||u1(i.getCode()))return!1;let o=this._getContrastCache(i),l;if(!s&&!n&&(l=o.getColor(t.rgba,r.rgba)),l===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);l=fe.ensureContrastRatio(s||t,n||r,a),o.setColor((s||t).rgba,(n||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&t>=r[1]&&e<i[0]&&t<=i[1]:e<r[0]&&t>=r[1]&&e>=i[0]&&t<=i[1]:t>r[1]&&t<i[1]||r[1]===i[1]&&t===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&t===i[1]&&e<i[0]||r[1]<i[1]&&t===r[1]&&e>=r[0]}};jc=ke([$(1,Sm),$(2,ct),$(3,yr),$(4,Ci),$(5,Cn),$(6,as)],jc);function sf(e,t,r){for(;e.length<r;)e=t+e;return e}var f1=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 r=e.createElement("span");r.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.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=[r,i,s,n],this._container.appendChild(r),this._container.appendChild(i),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,r,i){e===this._font&&t===this._fontSize&&r===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,r){let i=0;if(!t&&!r&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let o=this._measure(e,0);return o>0&&(this._flat[i]=o),o}let s=e;t&&(s+="B"),r&&(s+="I");let n=this._holey.get(s);if(n===void 0){let o=0;t&&(o|=1),r&&(o|=2),n=this._measure(e,o),n>0&&this._holey.set(s,n)}return n}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},_1=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,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let s=e.buffers.active.ydisp,n=t[1]-s,o=r[1]-s,l=Math.max(n,0),a=Math.min(o,e.rows-1);if(l>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function p1(){return new _1}var oa="xterm-dom-renderer-owner-",bt="xterm-rows",Xn="xterm-fg-",nf="xterm-bg-",xs="xterm-focus",Gn="xterm-selection",m1=1,$c=class extends G{constructor(e,t,r,i,s,n,o,l,a,c,u,h,d,m){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=i,this._viewportElement=s,this._helperContainer=n,this._linkifier2=o,this._charSizeService=a,this._optionsService=c,this._bufferService=u,this._coreService=h,this._coreBrowserService=d,this._themeService=m,this._terminalClass=m1++,this._rowElements=[],this._selectionRenderModel=p1(),this.onRequestRedraw=this._register(new I).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(bt),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(Gn),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=d1(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(p=>this._injectCss(p))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(jc,document),this._element.classList.add(oa+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(p=>this._handleLinkHover(p))),this._register(this._linkifier2.onHideLinkUnderline(p=>this._handleLinkLeave(p))),this._register(me(()=>{this._element.classList.remove(oa+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new f1(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${bt} 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} .${bt} { 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} .${bt} .xterm-dim { color: ${fe.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 r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 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} .${bt}.${xs} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${bt}.${xs} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${bt}.${xs} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${bt} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${bt} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${bt} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${bt} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${bt} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Gn} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Gn} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Gn} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${Xn}${n} { color: ${o.css}; }${this._terminalSelector} .${Xn}${n}.xterm-dim { color: ${fe.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${nf}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${Xn}257 { color: ${fe.opaque(e.background).css}; }${this._terminalSelector} .${Xn}257.xterm-dim { color: ${fe.multiplyOpacity(fe.opaque(e.background),.5).css}; }${this._terminalSelector} .${nf}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 r=this._rowElements.length;r<=t;r++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}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(xs),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(xs),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let a=e[0]>t[0];l.appendChild(this._createSelectionElement(n,a?t[0]:e[0],a?e[0]:t[0],o-n+1))}else{let a=i===n?e[0]:0,c=n===s?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(n,a,c));let u=o-n-1;if(l.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,u)),n!==o){let h=s===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,r,i=1){let s=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),s.style.height=`${i*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 r=this._bufferService.buffer,i=r.ybase+r.y,s=Math.min(r.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=t;a++){let c=a+r.ydisp,u=this._rowElements[a],h=r.lines.get(c);if(!u||!h)break;u.replaceChildren(...this._rowFactory.createRow(h,c,c===i,o,l,s,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${oa}${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,r,i,s,n){r<0&&(e=0),i<0&&(t=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),i=Math.max(Math.min(i,o),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,a=l.ybase+l.y,c=Math.min(l.x,s-1),u=this._optionsService.rawOptions.cursorBlink,h=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=r;m<=i;++m){let p=m+l.ydisp,g=this._rowElements[m],w=l.lines.get(p);if(!g||!w)break;g.replaceChildren(...this._rowFactory.createRow(w,p,p===a,h,d,c,u,this.dimensions.css.cell.width,this._widthCache,n?m===r?e:0:-1,n?(m===i?t:s)-1:-1))}}};$c=ke([$(7,ru),$(8,Sl),$(9,ct),$(10,at),$(11,Ci),$(12,yr),$(13,as)],$c);var Fc=class extends G{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new I),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new g1(this._optionsService))}catch{this._measureStrategy=this._register(new v1(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())}};Fc=ke([$(2,ct)],Fc);var jm=class extends G{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},v1=class extends jm{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},g1=class extends jm{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}},y1=class extends G{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new S1(this._window)),this._onDprChange=this._register(new I),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new I),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Xe.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(H(this._textarea,"focus",()=>this._isFocused=!0)),this._register(H(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},S1=class extends G{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ss),this._onDprChange=this._register(new I),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(me(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=H(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},w1=class extends G{constructor(){super(),this.linkProviders=[],this._register(me(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function hu(e,t,r){let i=r.getBoundingClientRect(),s=e.getComputedStyle(r),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-i.left-n,t.clientY-i.top-o]}function x1(e,t,r,i,s,n,o,l,a){if(!n)return;let c=hu(e,t,r);if(c)return c[0]=Math.ceil((c[0]+(a?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),i+(a?1:0)),c[1]=Math.min(Math.max(c[1],1),s),c}var Wc=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,i,s){return x1(window,e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let r=hu(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};Wc=ke([$(0,Sr),$(1,Sl)],Wc);var C1=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,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},$m={};NS($m,{getSafariVersion:()=>k1,isChromeOS:()=>Um,isFirefox:()=>Fm,isIpad:()=>E1,isIphone:()=>P1,isLegacyEdge:()=>b1,isLinux:()=>uu,isMac:()=>Qo,isNode:()=>wl,isSafari:()=>Wm,isWindows:()=>Hm});var wl=typeof process<"u"&&"title"in process,bn=wl?"node":navigator.userAgent,kn=wl?"node":navigator.platform,Fm=bn.includes("Firefox"),b1=bn.includes("Edge"),Wm=/^((?!chrome|android).)*safari/i.test(bn);function k1(){if(!Wm)return 0;let e=bn.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Qo=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(kn),E1=kn==="iPad",P1=kn==="iPhone",Hm=["Windows","Win16","Win32","WinCE"].includes(kn),uu=kn.indexOf("Linux")>=0,Um=/\bCrOS\b/.test(bn),Km=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,r=0,i=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),r=Math.max(t,r),s=e.timeRemaining(),r*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},L1=class extends Km{_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())}}},D1=class extends Km{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Jo=!wl&&"requestIdleCallback"in window?D1:L1,T1=class{constructor(){this._queue=new Jo}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Hc=class extends G{constructor(e,t,r,i,s,n,o,l,a){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new ss),this._pausedResizeTask=new T1,this._observerDisposable=this._register(new ss),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 I),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new I),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new I),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new I),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new C1((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new R1(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(me(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(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(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=me(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Hc=ke([$(2,ct),$(3,Sl),$(4,Ci),$(5,Cn),$(6,at),$(7,yr),$(8,as)],Hc);var R1=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function M1(e,t,r,i){let s=r.buffer.x,n=r.buffer.y;if(!r.buffer.hasScrollback)return O1(s,n,e,t,r,i)+xl(n,t,r,i)+A1(s,n,e,t,r,i);let o;if(n===t)return o=s>e?"D":"C",fn(Math.abs(s-e),dn(o,i));o=n>t?"D":"C";let l=Math.abs(n-t),a=B1(n>t?e:s,r)+(l-1)*r.cols+1+N1(n>t?s:e);return fn(a,dn(o,i))}function N1(e,t){return e-1}function B1(e,t){return t.cols-e}function O1(e,t,r,i,s,n){return xl(t,i,s,n).length===0?"":fn(qm(e,t,e,t-Si(t,s),!1,s).length,dn("D",n))}function xl(e,t,r,i){let s=e-Si(e,r),n=t-Si(t,r),o=Math.abs(s-n)-I1(e,t,r);return fn(o,dn(Vm(e,t),i))}function A1(e,t,r,i,s,n){let o;xl(t,i,s,n).length>0?o=i-Si(i,s):o=t;let l=i,a=z1(e,t,r,i,s,n);return fn(qm(e,o,r,l,a==="C",s).length,dn(a,n))}function I1(e,t,r){var o;let i=0,s=e-Si(e,r),n=t-Si(t,r);for(let l=0;l<Math.abs(s-n);l++){let a=Vm(e,t)==="A"?-1:1;(o=r.buffer.lines.get(s+a*l))!=null&&o.isWrapped&&i++}return i}function Si(e,t){let r=0,i=t.buffer.lines.get(e),s=i==null?void 0:i.isWrapped;for(;s&&e>=0&&e<t.rows;)r++,i=t.buffer.lines.get(--e),s=i==null?void 0:i.isWrapped;return r}function z1(e,t,r,i,s,n){let o;return xl(r,i,s,n).length>0?o=i-Si(i,s):o=t,e<r&&o<=i||e>=r&&o<i?"C":"D"}function Vm(e,t){return e>t?"A":"B"}function qm(e,t,r,i,s,n){let o=e,l=t,a="";for(;(o!==r||l!==i)&&l>=0&&l<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(a+=n.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!s&&o<0&&(a+=n.buffer.translateBufferLineToString(l,!1,0,e+1),o=n.cols-1,e=o,l--);return a+n.buffer.translateBufferLineToString(l,!1,e,o)}function dn(e,t){let r=t?"O":"[";return R.ESC+r+e}function fn(e,t){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=t;return r}var j1=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function of(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 la=50,$1=15,F1=50,W1=500,H1=" ",U1=new RegExp(H1,"g"),Uc=class extends G{constructor(e,t,r,i,s,n,o,l,a){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=i,this._coreService=s,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Nt,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new I),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new I),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new I),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new I),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new j1(this._bufferService),this._activeSelectionMode=0,this._register(me(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=r.translateBufferLineToString(o,!0,s,n);i.push(l)}}else{let s=e[1]===t[1]?t[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],s));for(let n=e[1]+1;n<=t[1]-1;n++){let o=r.lines.get(n),l=r.translateBufferLineToString(n,!0);o!=null&&o.isWrapped?i[i.length-1]+=l:i.push(l)}if(e[1]!==t[1]){let n=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?i[i.length-1]+=o:i.push(o)}}return i.map(s=>s.replace(U1," ")).join(Hm?`\r
|
|
78
|
+
`:`
|
|
79
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),uu&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i||!t?!1:this._areCoordsInSelection(t,r,i)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i?!1:this._areCoordsInSelection([e,t],r,i)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,n;let r=(n=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:n.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=of(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=hu(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-la),la),t/=la,t/Math.abs(t)+Math.round(t*($1-1)))}shouldForceSelection(e){return Qo?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),F1)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Qo&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let i=r.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<W1&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let i=M1(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let i=0;t>=i;i++){let s=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:s>1&&t!==i&&(r+=s-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,n=s.lines.get(e[1]);if(!n)return;let o=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(n,e[0]),a=l,c=e[0]-l,u=0,h=0,d=0,m=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;a<o.length&&o.charAt(a+1)===" ";)a++}else{let w=e[0],f=e[0];n.getWidth(w)===0&&(u++,w--),n.getWidth(f)===2&&(h++,f++);let v=n.getString(f).length;for(v>1&&(m+=v-1,a+=v-1);w>0&&l>0&&!this._isCharWordSeparator(n.loadCell(w-1,this._workCell));){n.loadCell(w-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,w--):y>1&&(d+=y-1,l-=y-1),l--,w--}for(;f<n.length&&a+1<o.length&&!this._isCharWordSeparator(n.loadCell(f+1,this._workCell));){n.loadCell(f+1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===2?(h++,f++):y>1&&(m+=y-1,a+=y-1),a++,f++}}a++;let p=l+c-u+d,g=Math.min(this._bufferService.cols,a-l+u+h-d-m);if(!(!t&&o.slice(l,a).trim()==="")){if(r&&p===0&&n.getCodePoint(0)!==32){let w=s.lines.get(e[1]-1);if(w&&n.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let f=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(f){let v=this._bufferService.cols-f.start;p-=v,g+=v}}}if(i&&p+g===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let w=s.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let f=this._getWordAt([0,e[1]+1],!1,!1,!0);f&&(g+=f.length)}}return{start:p,length:g}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={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=of(r,this._bufferService.cols)}};Uc=ke([$(3,at),$(4,Ci),$(5,iu),$(6,ct),$(7,Sr),$(8,yr)],Uc);var lf=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},af=class{constructor(){this._color=new lf,this._css=new lf}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ne=Object.freeze((()=>{let e=[ye.toColor("#2e3436"),ye.toColor("#cc0000"),ye.toColor("#4e9a06"),ye.toColor("#c4a000"),ye.toColor("#3465a4"),ye.toColor("#75507b"),ye.toColor("#06989a"),ye.toColor("#d3d7cf"),ye.toColor("#555753"),ye.toColor("#ef2929"),ye.toColor("#8ae234"),ye.toColor("#fce94f"),ye.toColor("#729fcf"),ye.toColor("#ad7fa8"),ye.toColor("#34e2e2"),ye.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=t[r/36%6|0],s=t[r/6%6|0],n=t[r%6];e.push({css:Te.toCss(i,s,n),rgba:Te.toRgba(i,s,n)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:Te.toCss(i,i,i),rgba:Te.toRgba(i,i,i)})}return e})()),ri=ye.toColor("#ffffff"),Ms=ye.toColor("#000000"),cf=ye.toColor("#ffffff"),hf=Ms,Cs={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},K1=ri,Kc=class extends G{constructor(e){super(),this._optionsService=e,this._contrastCache=new af,this._halfContrastCache=new af,this._onChangeColors=this._register(new I),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ri,background:Ms,cursor:cf,cursorAccent:hf,selectionForeground:void 0,selectionBackgroundTransparent:Cs,selectionBackgroundOpaque:fe.blend(Ms,Cs),selectionInactiveBackgroundTransparent:Cs,selectionInactiveBackgroundOpaque:fe.blend(Ms,Cs),scrollbarSliderBackground:fe.opacity(ri,.2),scrollbarSliderHoverBackground:fe.opacity(ri,.4),scrollbarSliderActiveBackground:fe.opacity(ri,.5),overviewRulerBorder:ri,ansi:Ne.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=ae(e.foreground,ri),t.background=ae(e.background,Ms),t.cursor=fe.blend(t.background,ae(e.cursor,cf)),t.cursorAccent=fe.blend(t.background,ae(e.cursorAccent,hf)),t.selectionBackgroundTransparent=ae(e.selectionBackground,Cs),t.selectionBackgroundOpaque=fe.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ae(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=fe.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ae(e.selectionForeground,rf):void 0,t.selectionForeground===rf&&(t.selectionForeground=void 0),fe.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=fe.opacity(t.selectionBackgroundTransparent,.3)),fe.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=fe.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ae(e.scrollbarSliderBackground,fe.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ae(e.scrollbarSliderHoverBackground,fe.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ae(e.scrollbarSliderActiveBackground,fe.opacity(t.foreground,.5)),t.overviewRulerBorder=ae(e.overviewRulerBorder,K1),t.ansi=Ne.slice(),t.ansi[0]=ae(e.black,Ne[0]),t.ansi[1]=ae(e.red,Ne[1]),t.ansi[2]=ae(e.green,Ne[2]),t.ansi[3]=ae(e.yellow,Ne[3]),t.ansi[4]=ae(e.blue,Ne[4]),t.ansi[5]=ae(e.magenta,Ne[5]),t.ansi[6]=ae(e.cyan,Ne[6]),t.ansi[7]=ae(e.white,Ne[7]),t.ansi[8]=ae(e.brightBlack,Ne[8]),t.ansi[9]=ae(e.brightRed,Ne[9]),t.ansi[10]=ae(e.brightGreen,Ne[10]),t.ansi[11]=ae(e.brightYellow,Ne[11]),t.ansi[12]=ae(e.brightBlue,Ne[12]),t.ansi[13]=ae(e.brightMagenta,Ne[13]),t.ansi[14]=ae(e.brightCyan,Ne[14]),t.ansi[15]=ae(e.brightWhite,Ne[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)t.ansi[i+16]=ae(e.extendedAnsi[i],Ne[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Kc=ke([$(0,ct)],Kc);function ae(e,t){if(e!==void 0)try{return ye.toColor(e)}catch{}return t}var V1=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},q1=class{constructor(){this._services=new V1,this._services.set(ru,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=$S(e).sort((n,o)=>n.index-o.index),i=[];for(let n of r){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);i.push(o)}let s=r.length>0?r[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},Y1={trace:0,debug:1,info:2,warn:3,error:4,off:5},X1="xterm.js: ",Vc=class extends G{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=Y1[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":X1)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Vc=ke([$(0,ct)],Vc);var uf=class extends G{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new I),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new I),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new I),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 r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];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,...r){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 i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let s=t-1;s>=0;s--)this.set(e+s+r,this.get(e+s));let i=e+t+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},X=3,De=Object.freeze(new xn),Qn=0,aa=2,Ns=class Ym{constructor(t,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*X);let s=r||Nt.fromCharData([0,fm,1,0]);for(let n=0;n<t;++n)this.setCell(n,s);this.length=t}get(t){let r=this._data[t*X+0],i=r&2097151;return[this._data[t*X+1],r&2097152?this._combined[t]:i?Tr(i):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,r){this._data[t*X+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*X+0]=t|2097152|r[2]<<22):this._data[t*X+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*X+0]>>22}hasWidth(t){return this._data[t*X+0]&12582912}getFg(t){return this._data[t*X+1]}getBg(t){return this._data[t*X+2]}hasContent(t){return this._data[t*X+0]&4194303}getCodePoint(t){let r=this._data[t*X+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*X+0]&2097152}getString(t){let r=this._data[t*X+0];return r&2097152?this._combined[t]:r&2097151?Tr(r&2097151):""}isProtected(t){return this._data[t*X+2]&536870912}loadCell(t,r){return Qn=t*X,r.content=this._data[Qn+0],r.fg=this._data[Qn+1],r.bg=this._data[Qn+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*X+0]=r.content,this._data[t*X+1]=r.fg,this._data[t*X+2]=r.bg}setCellFromCodepoint(t,r,i,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*X+0]=r|i<<22,this._data[t*X+1]=s.fg,this._data[t*X+2]=s.bg}addCodepointToCell(t,r,i){let s=this._data[t*X+0];s&2097152?this._combined[t]+=Tr(r):s&2097151?(this._combined[t]=Tr(s&2097151)+Tr(r),s&=-2097152,s|=2097152):s=r|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[t*X+0]=s}insertCells(t,r,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length-t){let s=new Nt;for(let n=this.length-t-r-1;n>=0;--n)this.setCell(t+r+n,this.loadCell(t+n,s));for(let n=0;n<r;++n)this.setCell(t+n,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,r,i){if(t%=this.length,r<this.length-t){let s=new Nt;for(let n=0;n<this.length-t-r;++n)this.setCell(t+n,this.loadCell(t+r+n,s));for(let n=this.length-r;n<this.length;++n)this.setCell(n,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,r,i,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.setCell(t++,i)}resize(t,r){if(t===this.length)return this._data.length*4*aa<this._data.buffer.byteLength;let i=t*X;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,i);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,i*4*aa<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*aa<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new Ym(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*X+0]&4194303)return t+(this._data[t*X+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*X+0]&4194303||this._data[t*X+2]&50331648)return t+(this._data[t*X+0]>>22);return 0}copyCellsFrom(t,r,i,s,n){let o=t._data;if(n)for(let a=s-1;a>=0;a--){for(let c=0;c<X;c++)this._data[(i+a)*X+c]=o[(r+a)*X+c];o[(r+a)*X+2]&268435456&&(this._extendedAttrs[i+a]=t._extendedAttrs[r+a])}else for(let a=0;a<s;a++){for(let c=0;c<X;c++)this._data[(i+a)*X+c]=o[(r+a)*X+c];o[(r+a)*X+2]&268435456&&(this._extendedAttrs[i+a]=t._extendedAttrs[r+a])}let l=Object.keys(t._combined);for(let a=0;a<l.length;a++){let c=parseInt(l[a],10);c>=r&&(this._combined[c-r+i]=t._combined[c])}}translateToString(t,r,i,s){r=r??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;r<i;){let o=this._data[r*X+0],l=o&2097151,a=o&2097152?this._combined[r]:l?Tr(l):Or;if(n+=a,s)for(let c=0;c<a.length;++c)s.push(r);r+=o>>22||1}return s&&s.push(r),n}};function G1(e,t,r,i,s,n){let o=[];for(let l=0;l<e.length-1;l++){let a=l,c=e.get(++a);if(!c.isWrapped)continue;let u=[e.get(l)];for(;a<e.length&&c.isWrapped;)u.push(c),c=e.get(++a);if(!n&&i>=l&&i<a){l+=u.length-1;continue}let h=0,d=_n(u,h,t),m=1,p=0;for(;m<u.length;){let w=_n(u,m,t),f=w-p,v=r-d,y=Math.min(f,v);u[h].copyCellsFrom(u[m],p,d,y,!1),d+=y,d===r&&(h++,d=0),p+=y,p===w&&(m++,p=0),d===0&&h!==0&&u[h-1].getWidth(r-1)===2&&(u[h].copyCellsFrom(u[h-1],r-1,d++,1,!1),u[h-1].setCell(r-1,s))}u[h].replaceCells(d,r,s);let g=0;for(let w=u.length-1;w>0&&(w>h||u[w].getTrimmedLength()===0);w--)g++;g>0&&(o.push(l+u.length-g),o.push(g)),l+=u.length-1}return o}function Q1(e,t){let r=[],i=0,s=t[i],n=0;for(let o=0;o<e.length;o++)if(s===o){let l=t[++i];e.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,s=t[++i]}else r.push(o);return{layout:r,countRemoved:n}}function J1(e,t){let r=[];for(let i=0;i<t.length;i++)r.push(e.get(t[i]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=t.length}function Z1(e,t,r){let i=[],s=e.map((a,c)=>_n(e,c,t)).reduce((a,c)=>a+c),n=0,o=0,l=0;for(;l<s;){if(s-l<r){i.push(s-l);break}n+=r;let a=_n(e,o,t);n>a&&(n-=a,o++);let c=e[o].getWidth(n-1)===2;c&&n--;let u=c?r-1:r;i.push(u),l+=u}return i}function _n(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,s=e[t+1].getWidth(0)===2;return i&&s?r-1:r}var Xm=class Gm{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Gm._nextId++,this._onDispose=this.register(new I),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),yi(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Xm._nextId=1;var ew=Xm,Ie={},ii=Ie.B;Ie[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ie.A={"#":"£"};Ie.B=void 0;Ie[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ie.C=Ie[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ie.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ie.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ie.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ie.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ie.E=Ie[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ie.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ie.H=Ie[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ie["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var df=4294967295,ff=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=De.clone(),this.savedCharset=ii,this.markers=[],this._nullCell=Nt.fromCharData([0,fm,1,0]),this._whitespaceCell=Nt.fromCharData([0,Or,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Jo,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new uf(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 Yo),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 Yo),this._whitespaceCell}getBlankLine(e,t){return new Ns(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>df?df:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=De);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 uf(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(De),i=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,r);let n=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Ns(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Ns(e,r)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let n=0;n<this.lines.length;n++)i+=+this.lines.get(n).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=G1(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(De),r);if(i.length>0){let s=Q1(this.lines,i);J1(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let i=this.getNullCell(De),s=r;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ns(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(De),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let a=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),a.unshift(l);if(!r){let y=this.ybase+this.y;if(y>=o&&y<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),u=Z1(a,this._cols,e),h=u.length-a.length,d;this.ybase===0&&this.y!==this.lines.length-1?d=Math.max(0,this.y-this.lines.maxLength+h):d=Math.max(0,this.lines.length-this.lines.maxLength+h);let m=[];for(let y=0;y<h;y++){let S=this.getBlankLine(De,!0);m.push(S)}m.length>0&&(s.push({start:o+a.length+n,newLines:m}),n+=m.length),a.push(...m);let p=u.length-1,g=u[p];g===0&&(p--,g=u[p]);let w=a.length-h-1,f=c;for(;w>=0;){let y=Math.min(f,g);if(a[p]===void 0)break;if(a[p].copyCellsFrom(a[w],f-y,g-y,y,!0),g-=y,g===0&&(p--,g=u[p]),f-=y,f===0){w--;let S=Math.max(w,0);f=_n(a,S,this._cols)}}for(let y=0;y<a.length;y++)u[y]<e&&a[y].setCell(u[y],i);let v=h-d;for(;v-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+h,this.ybase+t-1)}if(s.length>0){let o=[],l=[];for(let g=0;g<this.lines.length;g++)l.push(this.lines.get(g));let a=this.lines.length,c=a-1,u=0,h=s[u];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let d=0;for(let g=Math.min(this.lines.maxLength-1,a+n-1);g>=0;g--)if(h&&h.start>c+d){for(let w=h.newLines.length-1;w>=0;w--)this.lines.set(g--,h.newLines[w]);g++,o.push({index:c+1,amount:h.newLines.length}),d+=h.newLines.length,h=s[++u]}else this.lines.set(g,l[c--]);let m=0;for(let g=o.length-1;g>=0;g--)o[g].index+=m,this.lines.onInsertEmitter.fire(o[g]),m+=o[g].amount;let p=Math.max(0,a+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(e,t,r=0,i){let s=this.lines.get(e);return s?s.translateToString(t,r,i):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new ew(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},tw=class extends G{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new I),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 ff(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new ff(!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)}},Qm=2,Jm=1,qc=class extends G{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new I),this.onResize=this._onResize.event,this._onScroll=this._register(new I),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Qm),this.rows=Math.max(e.rawOptions.rows||0,Jm),this.buffers=this._register(new tw(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,i;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(r.scrollTop===0){let o=r.lines.isFull;n===r.lines.length-1?o?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(n+1,0,i.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=n-s+1;r.lines.shiftElements(s+1,o-1,-1),r.lines.set(n,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};qc=ke([$(0,ct)],qc);var Li={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:Qo,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},rw=["normal","bold","100","200","300","400","500","600","700","800","900"],iw=class extends G{constructor(e){super(),this._onOptionChange=this._register(new I),this.onOptionChange=this._onOptionChange.event;let t={...Li};for(let r in e)if(r in t)try{let i=e[r];t[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(me(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Li))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,i)=>{if(!(r in Li))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Li[e]),!sw(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Li[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=rw.includes(t)?t:Li[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function sw(e){return e==="block"||e==="underline"||e==="bar"}function Bs(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let i in e)r[i]=t<=1?e[i]:e[i]&&Bs(e[i],t-1);return r}var _f=Object.freeze({insertMode:!1}),pf=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Yc=class extends G{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new I),this.onData=this._onData.event,this._onUserInput=this._register(new I),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new I),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new I),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Bs(_f),this.decPrivateModes=Bs(pf)}reset(){this.modes=Bs(_f),this.decPrivateModes=Bs(pf)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Yc=ke([$(0,at),$(1,gm),$(2,ct)],Yc);var mf={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function ca(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var ha=String.fromCharCode,vf={DEFAULT:e=>{let t=[ca(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${ha(t[0])}${ha(t[1])}${ha(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ca(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ca(e,!0)};${e.x};${e.y}${t}`}},Xc=class extends G{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new I),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(mf))this.addProtocol(i,mf[i]);for(let i of Object.keys(vf))this.addEncoding(i,vf[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let i=t/r,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){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)}};Xc=ke([$(0,at),$(1,Ci),$(2,ct)],Xc);var ua=[[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]],nw=[[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]],Be;function ow(e,t){let r=0,i=t.length-1,s;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(s=r+i>>1,e>t[s][1])r=s+1;else if(e<t[s][0])i=s-1;else return!0;return!1}var lw=class{constructor(){if(this.version="6",!Be){Be=new Uint8Array(65536),Be.fill(1),Be[0]=0,Be.fill(0,1,32),Be.fill(0,127,160),Be.fill(2,4352,4448),Be[9001]=2,Be[9002]=2,Be.fill(2,11904,42192),Be[12351]=1,Be.fill(2,44032,55204),Be.fill(2,63744,64256),Be.fill(2,65040,65050),Be.fill(2,65072,65136),Be.fill(2,65280,65377),Be.fill(2,65504,65511);for(let e=0;e<ua.length;++e)Be.fill(0,ua[e][0],ua[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Be[e]:ow(e,nw)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),i=r===0&&t!==0;if(i){let s=li.extractWidth(t);s===0?i=!1:s>r&&(r=s)}return li.createPropertyValue(0,r,i)}},li=class yo{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new I,this.onChange=this._onChange.event;let t=new lw;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,i=!1){return(t&16777215)<<3|(r&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,i=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 r+this.wcwidth(o);let c=t.charCodeAt(n);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:r+=this.wcwidth(c)}let l=this.charProperties(o,i),a=yo.extractWidth(l);yo.extractShouldJoin(l)&&(a-=yo.extractWidth(i)),r+=a,i=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},aw=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 gf(e){var i;let t=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var bs=2147483647,cw=256,Zm=class Gc{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>cw)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new Gc;if(!t.length)return r;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let s=t[i];if(Array.isArray(s))for(let n=0;n<s.length;++n)r.addSubParam(s[n]);else r.addParam(s)}return r}clone(){let t=new Gc(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>bs?bs:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>bs?bs:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-r>0?this._subParams.subarray(r,i):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&(t[r]=this._subParams.slice(i,s))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,s=i[r-1];i[r-1]=~s?Math.min(s*10+t,bs):t}},ks=[],hw=class{constructor(){this._state=0,this._active=ks,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,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=ks}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=ks,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ks,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",yl(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].end(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=ks,this._id=-1,this._state=0}}},vt=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,r,i){this._hitLimit||(this._data+=yl(t,r,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let r=!1;if(this._hitLimit)r=!1;else if(t&&(r=this._handler(this._data),r instanceof Promise))return r.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,r}},Es=[],uw=class{constructor(){this._handlers=Object.create(null),this._active=Es,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Es}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,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=Es,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Es,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",yl(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].unhook(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=Es,this._ident=0}},Os=new Zm;Os.addParam(0);var yf=class{constructor(e){this._handler=e,this._data="",this._params=Os,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Os,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=yl(e,t,r),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(r=>(this._params=Os,this._data="",this._hitLimit=!1,r));return this._params=Os,this._data="",this._hitLimit=!1,t}},dw=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,i){this.table[t<<8|e]=r<<4|i}addMany(e,t,r,i){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=r<<4|i}},Lt=160,fw=function(){let e=new dw(4095),t=Array.apply(null,Array(256)).map((l,a)=>a),r=(l,a)=>t.slice(l,a),i=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let n=r(0,14),o;e.setDefault(1,0),e.addMany(i,0,2,0);for(o in n)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,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(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(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(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Lt,0,2,0),e.add(Lt,8,5,8),e.add(Lt,6,0,6),e.add(Lt,11,0,11),e.add(Lt,13,13,13),e}(),_w=class extends G{constructor(e=fw){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 Zm,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(me(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new hw),this._dcsParser=this._register(new uw),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let n=e.intermediates.charCodeAt(s);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=n}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=i,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,i,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=s}parse(e,t,r){let i=0,s=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](this._params),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(i!==24&&i!==26,r),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],o=this._oscParser.end(i!==24&&i!==26,r),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=n;l<t;++l){switch(i=e[l],s=this._transitions.table[this.currentState<<8|(i<160?i:Lt)],s>>4){case 2:for(let d=l+1;;++d){if(d>=t||(i=e[d])<32||i>126&&i<Lt){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(i=e[d])<32||i>126&&i<Lt){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(i=e[d])<32||i>126&&i<Lt){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(i=e[d])<32||i>126&&i<Lt){this._printHandler(e,l,d),l=d-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|i],c=a?a.length-1:-1;for(;c>=0&&(o=a[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,a,c,s,l),o;c<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++l<t&&(i=e[l])>47&&i<60);l--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let u=this._escHandlers[this._collect<<8|i],h=u?u.length-1:-1;for(;h>=0&&(o=u[h](),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(4,u,h,s,l),o;h<0&&this._escHandlerFb(this._collect<<8|i),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|i,this._params);break;case 13:for(let d=l+1;;++d)if(d>=t||(i=e[d])===24||i===26||i===27||i>127&&i<Lt){this._dcsParser.put(e,l,d),l=d-1;break}break;case 14:if(o=this._dcsParser.unhook(i!==24&&i!==26),o)return this._preserveStack(6,[],0,s,l),o;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let d=l+1;;d++)if(d>=t||(i=e[d])<32||i>127&&i<Lt){this._oscParser.put(e,l,d),l=d-1;break}break;case 6:if(o=this._oscParser.end(i!==24&&i!==26),o)return this._preserveStack(5,[],0,s,l),o;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},pw=/^([\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})$/,mw=/^[\da-f]+$/;function Sf(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=pw.exec(t);if(r){let i=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/i*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/i*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),mw.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(t.slice(r*s,r*s+r),16);i[s]=r===1?n<<4:r===2?n:r===3?n>>4:n>>8}return i}}function da(e,t){let r=e.toString(16),i=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function vw(e,t=16){let[r,i,s]=e;return`rgb:${da(r,t)}/${da(i,t)}/${da(s,t)}`}var gw={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Er=131072,wf=10;function xf(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 Cf=5e3,bf=0,yw=class extends G{constructor(e,t,r,i,s,n,o,l,a=new _w){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=i,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=a,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new zS,this._utf8Decoder=new jS,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=De.clone(),this._eraseAttrDataInternal=De.clone(),this._onRequestBell=this._register(new I),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new I),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new I),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new I),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new I),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new I),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new I),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new I),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new I),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new I),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new I),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new I),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new I),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 Qc(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:u.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,u,h)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:u,data:h})}),this._parser.setDcsHandlerFallback((c,u,h)=>{u==="HOOK"&&(h=h.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:u,payload:h})}),this._parser.setPrintHandler((c,u,h)=>this.print(c,u,h)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(R.BEL,()=>this.bell()),this._parser.setExecuteHandler(R.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(R.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(R.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(R.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(R.BS,()=>this.backspace()),this._parser.setExecuteHandler(R.HT,()=>this.tab()),this._parser.setExecuteHandler(R.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(R.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(vo.IND,()=>this.index()),this._parser.setExecuteHandler(vo.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(vo.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new vt(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new vt(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new vt(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new vt(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new vt(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new vt(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new vt(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new vt(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new vt(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new vt(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new vt(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new vt(c=>this.restoreCursorColor(c))),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 c in Ie)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new yf((c,u)=>this.requestStatusString(c,u)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),Cf))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Cf} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,i=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Er&&(n=this._parseStack.position+Er)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Er&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Er))),o||this._dirtyRowTracker.clearRange(),e.length>Er)for(let c=n;c<e.length;c+=Er){let u=c+Er<e.length?c+Er:e.length,h=typeof e=="string"?this._stringDecoder.decode(e.substring(c,u),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,u),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,h))return this._preserveStack(i,s,h,c),this._logSlowResolvingAsync(r),r}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,c))return this._preserveStack(i,s,c,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),a=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);a<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(a,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,r){let i,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,a=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,u=this._curAttrData,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&h.getWidth(this._activeBuffer.x-1)===2&&h.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let d=this._parser.precedingJoinState;for(let m=t;m<r;++m){if(i=e[m],i<127&&n){let f=n[String.fromCharCode(i)];f&&(i=f.charCodeAt(0))}let p=this._unicodeService.charProperties(i,d);s=li.extractWidth(p);let g=li.extractShouldJoin(p),w=g?li.extractWidth(d):0;if(d=p,o&&this._onA11yChar.fire(Tr(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-w>l){if(a){let f=h,v=this._activeBuffer.x-w;for(this._activeBuffer.x=w,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),w>0&&h instanceof Ns&&h.copyCellsFrom(f,v,0,w,!1);v<l;)f.setCellFromCodepoint(v++,0,1,u)}else if(this._activeBuffer.x=l-1,s===2)continue}if(g&&this._activeBuffer.x){let f=h.getWidth(this._activeBuffer.x-1)?1:2;h.addCodepointToCell(this._activeBuffer.x-f,i,s);for(let v=s-w;--v>=0;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(h.insertCells(this._activeBuffer.x,s-w,this._activeBuffer.getNullCell(u)),h.getWidth(l-1)===2&&h.setCellFromCodepoint(l-1,0,1,u)),h.setCellFromCodepoint(this._activeBuffer.x++,i,s,u),s>0)for(;--s;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=d,this._activeBuffer.x<l&&r-t>0&&h.getWidth(this._activeBuffer.x)===0&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>xf(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new yf(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new vt(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,i=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),s),i&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,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--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&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 s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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 r=this._activeBuffer.ybase+this._activeBuffer.y,i;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(De));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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=e.params[0]||1,i=li.extractWidth(t),s=this._activeBuffer.x-i,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*r),l=0;for(let c=0;c<n.length;){let u=n.codePointAt(c)||0;o[l++]=u,c+=u>65535?2:1}let a=l;for(let c=1;c<r;++c)o.copyWithin(a,0,l),a+=l;return this.print(o,0,a),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(R.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(R.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(R.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(R.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(R.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,ii),this._charsetService.setgCharset(1,ii),this._charsetService.setgCharset(2,ii),this._charsetService.setgCharset(3,ii);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:a}=this._bufferService,{active:c,alt:u}=l,h=this._optionsService.rawOptions,d=(g,w)=>(o.triggerDataEvent(`${R.ESC}[${t?"":"?"}${g};${w}$y`),!0),m=g=>g?1:2,p=e.params[0];return t?p===2?d(p,4):p===4?d(p,m(o.modes.insertMode)):p===12?d(p,3):p===20?d(p,m(h.convertEol)):d(p,0):p===1?d(p,m(i.applicationCursorKeys)):p===3?d(p,h.windowOptions.setWinLines?a===80?2:a===132?1:0:0):p===6?d(p,m(i.origin)):p===7?d(p,m(i.wraparound)):p===8?d(p,3):p===9?d(p,m(s==="X10")):p===12?d(p,m(h.cursorBlink)):p===25?d(p,m(!o.isCursorHidden)):p===45?d(p,m(i.reverseWraparound)):p===66?d(p,m(i.applicationKeypad)):p===67?d(p,4):p===1e3?d(p,m(s==="VT200")):p===1002?d(p,m(s==="DRAG")):p===1003?d(p,m(s==="ANY")):p===1004?d(p,m(i.sendFocus)):p===1005?d(p,4):p===1006?d(p,m(n==="SGR")):p===1015?d(p,4):p===1016?d(p,m(n==="SGR_PIXELS")):p===1048?d(p,1):p===47||p===1047||p===1049?d(p,m(c===u)):p===2004?d(p,m(i.bracketedPasteMode)):p===2026?d(p,m(i.synchronizedOutput)):d(p,0)}_updateAttrColor(e,t,r,i,s){return t===2?(e|=50331648,e&=-16777216,e|=xn.fromColorRGB([r,i,s])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let i=[0,0,-1,0,0,0],s=0,n=0;do{if(i[n+s]=e.params[t+n],e.hasSubParams(t+n)){let o=e.getSubParams(t+n),l=0;do i[1]===5&&(s=1),i[n+l+1+s]=o[l];while(++l<o.length&&l+n+1+s<i.length);break}if(i[1]===5&&n+s>=2||i[1]===2&&n+s>=5)break;i[1]&&(s=1)}while(++n+t<e.length&&n+s<i.length);for(let o=2;o<i.length;++o)i[o]===-1&&(i[o]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=De.fg,e.bg=De.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,i=this._curAttrData;for(let s=0;s<t;s++)r=e.params[s],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=De.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=De.bg&16777215):r===38||r===48||r===58?s+=this._extractColor(e,s,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=De.fg&16777215,i.bg&=-67108864,i.bg|=De.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${R.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${R.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${R.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=De.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!xf(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${R.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>wf&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>wf&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let i=r.shift(),s=r.shift();if(/^\d+$/.exec(i)){let n=parseInt(i);if(kf(n))if(s==="?")t.push({type:0,index:n});else{let o=Sf(s);o&&t.push({type:1,index:n,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(r,i):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),i,s=r.findIndex(n=>n.startsWith("id="));return s!==-1&&(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 r=e.split(";");for(let i=0;i<r.length&&!(t>=this._specialColors.length);++i,++t)if(r[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=Sf(r[i]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){let s=parseInt(r[i]);kf(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,ii),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(gw[e[0]],Ie[e[1]]||ii),!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=De.clone(),this._eraseAttrDataInternal=De.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Nt;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=o=>(this._coreService.triggerDataEvent(`${R.ESC}${o}${R.ESC}\\`),!0),i=this._bufferService.buffer,s=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Qc=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&&(bf=e,e=t,t=bf),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Qc=ke([$(0,at)],Qc);function kf(e){return 0<=e&&e<256}var Sw=5e7,Ef=12,ww=50,xw=class extends G{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 I),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Sw)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,t);if(s){let o=l=>performance.now()-r>=Ef?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=Ef)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>ww&&(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()}},Jc=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),a={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(a,l)),this._dataByLinkId.set(a.id,a),a.id}let r=e,i=this._getEntryIdKey(r),s=this._entriesWithId.get(i);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(r),data:r,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 r=this._dataByLinkId.get(e);if(r&&r.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);r.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(r,i))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Jc=ke([$(0,at)],Jc);var Pf=!1,Cw=class extends G{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ss),this._onBinary=this._register(new I),this.onBinary=this._onBinary.event,this._onData=this._register(new I),this.onData=this._onData.event,this._onLineFeed=this._register(new I),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new I),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new I),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new I),this._instantiationService=new q1,this.optionsService=this._register(new iw(e)),this._instantiationService.setService(ct,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(qc)),this._instantiationService.setService(at,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Vc)),this._instantiationService.setService(gm,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Yc)),this._instantiationService.setService(Ci,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Xc)),this._instantiationService.setService(vm,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(li)),this._instantiationService.setService(HS,this.unicodeService),this._charsetService=this._instantiationService.createInstance(aw),this._instantiationService.setService(WS,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Jc),this._instantiationService.setService(ym,this._oscLinkService),this._inputHandler=this._register(new yw(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Xe.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Xe.forward(this._bufferService.onResize,this._onResize)),this._register(Xe.forward(this.coreService.onData,this._onData)),this._register(Xe.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 xw((t,r)=>this._inputHandler.parse(t,r))),this._register(Xe.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new I),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Pf&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Pf=!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,Qm),t=Math.max(t,Jm),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(gf.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(gf(this._bufferService),!1))),this._windowsWrappingHeuristics.value=me(()=>{for(let t of e)t.dispose()})}}},bw={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function kw(e,t,r,i){var o;let s={type:0,cancel:!1,key:void 0},n=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=R.ESC+"OA":s.key=R.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=R.ESC+"OD":s.key=R.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=R.ESC+"OC":s.key=R.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=R.ESC+"OB":s.key=R.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":R.DEL,e.altKey&&(s.key=R.ESC+s.key);break;case 9:if(e.shiftKey){s.key=R.ESC+"[Z";break}s.key=R.HT,s.cancel=!0;break;case 13:s.key=e.altKey?R.ESC+R.CR:R.CR,s.cancel=!0;break;case 27:s.key=R.ESC,e.altKey&&(s.key=R.ESC+R.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;n?s.key=R.ESC+"[1;"+(n+1)+"D":t?s.key=R.ESC+"OD":s.key=R.ESC+"[D";break;case 39:if(e.metaKey)break;n?s.key=R.ESC+"[1;"+(n+1)+"C":t?s.key=R.ESC+"OC":s.key=R.ESC+"[C";break;case 38:if(e.metaKey)break;n?s.key=R.ESC+"[1;"+(n+1)+"A":t?s.key=R.ESC+"OA":s.key=R.ESC+"[A";break;case 40:if(e.metaKey)break;n?s.key=R.ESC+"[1;"+(n+1)+"B":t?s.key=R.ESC+"OB":s.key=R.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=R.ESC+"[2~");break;case 46:n?s.key=R.ESC+"[3;"+(n+1)+"~":s.key=R.ESC+"[3~";break;case 36:n?s.key=R.ESC+"[1;"+(n+1)+"H":t?s.key=R.ESC+"OH":s.key=R.ESC+"[H";break;case 35:n?s.key=R.ESC+"[1;"+(n+1)+"F":t?s.key=R.ESC+"OF":s.key=R.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=R.ESC+"[5;"+(n+1)+"~":s.key=R.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=R.ESC+"[6;"+(n+1)+"~":s.key=R.ESC+"[6~";break;case 112:n?s.key=R.ESC+"[1;"+(n+1)+"P":s.key=R.ESC+"OP";break;case 113:n?s.key=R.ESC+"[1;"+(n+1)+"Q":s.key=R.ESC+"OQ";break;case 114:n?s.key=R.ESC+"[1;"+(n+1)+"R":s.key=R.ESC+"OR";break;case 115:n?s.key=R.ESC+"[1;"+(n+1)+"S":s.key=R.ESC+"OS";break;case 116:n?s.key=R.ESC+"[15;"+(n+1)+"~":s.key=R.ESC+"[15~";break;case 117:n?s.key=R.ESC+"[17;"+(n+1)+"~":s.key=R.ESC+"[17~";break;case 118:n?s.key=R.ESC+"[18;"+(n+1)+"~":s.key=R.ESC+"[18~";break;case 119:n?s.key=R.ESC+"[19;"+(n+1)+"~":s.key=R.ESC+"[19~";break;case 120:n?s.key=R.ESC+"[20;"+(n+1)+"~":s.key=R.ESC+"[20~";break;case 121:n?s.key=R.ESC+"[21;"+(n+1)+"~":s.key=R.ESC+"[21~";break;case 122:n?s.key=R.ESC+"[23;"+(n+1)+"~":s.key=R.ESC+"[23~";break;case 123:n?s.key=R.ESC+"[24;"+(n+1)+"~":s.key=R.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=R.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=R.DEL:e.keyCode===219?s.key=R.ESC:e.keyCode===220?s.key=R.FS:e.keyCode===221&&(s.key=R.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let l=(o=bw[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)s.key=R.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(a);e.shiftKey&&(c=c.toUpperCase()),s.key=R.ESC+c}else if(e.keyCode===32)s.key=R.ESC+(e.ctrlKey?R.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),s.key=R.ESC+a,s.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=R.US),e.key==="@"&&(s.key=R.NUL));break}return s}var Ee=0,Ew=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Jo,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Jo,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,n)=>this._getKey(s)-this._getKey(n)),t=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<i.length;s++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(i[s]=e[t],t++):i[s]=this._array[r++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Ee=this._search(t),Ee===-1)||this._getKey(this._array[Ee])!==t)return!1;do if(this._array[Ee]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ee),!0;while(++Ee<this._array.length&&this._getKey(this._array[Ee])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,n)=>s-n),t=0,r=new Array(this._array.length-e.length),i=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:r[i++]=this._array[s];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ee=this._search(e),!(Ee<0||Ee>=this._array.length)&&this._getKey(this._array[Ee])===e))do yield this._array[Ee];while(++Ee<this._array.length&&this._getKey(this._array[Ee])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ee=this._search(e),!(Ee<0||Ee>=this._array.length)&&this._getKey(this._array[Ee])===e))do t(this._array[Ee]);while(++Ee<this._array.length&&this._getKey(this._array[Ee])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let i=t+r>>1,s=this._getKey(this._array[i]);if(s>e)r=i-1;else if(s<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},fa=0,Lf=0,Pw=class extends G{constructor(){super(),this._decorations=new Ew(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new I),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new I),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(me(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Lw(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.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,r){let i=0,s=0;for(let n of this._decorations.getKeyIterator(t))i=n.options.x??0,s=i+(n.options.width??1),e>=i&&e<s&&(!r||(n.options.layer??"bottom")===r)&&(yield n)}forEachDecorationAtCell(e,t,r,i){this._decorations.forEachByKey(t,s=>{fa=s.options.x??0,Lf=fa+(s.options.width??1),e>=fa&&e<Lf&&(!r||(s.options.layer??"bottom")===r)&&i(s)})}},Lw=class extends Kr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new I),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new I),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ye.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ye.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Dw=1e3,Tw=class{constructor(e,t=Dw){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=i-this._lastRefreshMs,n=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Df=20,Zo=class extends G{constructor(e,t,r,i){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Tw(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
80
|
+
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(H(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(me(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Df+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
81
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Df+1&&(this._liveRegion.textContent+=gc.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,i=r.lines.length.toString();for(let s=e;s<=t;s++){let n=r.lines.get(r.ydisp+s),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",a=(r.ydisp+s+1).toString(),c=this._rowElements[s];c&&(l.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=l,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",a),c.setAttribute("aria-setsize",i),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],s=r.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||e.relatedTarget!==i)return;let o,l;if(t===0?(o=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let a=this._createAccessibilityTreeNode();this._rowElements.unshift(a),this._rowContainer.insertAdjacentElement("afterbegin",a)}else{let a=this._createAccessibilityTreeNode();this._rowElements.push(a),this._rowContainer.appendChild(a)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:i,offset:((l=i.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let s=({node:a,offset:c})=>{let u=a instanceof Text?a.parentNode:a,h=parseInt(u==null?void 0:u.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(u);if(!d)return console.warn("columns is null. Race condition?"),null;let m=c<d.length?d[c]:d.slice(-1)[0]+1;return m>=this._terminal.cols&&(++h,m=0),{row:h,column:m}},n=s(t),o=s(r);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,n;e.style.transform="";let t=e.getBoundingClientRect().width,r=(n=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:n[0];if(!r)return;let i=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};Zo=ke([$(1,ru),$(2,yr),$(3,Sr)],Zo);var Zc=class extends G{constructor(e,t,r,i,s){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=i,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new I),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new I),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(me(()=>{var n;yi(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(H(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(H(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(H(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(H(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 r=e.composedPath();for(let i=0;i<r.length;i++){let s=r[i];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,s;(!this._activeProviderReplies||!t)&&((i=this._activeProviderReplies)==null||i.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(n)&&(r=this._checkLinkProviderResult(n,e,r)):o.provideLinks(e.y,l=>{var c,u;if(this._isMouseOut)return;let a=l==null?void 0:l.map(h=>({link:h}));(c=this._activeProviderReplies)==null||c.set(n,a),r=this._checkLinkProviderResult(n,e,r),((u=this._activeProviderReplies)==null?void 0:u.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let i=0;i<t.size;i++){let s=t.get(i);if(s)for(let n=0;n<s.length;n++){let o=s[n],l=o.link.range.start.y<e?0:o.link.range.start.x,a=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=l;c<=a;c++){if(r.has(c)){s.splice(n--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,t,r){var n;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&i){let o=i.find(l=>this._linkAtPosition(l.link,t));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(a=>this._linkAtPosition(a.link,t));if(l){r=!0,this._handleNewLink(l);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Rw(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,yi(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.pointerCursor},set:r=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline},set:r=>{var i,s,n;(i=this._currentLink)!=null&&i.state&&((n=(s=this._currentLink)==null?void 0:s.state)==null?void 0:n.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let i=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(i,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,r){var i;(i=this._currentLink)!=null&&i.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(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,i=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,r){var i;(i=this._currentLink)!=null&&i.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(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return r<=s&&s<=i}_positionFromMouseEvent(e,t,r){let i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,i,s){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:s}}};Zc=ke([$(1,iu),$(2,Sr),$(3,at),$(4,wm)],Zc);function Rw(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Mw=class extends Cw{constructor(e={}){super(e),this._linkifier=this._register(new ss),this.browser=$m,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ss),this._onCursorMove=this._register(new I),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new I),this.onKey=this._onKey.event,this._onRender=this._register(new I),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new I),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new I),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new I),this.onBell=this._onBell.event,this._onFocus=this._register(new I),this._onBlur=this._register(new I),this._onA11yCharEmitter=this._register(new I),this._onA11yTabEmitter=this._register(new I),this._onWillOpen=this._register(new I),this._setup(),this._decorationService=this._instantiationService.createInstance(Pw),this._instantiationService.setService(Cn,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(w1),this._instantiationService.setService(wm,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Sc)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Xe.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Xe.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Xe.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Xe.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(me(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,i="";switch(t.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+t.index}switch(t.type){case 0:let s=fe.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${R.ESC}]${i};${vw(s)}${zm.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=Te.toColor(...t.color));else{let n=r;this._themeService.modifyColors(o=>o[n]=Te.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Zo,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.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 r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,s=t.getWidth(r),n=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(H(this.element,"copy",t=>{this.hasSelection()&&AS(t,this._selectionService)}));let e=t=>IS(t,this.textarea,this.coreService,this.optionsService);this._register(H(this.textarea,"paste",e)),this._register(H(this.element,"paste",e)),Fm?this._register(H(this.element,"mousedown",t=>{t.button===2&&zd(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(H(this.element,"contextmenu",t=>{zd(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),uu&&this._register(H(this.element,"auxclick",t=>{t.button===1&&dm(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(H(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(H(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(H(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(H(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(H(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(H(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(H(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(H(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",vc.get()),Um||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(y1,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(yr,this._coreBrowserService),this._register(H(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(H(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Fc,this._document,this._helperContainer),this._instantiationService.setService(Sl,this._charSizeService),this._themeService=this._instantiationService.createInstance(Kc),this._instantiationService.setService(as,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Go),this._instantiationService.setService(Sm,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Hc,this.rows,this.screenElement)),this._instantiationService.setService(Sr,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(zc,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Wc),this._instantiationService.setService(iu,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(Zc,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Ac,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Uc,this.element,this.screenElement,i)),this._instantiationService.setService(KS,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(Xe.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(Ic,this.screenElement)),this._register(H(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Zo,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Xo,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Xo,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance($c,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(n){var c,u,h,d,m;let o=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!o)return!1;let l,a;switch(n.overrideType||n.type){case"mousemove":a=32,n.buttons===void 0?(l=3,n.button!==void 0&&(l=n.button<3?n.button:3)):l=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":a=0,l=n.button<3?n.button:3;break;case"mousedown":a=1,l=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let p=n.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(n,(d=(h=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:h.cell)==null?void 0:d.height,(m=e._coreBrowserService)==null?void 0:m.dpr)===0)return!1;a=p<0?0:1,l=4;break;default:return!1}return a===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:a,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:n=>(r(n),n.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(n)),wheel:n=>(r(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&r(n)},mousemove:n=>{n.buttons||r(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),n&8?i.mousemove||(t.addEventListener("mousemove",s.mousemove),i.mousemove=s.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),n&16?i.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),i.wheel=s.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),n&2?i.mouseup||(i.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),n&4?i.mousedrag||(i.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(H(t,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return r(n),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(n)})),this._register(H(t,"wheel",n=>{var o,l,a,c,u;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,(c=(a=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:a.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(n,!0);let h=R.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){um(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=kw(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let i=this.rows-1;return this.scrollLines(r.type===2?-i:i),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===R.ETX||r.key===R.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Nw(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(De));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(R.ESC+"[I"):this.coreService.triggerDataEvent(R.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${R.ESC}[4;${r};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${R.ESC}[6;${s};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Nw(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Bw=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Ow=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 Nt)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},Tf=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 Ow(t)}getNullCell(){return new Nt}},Aw=class extends G{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new I),this.onBufferChange=this._onBufferChange.event,this._normal=new Tf(this._core.buffers.normal,"normal"),this._alternate=new Tf(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)}},Iw=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,i)=>t(r,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)}},zw=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}},jw=["cols","rows"],Gt=0,$w=class extends G{constructor(e){super(),this._core=this._register(new Mw(e)),this._addonManager=this._register(new Bw),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],r=(i,s)=>{this._checkReadonlyOptions(i),this._core.options[i]=s};for(let i in this._core.options){let s={get:t.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,s)}}_checkReadonlyOptions(e){if(jw.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 Iw(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new zw(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 Aw(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}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
|
|
82
|
+
`,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 vc.get()},set promptLabel(e){vc.set(e)},get tooMuchOutput(){return gc.get()},set tooMuchOutput(e){gc.set(e)}}}_verifyIntegers(...e){for(Gt of e)if(Gt===1/0||isNaN(Gt)||Gt%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Gt of e)if(Gt&&(Gt===1/0||isNaN(Gt)||Gt%1!==0||Gt<0))throw new Error("This API only accepts positive integers")}};/**
|
|
83
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
84
|
+
* @license MIT
|
|
85
|
+
*
|
|
86
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
87
|
+
* @license MIT
|
|
88
|
+
*
|
|
89
|
+
* Originally forked from (with the author's permission):
|
|
90
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
91
|
+
* http://bellard.org/jslinux/
|
|
92
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
93
|
+
*/var Fw=2,Ww=1,Rf=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 h;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((h=this._terminal.options.overviewRuler)==null?void 0:h.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),s=Math.max(0,parseInt(r.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,a=o.right+o.left,c=i-l,u=s-a-t;return{cols:Math.max(Fw,Math.floor(u/e.css.cell.width)),rows:Math.max(Ww,Math.floor(c/e.css.cell.height))}}};/**
|
|
94
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
95
|
+
* @license MIT
|
|
96
|
+
*
|
|
97
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
98
|
+
* @license MIT
|
|
99
|
+
*
|
|
100
|
+
* Originally forked from (with the author's permission):
|
|
101
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
102
|
+
* http://bellard.org/jslinux/
|
|
103
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
104
|
+
*/var Hw=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=Kw.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,i)=>{if(this._options.hover){let{range:s}=t;this._options.hover(r,i,s)}},t))}};function Uw(e){try{let t=new URL(e),r=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(r.toLocaleLowerCase())}catch{return!1}}var Kw=class So{static computeLink(t,r,i,s){let n=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=So._getWindowedLineStrings(t-1,i),a=o.join(""),c,u=[];for(;c=n.exec(a);){let h=c[0];if(!Uw(h))continue;let[d,m]=So._mapStrIdx(i,l,0,c.index),[p,g]=So._mapStrIdx(i,d,m,h.length);if(d===-1||m===-1||p===-1||g===-1)continue;let w={start:{x:m+1,y:d+1},end:{x:g,y:p+1}};u.push({range:w,text:h,activate:s})}return u}static _getWindowedLineStrings(t,r){let i,s=t,n=t,o=0,l="",a=[];if(i=r.buffer.active.getLine(t)){let c=i.translateToString(!0);if(i.isWrapped&&c[0]!==" "){for(o=0;(i=r.buffer.active.getLine(--s))&&o<2048&&(l=i.translateToString(!0),o+=l.length,a.push(l),!(!i.isWrapped||l.indexOf(" ")!==-1)););a.reverse()}for(a.push(c),o=0;(i=r.buffer.active.getLine(++n))&&i.isWrapped&&o<2048&&(l=i.translateToString(!0),o+=l.length,a.push(l),l.indexOf(" ")===-1););}return[a,s]}static _mapStrIdx(t,r,i,s){let n=t.buffer.active,o=n.getNullCell(),l=i;for(;s;){let a=n.getLine(r);if(!a)return[-1,-1];for(let c=l;c<a.length;++c){a.getCell(c,o);let u=o.getChars();if(o.getWidth()&&(s-=u.length||1,c===a.length-1&&u==="")){let h=n.getLine(r+1);h&&h.isWrapped&&(h.getCell(0,o),o.getWidth()===2&&(s+=1))}if(s<0)return[r,c]}r++,l=0}return[r,l]}},Vw=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function qw(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var Yw=class{constructor(e=qw,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||Vw;this._linkProvider=this._terminal.registerLinkProvider(new Hw(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};/**
|
|
105
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
106
|
+
* @license MIT
|
|
107
|
+
*
|
|
108
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
109
|
+
* @license MIT
|
|
110
|
+
*
|
|
111
|
+
* Originally forked from (with the author's permission):
|
|
112
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
113
|
+
* http://bellard.org/jslinux/
|
|
114
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
115
|
+
*/var Xw=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Mf.isErrorNoTelemetry(e)?new Mf(e.message+`
|
|
116
|
+
|
|
117
|
+
`+e.stack):new Error(e.message+`
|
|
118
|
+
|
|
119
|
+
`+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)}},Gw=new Xw;function _a(e){Qw(e)||Gw.onUnexpectedError(e)}var eh="Canceled";function Qw(e){return e instanceof Jw?!0:e instanceof Error&&e.name===eh&&e.message===eh}var Jw=class extends Error{constructor(){super(eh),this.name=this.message}},Mf=class th extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof th)return t;let r=new th;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Zw;(e=>{function t(n){return n<0}e.isLessThan=t;function r(n){return n<=0}e.isLessThanOrEqual=r;function i(n){return n>0}e.isGreaterThan=i;function s(n){return n===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Zw||(Zw={}));function ex(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var ev;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(S){yield S}e.single=s;function n(S){return t(S)?S:s(S)}e.wrap=n;function o(S){return S||r}e.from=o;function*l(S){for(let C=S.length-1;C>=0;C--)yield S[C]}e.reverse=l;function a(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(S){return S[Symbol.iterator]().next().value}e.first=c;function u(S,C){let P=0;for(let M of S)if(C(M,P++))return!0;return!1}e.some=u;function h(S,C){for(let P of S)if(C(P))return P}e.find=h;function*d(S,C){for(let P of S)C(P)&&(yield P)}e.filter=d;function*m(S,C){let P=0;for(let M of S)yield C(M,P++)}e.map=m;function*p(S,C){let P=0;for(let M of S)yield*C(M,P++)}e.flatMap=p;function*g(...S){for(let C of S)yield*C}e.concat=g;function w(S,C,P){let M=P;for(let z of S)M=C(M,z);return M}e.reduce=w;function*f(S,C,P=S.length){for(C<0&&(C+=S.length),P<0?P+=S.length:P>S.length&&(P=S.length);C<P;C++)yield S[C]}e.slice=f;function v(S,C=Number.POSITIVE_INFINITY){let P=[];if(C===0)return[P,S];let M=S[Symbol.iterator]();for(let z=0;z<C;z++){let Y=M.next();if(Y.done)return[P,e.empty()];P.push(Y.value)}return[P,{[Symbol.iterator](){return M}}]}e.consume=v;async function y(S){let C=[];for await(let P of S)C.push(P);return Promise.resolve(C)}e.asyncToArray=y})(ev||(ev={}));function qs(e){if(ev.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function tv(...e){return hs(()=>qs(e))}function hs(e){return{dispose:ex(()=>{e()})}}var rv=class iv{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{qs(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?iv.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};rv.DISABLE_DISPOSED_WARNING=!1;var du=rv,Yr=class{constructor(){this._store=new du,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)}};Yr.None=Object.freeze({dispose(){}});var el=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},tx=globalThis.performance&&typeof globalThis.performance.now=="function",rx=class sv{static create(t){return new sv(t)}constructor(t){this._now=tx&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},fu;(e=>{e.None=()=>Yr.None;function t(L,x){return h(L,()=>{},0,void 0,!0,void 0,x)}e.defer=t;function r(L){return(x,E=null,k)=>{let D=!1,O;return O=L(b=>{if(!D)return O?O.dispose():D=!0,x.call(E,b)},null,k),D&&O.dispose(),O}}e.once=r;function i(L,x,E){return c((k,D=null,O)=>L(b=>k.call(D,x(b)),null,O),E)}e.map=i;function s(L,x,E){return c((k,D=null,O)=>L(b=>{x(b),k.call(D,b)},null,O),E)}e.forEach=s;function n(L,x,E){return c((k,D=null,O)=>L(b=>x(b)&&k.call(D,b),null,O),E)}e.filter=n;function o(L){return L}e.signal=o;function l(...L){return(x,E=null,k)=>{let D=tv(...L.map(O=>O(b=>x.call(E,b))));return u(D,k)}}e.any=l;function a(L,x,E,k){let D=E;return i(L,O=>(D=x(D,O),D),k)}e.reduce=a;function c(L,x){let E,k={onWillAddFirstListener(){E=L(D.fire,D)},onDidRemoveLastListener(){E==null||E.dispose()}},D=new Zt(k);return x==null||x.add(D),D.event}function u(L,x){return x instanceof Array?x.push(L):x&&x.add(L),L}function h(L,x,E=100,k=!1,D=!1,O,b){let A,j,V,J=0,le,ee={leakWarningThreshold:O,onWillAddFirstListener(){A=L(re=>{J++,j=x(j,re),k&&!V&&(he.fire(j),j=void 0),le=()=>{let Me=j;j=void 0,V=void 0,(!k||J>1)&&he.fire(Me),J=0},typeof E=="number"?(clearTimeout(V),V=setTimeout(le,E)):V===void 0&&(V=0,queueMicrotask(le))})},onWillRemoveListener(){D&&J>0&&(le==null||le())},onDidRemoveLastListener(){le=void 0,A.dispose()}},he=new Zt(ee);return b==null||b.add(he),he.event}e.debounce=h;function d(L,x=0,E){return e.debounce(L,(k,D)=>k?(k.push(D),k):[D],x,void 0,!0,void 0,E)}e.accumulate=d;function m(L,x=(k,D)=>k===D,E){let k=!0,D;return n(L,O=>{let b=k||!x(O,D);return k=!1,D=O,b},E)}e.latch=m;function p(L,x,E){return[e.filter(L,x,E),e.filter(L,k=>!x(k),E)]}e.split=p;function g(L,x=!1,E=[],k){let D=E.slice(),O=L(j=>{D?D.push(j):A.fire(j)});k&&k.add(O);let b=()=>{D==null||D.forEach(j=>A.fire(j)),D=null},A=new Zt({onWillAddFirstListener(){O||(O=L(j=>A.fire(j)),k&&k.add(O))},onDidAddFirstListener(){D&&(x?setTimeout(b):b())},onDidRemoveLastListener(){O&&O.dispose(),O=null}});return k&&k.add(A),A.event}e.buffer=g;function w(L,x){return(E,k,D)=>{let O=x(new v);return L(function(b){let A=O.evaluate(b);A!==f&&E.call(k,A)},void 0,D)}}e.chain=w;let f=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(x){return this.steps.push(x),this}forEach(x){return this.steps.push(E=>(x(E),E)),this}filter(x){return this.steps.push(E=>x(E)?E:f),this}reduce(x,E){let k=E;return this.steps.push(D=>(k=x(k,D),k)),this}latch(x=(E,k)=>E===k){let E=!0,k;return this.steps.push(D=>{let O=E||!x(D,k);return E=!1,k=D,O?D:f}),this}evaluate(x){for(let E of this.steps)if(x=E(x),x===f)break;return x}}function y(L,x,E=k=>k){let k=(...A)=>b.fire(E(...A)),D=()=>L.on(x,k),O=()=>L.removeListener(x,k),b=new Zt({onWillAddFirstListener:D,onDidRemoveLastListener:O});return b.event}e.fromNodeEventEmitter=y;function S(L,x,E=k=>k){let k=(...A)=>b.fire(E(...A)),D=()=>L.addEventListener(x,k),O=()=>L.removeEventListener(x,k),b=new Zt({onWillAddFirstListener:D,onDidRemoveLastListener:O});return b.event}e.fromDOMEventEmitter=S;function C(L){return new Promise(x=>r(L)(x))}e.toPromise=C;function P(L){let x=new Zt;return L.then(E=>{x.fire(E)},()=>{x.fire(void 0)}).finally(()=>{x.dispose()}),x.event}e.fromPromise=P;function M(L,x){return L(E=>x.fire(E))}e.forward=M;function z(L,x,E){return x(E),L(k=>x(k))}e.runAndSubscribe=z;class Y{constructor(x,E){this._observable=x,this._counter=0,this._hasChanged=!1;let k={onWillAddFirstListener:()=>{x.addObserver(this)},onDidRemoveLastListener:()=>{x.removeObserver(this)}};this.emitter=new Zt(k),E&&E.add(this.emitter)}beginUpdate(x){this._counter++}handlePossibleChange(x){}handleChange(x,E){this._hasChanged=!0}endUpdate(x){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function U(L,x){return new Y(L,x).emitter.event}e.fromObservable=U;function q(L){return(x,E,k)=>{let D=0,O=!1,b={beginUpdate(){D++},endUpdate(){D--,D===0&&(L.reportChanges(),O&&(O=!1,x.call(E)))},handlePossibleChange(){},handleChange(){O=!0}};L.addObserver(b),L.reportChanges();let A={dispose(){L.removeObserver(b)}};return k instanceof du?k.add(A):Array.isArray(k)&&k.push(A),A}}e.fromObservableLight=q})(fu||(fu={}));var rh=class ih{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ih._idPool++}`,ih.all.add(this)}start(t){this._stopWatch=new rx,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};rh.all=new Set,rh._idPool=0;var ix=rh,sx=-1,nv=class ov{constructor(t,r,i=(ov._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let a=new lx(l,n);this._errorHandler(a)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,s]of this._stacks)(!t||r<s)&&(t=[i,s],r=s);return t}};nv._idPool=1;var nx=nv,ox=class lv{constructor(t){this.value=t}static create(){let t=new Error;return new lv(t.stack??"")}print(){console.warn(this.value.split(`
|
|
120
|
+
`).slice(2).join(`
|
|
121
|
+
`))}},lx=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},ax=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},cx=0,pa=class{constructor(e){this.value=e,this.id=cx++}},hx=2,ux,Zt=class{constructor(e){var t,r,i,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new nx((e==null?void 0:e.onListenerError)??_a,((r=this._options)==null?void 0:r.leakWarningThreshold)??sx):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new ix(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,r,i;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var o,l,a,c,u;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new ax(`${h}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(((o=this._options)==null?void 0:o.onListenerError)||_a)(m),Yr.None}if(this._disposed)return Yr.None;t&&(e=e.bind(t));let i=new pa(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=ox.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof pa?(this._deliveryQueue??(this._deliveryQueue=new dx),this._listeners=[this._listeners,i]):this._listeners.push(i):((a=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||a.call(l,this),this._listeners=i,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let n=hs(()=>{s==null||s(),this._removeListener(i)});return r instanceof du?r.add(n):Array.isArray(r)&&r.push(n),n}),this._event}_removeListener(e){var s,n,o,l;if((n=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||n.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||l.call(o,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*hx<=t.length){let a=0;for(let c=0;c<t.length;c++)t[c]?t[a++]=t[c]:i&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=a}}_deliver(e,t){var i;if(!e)return;let r=((i=this._options)==null?void 0:i.onListenerError)||_a;if(!r){e.value(t);return}try{e.value(t)}catch(s){r(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,r,i,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof pa)this._deliver(this._listeners,e);else{let n=this._deliveryQueue;n.enqueue(this,e,this._listeners.length),this._deliverQueue(n)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},dx=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},av=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),fx;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof _x?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:fu.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:av})})(fx||(fx={}));var _x=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?av:(this._emitter||(this._emitter=new Zt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Wi="en",ma=!1,Jn,wo=Wi,Nf=Wi,px,zt,di=globalThis,Ye,Ff;typeof di.vscode<"u"&&typeof di.vscode.process<"u"?Ye=di.vscode.process:typeof process<"u"&&typeof((Ff=process==null?void 0:process.versions)==null?void 0:Ff.node)=="string"&&(Ye=process);var Wf,mx=typeof((Wf=Ye==null?void 0:Ye.versions)==null?void 0:Wf.electron)=="string",vx=mx&&(Ye==null?void 0:Ye.type)==="renderer",Hf;if(typeof Ye=="object"){Ye.platform,Ye.platform,ma=Ye.platform==="linux",ma&&Ye.env.SNAP&&Ye.env.SNAP_REVISION,Ye.env.CI||Ye.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Jn=Wi,wo=Wi;let e=Ye.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Jn=t.userLocale,Nf=t.osLocale,wo=t.resolvedLanguage||Wi,px=(Hf=t.languagePack)==null?void 0:Hf.translationsConfigFile}catch{}}else typeof navigator=="object"&&!vx?(zt=navigator.userAgent,zt.indexOf("Windows")>=0,zt.indexOf("Macintosh")>=0,(zt.indexOf("Macintosh")>=0||zt.indexOf("iPad")>=0||zt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ma=zt.indexOf("Linux")>=0,(zt==null?void 0:zt.indexOf("Mobi"))>=0,wo=globalThis._VSCODE_NLS_LANGUAGE||Wi,Jn=navigator.language.toLowerCase(),Nf=Jn):console.error("Unable to resolve platform.");var or=zt,Pr=wo,gx;(e=>{function t(){return Pr}e.value=t;function r(){return Pr.length===2?Pr==="en":Pr.length>=3?Pr[0]==="e"&&Pr[1]==="n"&&Pr[2]==="-":!1}e.isDefaultVariant=r;function i(){return Pr==="en"}e.isDefault=i})(gx||(gx={}));var yx=typeof di.postMessage=="function"&&!di.importScripts;(()=>{if(yx){let e=[];di.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),n.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),di.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var Sx=!!(or&&or.indexOf("Chrome")>=0);or&&or.indexOf("Firefox")>=0;!Sx&&or&&or.indexOf("Safari")>=0;or&&or.indexOf("Edg/")>=0;or&&or.indexOf("Android")>=0;function cv(e,t=0,r){let i=setTimeout(()=>{e()},t);return hs(()=>{clearTimeout(i)})}var wx;(e=>{async function t(i){let s,n=await Promise.all(i.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return n}e.settled=t;function r(i){return new Promise(async(s,n)=>{try{await i(s,n)}catch(o){n(o)}})}e.withAsyncBody=r})(wx||(wx={}));var Bf=class Et{static fromArray(t){return new Et(r=>{r.emitMany(t)})}static fromPromise(t){return new Et(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Et(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new Et(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Zt,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await fu.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new Et(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return Et.map(this,t)}static filter(t,r){return new Et(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return Et.filter(this,t)}static coalesce(t){return Et.filter(t,r=>!!r)}coalesce(){return Et.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return Et.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Bf.EMPTY=Bf.fromArray([]);var xx=class extends Yr{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new el),this._linesCacheDisposables=this._register(new el),this._register(hs(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=tv(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=cv(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){var t;return(t=this._linesCache)==null?void 0:t[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){var n;let r=[],i=[0],s=this._terminal.buffer.active.getLine(e);for(;s;){let o=this._terminal.buffer.active.getLine(e+1),l=o?o.isWrapped:!1,a=s.translateToString(!l&&t);if(l&&o){let c=s.getCell(s.length-1);c&&c.getCode()===0&&c.getWidth()===1&&((n=o.getCell(0))==null?void 0:n.getWidth())===2&&(a=a.slice(0,-1))}if(r.push(a),l)i.push(i[i.length-1]+a.length);else break;e++,s=o}return[r.join(""),i]}},Cx=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t!=null&&t.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},bx=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,r,i){if(!e||e.length===0){this._terminal.clearSelection();return}if(r>this._terminal.cols)throw new Error(`Invalid col: ${r} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let s={startRow:t,startCol:r},n=this._findInLine(e,s,i);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,i),!n);o++);return n}findNextWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=0,n=0;i&&(r===e?(s=i.end.x,n=i.end.y):(s=i.start.x,n=i.start.y)),this._lineCache.initLinesCache();let o={startRow:n,startCol:s},l=this._findInLine(e,o,t);if(!l)for(let a=n+1;a<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=a,o.startCol=0,l=this._findInLine(e,o,t),!l);a++);if(!l&&n!==0)for(let a=0;a<n&&(o.startRow=a,o.startCol=0,l=this._findInLine(e,o,t),!l);a++);return!l&&i&&(o.startRow=i.start.y,o.startCol=0,l=this._findInLine(e,o,t)),l}findPreviousWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=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 l={startRow:s,startCol:n},a;if(i&&(l.startRow=s=i.start.y,l.startCol=n=i.start.x,r!==e&&(a=this._findInLine(e,l,t,!1),a||(l.startRow=s=i.end.y,l.startCol=n=i.end.x))),a||(a=this._findInLine(e,l,t,o)),!a){l.startCol=Math.max(l.startCol,this._terminal.cols);for(let c=s-1;c>=0&&(l.startRow=c,a=this._findInLine(e,l,t,o),!a);c--);}if(!a&&s!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let c=this._terminal.buffer.active.baseY+this._terminal.rows-1;c>=s&&(l.startRow=c,a=this._findInLine(e,l,t,o),!a);c--);return a}_isWholeWord(e,t,r){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+r.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+r.length]))}_findInLine(e,t,r={},i=!1){var m;let s=t.startRow,n=t.startCol;if((m=this._terminal.buffer.active.getLine(s))!=null&&m.isWrapped){if(i){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,r)}let o=this._lineCache.getLineFromCache(s);o||(o=this._lineCache.translateBufferLineToStringWithWrap(s,!0),this._lineCache.setLineInCache(s,o));let[l,a]=o,c=this._bufferColsToStringOffset(s,n),u=e,h=l;r.regex||(u=r.caseSensitive?e:e.toLowerCase(),h=r.caseSensitive?l:l.toLowerCase());let d=-1;if(r.regex){let p=RegExp(u,r.caseSensitive?"g":"gi"),g;if(i)for(;g=p.exec(h.slice(0,c));)d=p.lastIndex-g[0].length,e=g[0],p.lastIndex-=e.length-1;else g=p.exec(h.slice(c)),g&&g[0].length>0&&(d=c+(p.lastIndex-g[0].length),e=g[0])}else i?c-u.length>=0&&(d=h.lastIndexOf(u,c-u.length)):d=h.indexOf(u,c);if(d>=0){if(r.wholeWord&&!this._isWholeWord(d,h,e))return;let p=0;for(;p<a.length-1&&d>=a[p+1];)p++;let g=p;for(;g<a.length-1&&d+e.length>=a[g+1];)g++;let w=d-a[p],f=d+e.length-a[g],v=this._stringLengthToBufferSize(s+p,w),y=this._stringLengthToBufferSize(s+g,f)-v+this._terminal.cols*(g-p);return{term:e,col:v,row:s+p,size:y}}}_stringLengthToBufferSize(e,t){let r=this._terminal.buffer.active.getLine(e);if(!r)return 0;for(let i=0;i<t;i++){let s=r.getCell(i);if(!s)break;let n=s.getChars();n.length>1&&(t-=n.length-1);let o=r.getCell(i+1);o&&o.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let r=e,i=0,s=this._terminal.buffer.active.getLine(r);for(;t>0&&s;){for(let n=0;n<t&&n<this._terminal.cols;n++){let o=s.getCell(n);if(!o)break;o.getWidth()&&(i+=o.getCode()===0?1:o.getChars().length)}if(r++,s=this._terminal.buffer.active.getLine(r),s&&!s.isWrapped)break;t-=this._terminal.cols}return i}},kx=class extends Yr{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(hs(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let r of e){let i=this._createResultDecorations(r,t,!1);if(i)for(let s of i)this._storeDecoration(s,r)}}createActiveDecoration(e,t){let r=this._createResultDecorations(e,t,!0);if(r)return{decorations:r,match:e,dispose(){qs(r)}}}clearHighlightDecorations(){qs(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,r){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),r&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,r){let i=[],s=e.col,n=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;n>0;){let a=Math.min(this._terminal.cols-s,n);i.push([o,s,a]),s=0,n-=a,o++}let l=[];for(let a of i){let c=this._terminal.registerMarker(a[0]),u=this._terminal.registerDecoration({marker:c,x:a[1],width:a[2],backgroundColor:r?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(c.line)?void 0:{color:r?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(u){let h=[];h.push(c),h.push(u.onRender(d=>this._applyStyles(d,r?t.activeMatchBorder:t.matchBorder,!1))),h.push(u.onDispose(()=>qs(h))),l.push(u)}}return l.length===0?void 0:l}},Ex=class extends Yr{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Zt)}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 r=this._searchResults[t];if(r.row===e.row&&r.col===e.col&&r.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()}},Px=class extends Yr{constructor(e){super(),this._highlightTimeout=this._register(new el),this._lineCache=this._register(new el),this._state=new Cx,this._resultTracker=this._register(new Ex),this._highlightLimit=(e==null?void 0:e.highlightLimit)??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new xx(e),this._engine=new bx(e,this._lineCache.value),this._decorationManager=new kx(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(hs(()=>this.clearDecorations()))}_updateMatches(){var e;this._highlightTimeout.clear(),this._state.cachedSearchTerm&&((e=this._state.lastSearchOptions)!=null&&e.decorations)&&(this._highlightTimeout.value=cv(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){var t;this._resultTracker.clearSelectedDecoration(),(t=this._decorationManager)==null||t.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,r){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 i=this._findNextAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_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)){this.clearDecorations();return}this.clearDecorations(!0);let r=[],i,s=this._engine.find(e,0,0,t);for(;s&&((i==null?void 0:i.row)!==s.row||(i==null?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,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t==null?void 0:t.decorations,r==null?void 0:r.noScroll)}findPrevious(e,t,r){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 i=this._findPreviousAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_fireResults(e){this._resultTracker.fireResultsChanged(!!(e!=null&&e.decorations))}_findPreviousAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t==null?void 0:t.decorations,r==null?void 0:r.noScroll)}_selectResult(e,t,r){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(!r&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let i=e.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};function Of(){const e=W.getState().theme;return mc(e)==="light"?PS:ES}const sh=new Set,nh=new Map,_u=new Map,xo=new Map;function Zn(e){return _u.get(e)}const oh=new Map;function Lx(e,t){oh.set(e,t)}function Dx(e){const t=oh.get(e);return t!==void 0?(oh.delete(e),t):null}function Tx({terminalId:e,projectId:t,cwd:r}){const i=N.useRef(null),s=N.useRef(null),n=N.useRef(null),o=N.useRef(null),l=ne(d=>d.setTerminalInstance),a=ne(d=>d.createSession),c=W(d=>d.setFocusedTerminal);N.useEffect(()=>{const d=i.current;if(!d)return;d.innerHTML="";const m=ne.getState().sessions[e],p=nh.get(e);if(m!=null&&m.terminal&&p){const C=m.terminal;s.current=C,d.appendChild(p);let P=xo.get(e);return P||(P=new Rf,C.loadAddon(P),xo.set(e,P)),n.current=P,requestAnimationFrame(()=>{try{P.fit(),C.scrollToBottom();const{cols:M,rows:z}=C;o.current={cols:M,rows:z},je({type:"pty:resize",terminalId:e,cols:M,rows:z})}catch{}}),()=>{}}const g=Of(),w=mc(W.getState().theme)==="light",f=new $w({theme:g,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"block",allowProposedApi:!0,scrollback:1e4,minimumContrastRatio:w?7:1}),v=new Rf,y=new Yw,S=new Px;return f.loadAddon(v),f.loadAddon(y),f.loadAddon(S),f.open(d),xo.set(e,v),_u.set(e,S),s.current=f,n.current=v,f.element&&nh.set(e,f.element),a(e,t),l(e,f),f.attachCustomKeyEventHandler(C=>{if(C.key==="Enter"&&C.shiftKey)return C.type==="keydown"&&je({type:"pty:input",terminalId:e,data:`
|
|
122
|
+
`}),!1;if(C.metaKey&&!C.altKey&&!C.ctrlKey&&!C.shiftKey&&C.type==="keydown"){if(C.key==="ArrowLeft")return je({type:"pty:input",terminalId:e,data:""}),!1;if(C.key==="ArrowRight")return je({type:"pty:input",terminalId:e,data:""}),!1;if(C.key==="Backspace")return je({type:"pty:input",terminalId:e,data:""}),!1}return!(C.metaKey&&C.key==="f"&&!C.altKey&&!C.ctrlKey||C.metaKey&&C.key==="p"&&!C.altKey&&!C.ctrlKey||["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(C.key)&&C.shiftKey&&!C.metaKey&&!C.altKey)}),f.onData(C=>{je({type:"pty:input",terminalId:e,data:C})}),f.onTitleChange(C=>{ne.getState().setTitle(e,C)}),sh.has(e)||(sh.add(e),requestAnimationFrame(()=>{try{v.fit()}catch{}je({type:"pty:spawn",terminalId:e,projectId:t,cwd:r}),je({type:"pty:resize",terminalId:e,cols:f.cols,rows:f.rows}),o.current={cols:f.cols,rows:f.rows},f.focus(),c(e)})),()=>{}},[e,t,r,a,l]),N.useEffect(()=>{const d=()=>{const f=s.current;if(f){const v=mc(W.getState().theme)==="light";f.options.theme=Of(),f.options.minimumContrastRatio=v?7:1}};d();let m=W.getState().theme;const p=W.subscribe(f=>{f.theme!==m&&(m=f.theme,d())}),g=window.matchMedia("(prefers-color-scheme: light)"),w=()=>{W.getState().theme==="system"&&d()};return g.addEventListener("change",w),()=>{p(),g.removeEventListener("change",w)}},[]);const u=N.useCallback(()=>{const d=n.current,m=s.current;if(!(!d||!m))try{d.fit(),m.scrollToBottom();const{cols:p,rows:g}=m,w=o.current;(!w||w.cols!==p||w.rows!==g)&&(o.current={cols:p,rows:g},je({type:"pty:resize",terminalId:e,cols:p,rows:g}))}catch{}},[e]),h=N.useCallback(()=>{var d;(d=s.current)==null||d.focus(),c(e)},[e,c]);return{containerRef:i,fit:u,focus:h,terminalRef:s}}function En(e){sh.delete(e),nh.delete(e),xo.delete(e),_u.delete(e)}let Pt=null;function Rx(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function je(e){(Pt==null?void 0:Pt.readyState)===WebSocket.OPEN&&Pt.send(JSON.stringify(e))}function Mx(){const e=W(n=>n.setConnectionStatus),t=se(n=>n.addProject),r=se(n=>n.setActiveProject),i=N.useRef(),s=N.useCallback(()=>{if((Pt==null?void 0:Pt.readyState)===WebSocket.OPEN||(Pt==null?void 0:Pt.readyState)===WebSocket.CONNECTING)return;e("connecting");const n=new WebSocket(Rx());Pt=n,n.onopen=()=>{e("connected")},n.onmessage=o=>{var l,a,c;try{const u=JSON.parse(o.data);if(u.type==="pty:output"){const h=ne.getState().sessions[u.terminalId];(l=h==null?void 0:h.terminal)==null||l.write(u.data);const d=Dx(u.terminalId);d&&je({type:"pty:input",terminalId:u.terminalId,data:d});return}if(u.type==="pty:exit"){const h=u.terminalId,d=ne.getState().sessions[h],m=d==null?void 0:d.projectId;if((a=d==null?void 0:d.terminal)==null||a.dispose(),ne.getState().removeSession(h),En(h),m){K.getState().removePaneFromProject(m,h),se.getState().removeTerminalFromProject(m,h);const p=ce(K.getState().getLayout(m)),g=W.getState().focusedTerminalId;if(g===h&&p.length>0){const w=p[0];W.getState().setFocusedTerminal(w);const f=ne.getState().sessions[w];(c=f==null?void 0:f.terminal)==null||c.focus()}else g===h&&W.getState().setFocusedTerminal(null)}return}if(u.type==="project:spawned"){const h=Object.values(se.getState().projects).find(d=>d.cwd===u.cwd);h?r(h.id):(t({id:u.projectId,name:u.name,cwd:u.cwd,terminalIds:[]}),r(u.projectId));return}if(u.type==="port:status"){ne.getState().setActivePorts(u.ports);return}if(u.type==="claude:status"){ne.getState().setClaudeStatus(u.statuses);return}if(u.type==="git:branch"){ne.getState().setGitBranches(u.branches);return}if(u.type==="editor:active"){if(!W.getState().editorSyncEnabled)return;const{projects:h,activeProjectId:d}=se.getState(),m=Object.values(h).find(p=>{const g=p.cwd.replace(/\/$/,"").split("/").pop();return p.name===u.projectName||g===u.projectName});m&&m.id!==d&&(W.getState().showSyncToast(m.name),r(m.id))}}catch{}},n.onclose=()=>{e("disconnected"),ne.getState().setActivePorts({}),ne.getState().setClaudeStatus({}),ne.getState().setGitBranches({}),Pt=null,i.current=setTimeout(s,2e3)},n.onerror=()=>{n.close()}},[e,t,r]);N.useEffect(()=>(s(),()=>{clearTimeout(i.current)}),[s])}const Nx=new Set(["n","w","t","d","r","f","p"]);function Bx(){const e=W(r=>r.toggleSidebar),t=W(r=>r.setFocusedTerminal);N.useEffect(()=>{const r=i=>{var d,m,p;const s=i.key.toLowerCase();if(i.ctrlKey&&i.shiftKey&&!i.metaKey&&!i.altKey&&["arrowleft","arrowright","arrowup","arrowdown"].includes(s)){i.preventDefault(),i.stopPropagation();const g=se.getState().activeProjectId;if(!g)return;const w=K.getState().getLayout(g),f=W.getState().focusedTerminalId;if(!f||!w)return;const y=Od(w,f,s==="arrowleft"?"left":s==="arrowright"?"right":s==="arrowup"?"up":"down");if(y){t(y);const S=ne.getState().sessions[y];(d=S==null?void 0:S.terminal)==null||d.focus()}return}if(i.shiftKey&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&["arrowleft","arrowright","arrowup","arrowdown"].includes(s)){i.preventDefault(),i.stopPropagation();const g=se.getState().activeProjectId;if(!g)return;const w=K.getState().getLayout(g),f=W.getState().focusedTerminalId;if(!f||!w)return;const y=Od(w,f,s==="arrowleft"?"left":s==="arrowright"?"right":s==="arrowup"?"up":"down");y&&(K.getState().swapPanesInProject(g,f,y),requestAnimationFrame(()=>{var C;t(f);const S=ne.getState().sessions[f];(C=S==null?void 0:S.terminal)==null||C.focus()}));return}if(!(navigator.platform.startsWith("Mac")?i.metaKey:i.ctrlKey))return;if((s==="="||s==="+"||s==="-"||s==="0")&&!i.shiftKey&&!("chrome"in window)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent)){i.preventDefault(),i.stopPropagation();const w=parseFloat(document.documentElement.style.zoom||"1");s==="="||s==="+"?document.documentElement.style.zoom=String(Math.min(w+.1,2)):s==="-"?document.documentElement.style.zoom=String(Math.max(w-.1,.5)):document.documentElement.style.zoom="1",window.dispatchEvent(new Event("resize"));return}(Nx.has(s)||s>="1"&&s<="9")&&(i.preventDefault(),i.stopPropagation());const l=se.getState().activeProjectId;if(!l)return;const a=K.getState().getLayout(l),c=W.getState().focusedTerminalId,u=se.getState().projects[l];if(s==="p"&&!i.shiftKey){W.getState().toggleCommandPalette();return}if(s==="f"&&!i.shiftKey){c&&W.getState().openSearch(c);return}if(s==="d"&&!i.shiftKey){e();return}if(s==="n"){if(!u)return;const g=crypto.randomUUID(),w=ce(a);if(w.length>0){const f=c??w[w.length-1],v=i.shiftKey?"horizontal":"vertical";K.getState().addPaneToProject(l,f,g,v)}else K.getState().setLayout(l,{type:"leaf",terminalId:g});se.getState().addTerminalToProject(l,g),t(g);return}if(s==="w"&&!i.shiftKey){if(!c||!a)return;je({type:"pty:kill",terminalId:c}),K.getState().removePaneFromProject(l,c),se.getState().removeTerminalFromProject(l,c);const g=ne.getState().sessions[c];(m=g==null?void 0:g.terminal)==null||m.dispose(),ne.getState().removeSession(c),En(c);const w=ce(K.getState().getLayout(l));t(w[0]??null);return}if(s==="t"&&!i.shiftKey){if(!u)return;const g=ce(a);g.length>0&&K.getState().cyclePreset(l,g);return}if(s==="r"&&!i.shiftKey){const g=ce(a);if(g.length===0)return;let w;g.length<=2?w="even-vertical":g.length===3?w="main-left":w="grid";const f=gi(g,w);f&&K.getState().setLayout(l,f);return}const h=parseInt(s);if(h>=1&&h<=9){const w=ce(a)[h-1];if(w){t(w);const f=ne.getState().sessions[w];(p=f==null?void 0:f.terminal)==null||p.focus()}return}};return window.addEventListener("keydown",r,{capture:!0}),()=>window.removeEventListener("keydown",r,{capture:!0})},[e,t])}const Ar=wn()((e,t)=>({favourites:{},addFavourite:r=>{e(i=>({favourites:{...i.favourites,[r.id]:r}})),Ks({favourites:{...t().favourites}})},updateFavourite:(r,i)=>{e(s=>{const n=s.favourites[r];return n?{favourites:{...s.favourites,[r]:{...n,...i}}}:s}),Ks({favourites:{...t().favourites}})},removeFavourite:r=>{e(i=>{const{[r]:s,...n}=i.favourites;return{favourites:n}}),Ks({favourites:{...t().favourites}})},hydrateFromServer:async()=>{try{const i=await(await fetch("/api/settings")).json();i.favourites&&e({favourites:i.favourites})}catch{}}}));/**
|
|
123
|
+
* @license lucide-react v0.400.0 - ISC
|
|
124
|
+
*
|
|
125
|
+
* This source code is licensed under the ISC license.
|
|
126
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
+
*/const Ox=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hv=(...e)=>e.filter((t,r,i)=>!!t&&i.indexOf(t)===r).join(" ");/**
|
|
128
|
+
* @license lucide-react v0.400.0 - ISC
|
|
129
|
+
*
|
|
130
|
+
* This source code is licensed under the ISC license.
|
|
131
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
+
*/var Ax={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"};/**
|
|
133
|
+
* @license lucide-react v0.400.0 - ISC
|
|
134
|
+
*
|
|
135
|
+
* This source code is licensed under the ISC license.
|
|
136
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
+
*/const Ix=N.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:s="",children:n,iconNode:o,...l},a)=>N.createElement("svg",{ref:a,...Ax,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:hv("lucide",s),...l},[...o.map(([c,u])=>N.createElement(c,u)),...Array.isArray(n)?n:[n]]));/**
|
|
138
|
+
* @license lucide-react v0.400.0 - ISC
|
|
139
|
+
*
|
|
140
|
+
* This source code is licensed under the ISC license.
|
|
141
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
+
*/const te=(e,t)=>{const r=N.forwardRef(({className:i,...s},n)=>N.createElement(Ix,{ref:n,iconNode:t,className:hv(`lucide-${Ox(e)}`,i),...s}));return r.displayName=`${e}`,r};/**
|
|
143
|
+
* @license lucide-react v0.400.0 - ISC
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the ISC license.
|
|
146
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
+
*/const zx=te("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"}]]);/**
|
|
148
|
+
* @license lucide-react v0.400.0 - ISC
|
|
149
|
+
*
|
|
150
|
+
* This source code is licensed under the ISC license.
|
|
151
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
+
*/const uv=te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
153
|
+
* @license lucide-react v0.400.0 - ISC
|
|
154
|
+
*
|
|
155
|
+
* This source code is licensed under the ISC license.
|
|
156
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
+
*/const jx=te("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
158
|
+
* @license lucide-react v0.400.0 - ISC
|
|
159
|
+
*
|
|
160
|
+
* This source code is licensed under the ISC license.
|
|
161
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
+
*/const $x=te("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
163
|
+
* @license lucide-react v0.400.0 - ISC
|
|
164
|
+
*
|
|
165
|
+
* This source code is licensed under the ISC license.
|
|
166
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
+
*/const Fx=te("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"}]]);/**
|
|
168
|
+
* @license lucide-react v0.400.0 - ISC
|
|
169
|
+
*
|
|
170
|
+
* This source code is licensed under the ISC license.
|
|
171
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
+
*/const Wx=te("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"}]]);/**
|
|
173
|
+
* @license lucide-react v0.400.0 - ISC
|
|
174
|
+
*
|
|
175
|
+
* This source code is licensed under the ISC license.
|
|
176
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
+
*/const Cl=te("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
|
|
178
|
+
* @license lucide-react v0.400.0 - ISC
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the ISC license.
|
|
181
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
+
*/const dv=te("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"}]]);/**
|
|
183
|
+
* @license lucide-react v0.400.0 - ISC
|
|
184
|
+
*
|
|
185
|
+
* This source code is licensed under the ISC license.
|
|
186
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
+
*/const Hx=te("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"}]]);/**
|
|
188
|
+
* @license lucide-react v0.400.0 - ISC
|
|
189
|
+
*
|
|
190
|
+
* This source code is licensed under the ISC license.
|
|
191
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
+
*/const pu=te("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"}]]);/**
|
|
193
|
+
* @license lucide-react v0.400.0 - ISC
|
|
194
|
+
*
|
|
195
|
+
* This source code is licensed under the ISC license.
|
|
196
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
+
*/const Ux=te("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"}]]);/**
|
|
198
|
+
* @license lucide-react v0.400.0 - ISC
|
|
199
|
+
*
|
|
200
|
+
* This source code is licensed under the ISC license.
|
|
201
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
+
*/const Kx=te("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
203
|
+
* @license lucide-react v0.400.0 - ISC
|
|
204
|
+
*
|
|
205
|
+
* This source code is licensed under the ISC license.
|
|
206
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
+
*/const fv=te("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"}]]);/**
|
|
208
|
+
* @license lucide-react v0.400.0 - ISC
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the ISC license.
|
|
211
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
212
|
+
*/const Vx=te("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"}]]);/**
|
|
213
|
+
* @license lucide-react v0.400.0 - ISC
|
|
214
|
+
*
|
|
215
|
+
* This source code is licensed under the ISC license.
|
|
216
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
217
|
+
*/const tl=te("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"}]]);/**
|
|
218
|
+
* @license lucide-react v0.400.0 - ISC
|
|
219
|
+
*
|
|
220
|
+
* This source code is licensed under the ISC license.
|
|
221
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
222
|
+
*/const qx=te("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"}]]);/**
|
|
223
|
+
* @license lucide-react v0.400.0 - ISC
|
|
224
|
+
*
|
|
225
|
+
* This source code is licensed under the ISC license.
|
|
226
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
227
|
+
*/const Yx=te("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
228
|
+
* @license lucide-react v0.400.0 - ISC
|
|
229
|
+
*
|
|
230
|
+
* This source code is licensed under the ISC license.
|
|
231
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
232
|
+
*/const _v=te("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"}]]);/**
|
|
233
|
+
* @license lucide-react v0.400.0 - ISC
|
|
234
|
+
*
|
|
235
|
+
* This source code is licensed under the ISC license.
|
|
236
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
237
|
+
*/const Xx=te("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"}]]);/**
|
|
238
|
+
* @license lucide-react v0.400.0 - ISC
|
|
239
|
+
*
|
|
240
|
+
* This source code is licensed under the ISC license.
|
|
241
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
242
|
+
*/const mu=te("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
243
|
+
* @license lucide-react v0.400.0 - ISC
|
|
244
|
+
*
|
|
245
|
+
* This source code is licensed under the ISC license.
|
|
246
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
247
|
+
*/const vu=te("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/**
|
|
248
|
+
* @license lucide-react v0.400.0 - ISC
|
|
249
|
+
*
|
|
250
|
+
* This source code is licensed under the ISC license.
|
|
251
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
252
|
+
*/const Gx=te("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"}]]);/**
|
|
253
|
+
* @license lucide-react v0.400.0 - ISC
|
|
254
|
+
*
|
|
255
|
+
* This source code is licensed under the ISC license.
|
|
256
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
257
|
+
*/const pv=te("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
258
|
+
* @license lucide-react v0.400.0 - ISC
|
|
259
|
+
*
|
|
260
|
+
* This source code is licensed under the ISC license.
|
|
261
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
262
|
+
*/const pn=te("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
263
|
+
* @license lucide-react v0.400.0 - ISC
|
|
264
|
+
*
|
|
265
|
+
* This source code is licensed under the ISC license.
|
|
266
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
267
|
+
*/const bl=te("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/**
|
|
268
|
+
* @license lucide-react v0.400.0 - ISC
|
|
269
|
+
*
|
|
270
|
+
* This source code is licensed under the ISC license.
|
|
271
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
272
|
+
*/const Qx=te("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
273
|
+
* @license lucide-react v0.400.0 - ISC
|
|
274
|
+
*
|
|
275
|
+
* This source code is licensed under the ISC license.
|
|
276
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
277
|
+
*/const kl=te("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"}]]);/**
|
|
278
|
+
* @license lucide-react v0.400.0 - ISC
|
|
279
|
+
*
|
|
280
|
+
* This source code is licensed under the ISC license.
|
|
281
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
282
|
+
*/const Jx=te("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"}]]);/**
|
|
283
|
+
* @license lucide-react v0.400.0 - ISC
|
|
284
|
+
*
|
|
285
|
+
* This source code is licensed under the ISC license.
|
|
286
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
287
|
+
*/const gu=te("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
288
|
+
* @license lucide-react v0.400.0 - ISC
|
|
289
|
+
*
|
|
290
|
+
* This source code is licensed under the ISC license.
|
|
291
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
292
|
+
*/const yu=te("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"}]]);/**
|
|
293
|
+
* @license lucide-react v0.400.0 - ISC
|
|
294
|
+
*
|
|
295
|
+
* This source code is licensed under the ISC license.
|
|
296
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
297
|
+
*/const Zx=te("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"}]]);/**
|
|
298
|
+
* @license lucide-react v0.400.0 - ISC
|
|
299
|
+
*
|
|
300
|
+
* This source code is licensed under the ISC license.
|
|
301
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
302
|
+
*/const bi=te("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Af(e){const t=K.getState().getLayout(e);ce(t).forEach(i=>{var n;const s=ne.getState().sessions[i];(n=s==null?void 0:s.terminal)==null||n.dispose(),ne.getState().removeSession(i),En(i)}),je({type:"project:kill",projectId:e}),K.getState().setLayout(e,null),se.getState().clearProjectTerminals(e)}function eC({project:e,isActive:t,hasActivePorts:r,claudeStatus:i,gitBranch:s,onClick:n,onKill:o,onRemove:l}){const a=e.terminalIds.length;return _.jsxs("div",{onClick:n,className:`
|
|
303
|
+
group flex items-center gap-2 px-3 py-2 mx-2 mb-1 rounded-lg cursor-pointer
|
|
304
|
+
transition-colors duration-100
|
|
305
|
+
${t?"bg-[var(--surface-2)] text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--surface-2)] hover:text-[var(--text-primary)]"}
|
|
306
|
+
`,children:[_.jsx(dv,{size:14,className:t?"text-accent":"text-[var(--text-muted)]"}),_.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[_.jsxs("div",{className:"text-xs font-medium truncate flex items-center gap-1.5",children:[e.name,i&&_.jsx("span",{className:`shrink-0 text-[8px] font-bold leading-none px-1 py-0.5 rounded ${i==="active"?"bg-purple-500/20 text-purple-400 animate-pulse":"bg-purple-500/10 text-purple-400/50"}`,title:i==="active"?"Agent is working":"Agent session open",children:"AI"}),r&&_.jsx("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full bg-[var(--success)]",title:"Dev server running"})]}),s&&_.jsx("div",{className:"flex items-center gap-0.5",children:_.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:[_.jsx(Hx,{size:8,className:"shrink-0"}),_.jsx("span",{className:"truncate",children:s})]})}),_.jsx("div",{className:"text-[10px] text-[var(--text-muted)] truncate font-mono",children:e.cwd})]}),a>0&&_.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:[_.jsx(gu,{size:8}),a]}),_.jsxs("div",{className:"hidden group-hover:flex items-center gap-0.5",children:[a>0&&_.jsx("button",{onClick:c=>{c.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:_.jsx(Wx,{size:12})}),_.jsx("button",{onClick:c=>{c.stopPropagation(),l()},title:"Remove project",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:_.jsx(yu,{size:12})})]})]})}function tC({open:e,onClose:t,onCreate:r,initialName:i,initialCwd:s}){const[n,o]=N.useState(""),[l,a]=N.useState("~"),[c,u]=N.useState(null),[h,d]=N.useState(!1),m=N.useRef(null);N.useEffect(()=>{e&&(o(i??""),a(s??"~"),u(null),setTimeout(()=>{var g;return(g=m.current)==null?void 0:g.focus()},50))},[e,i,s]);const p=N.useCallback(async g=>{if(g.preventDefault(),!n.trim())return;const w=l.trim()||"~",v=Object.values(se.getState().projects).find(y=>y.cwd===w);if(v){u(`Project "${v.name}" already uses this directory`);return}d(!0),u(null);try{const y=await fetch("/api/validate-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:w})}),{valid:S}=await y.json();if(!S){u("Directory does not exist"),d(!1);return}}catch{u("Could not validate path"),d(!1);return}d(!1),r(n.trim(),w),t()},[n,l,r,t]);return e?_.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:_.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[400px] shadow-2xl animate-fade-in",onClick:g=>g.stopPropagation(),children:[_.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[_.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"New Project"}),_.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:_.jsx(bi,{size:14})})]}),_.jsxs("form",{onSubmit:p,className:"p-4 space-y-4",children:[_.jsxs("div",{children:[_.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Project Name"}),_.jsx("input",{ref:m,value:n,onChange:g=>o(g.target.value),placeholder:"my-project",className:`
|
|
307
|
+
w-full px-3 py-2 text-sm
|
|
308
|
+
bg-[var(--surface-0)] border border-[var(--border)]
|
|
309
|
+
text-[var(--text-primary)] placeholder:text-[var(--text-muted)]
|
|
310
|
+
rounded-lg outline-none
|
|
311
|
+
focus:border-accent focus:ring-1 focus:ring-accent/30
|
|
312
|
+
transition-colors
|
|
313
|
+
`})]}),_.jsxs("div",{children:[_.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Working Directory"}),_.jsx("input",{value:l,onChange:g=>{a(g.target.value),u(null)},placeholder:"/path/to/project",className:`
|
|
314
|
+
w-full px-3 py-2 text-sm font-mono
|
|
315
|
+
bg-[var(--surface-0)] border
|
|
316
|
+
text-[var(--text-primary)] placeholder:text-[var(--text-muted)]
|
|
317
|
+
rounded-lg outline-none
|
|
318
|
+
transition-colors
|
|
319
|
+
${c?"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"}
|
|
320
|
+
`}),c&&_.jsx("p",{className:"mt-1.5 text-[11px] text-[var(--danger)]",children:c})]}),_.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[_.jsx("button",{type:"button",onClick:t,className:`
|
|
321
|
+
px-3 py-1.5 text-xs text-[var(--text-secondary)]
|
|
322
|
+
hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]
|
|
323
|
+
rounded-lg transition-colors
|
|
324
|
+
`,children:"Cancel"}),_.jsx("button",{type:"submit",disabled:!n.trim()||h,className:`
|
|
325
|
+
px-3 py-1.5 text-xs font-medium
|
|
326
|
+
bg-accent hover:bg-accent/80
|
|
327
|
+
disabled:opacity-40 disabled:cursor-not-allowed
|
|
328
|
+
text-white rounded-lg transition-colors
|
|
329
|
+
`,children:h?"Checking...":"Create"})]})]})]})}):null}const rC={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function iC({favourite:e,onLaunch:t,onEdit:r,onDelete:i}){const s=`${rC[e.preset]??e.preset}, ${e.slots.length} terminal${e.slots.length!==1?"s":""}`;return _.jsxs("div",{className:`
|
|
330
|
+
group flex items-center gap-2 px-3 py-2 mx-2 rounded-lg cursor-pointer
|
|
331
|
+
text-[var(--text-secondary)] hover:bg-[var(--surface-2)] hover:text-[var(--text-primary)]
|
|
332
|
+
transition-colors duration-100
|
|
333
|
+
`,onClick:t,children:[_.jsx(kl,{size:14,className:"text-[var(--text-muted)] flex-shrink-0"}),_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsx("div",{className:"text-xs font-medium truncate",children:e.name}),_.jsxs("div",{className:"text-[10px] text-[var(--text-muted)] truncate flex items-center gap-0.5",children:[_.jsx(gu,{size:8}),s]})]}),_.jsxs("div",{className:"hidden group-hover:flex items-center gap-0.5",children:[_.jsx("button",{onClick:n=>{n.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:_.jsx(pv,{size:12})}),_.jsx("button",{onClick:n=>{n.stopPropagation(),r()},title:"Edit",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:_.jsx(Gx,{size:12})}),_.jsx("button",{onClick:n=>{n.stopPropagation(),i()},title:"Delete",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:_.jsx(yu,{size:12})})]})]})}function sC({favourites:e,onLaunch:t,onEdit:r,onDelete:i}){const[s,n]=N.useState(!1);return e.length===0?null:_.jsxs("div",{children:[_.jsxs("button",{onClick:()=>n(!s),className:`
|
|
334
|
+
flex items-center gap-1 w-full px-4 py-1.5
|
|
335
|
+
text-[10px] font-semibold uppercase tracking-wider
|
|
336
|
+
text-[var(--text-muted)] hover:text-[var(--text-secondary)]
|
|
337
|
+
transition-colors
|
|
338
|
+
`,children:[s?_.jsx(jx,{size:10}):_.jsx(uv,{size:10}),"Favourites"]}),!s&&_.jsx("div",{children:e.map(o=>_.jsx(iC,{favourite:o,onLaunch:()=>t(o),onEdit:()=>r(o),onDelete:()=>i(o.id)},o.id))})]})}const nC={"even-horizontal":_.jsx(bl,{size:16}),"even-vertical":_.jsx(Cl,{size:16}),"main-left":_.jsx(mu,{size:16}),"main-top":_.jsx(vu,{size:16}),grid:_.jsx(pu,{size:16})},If={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function mv({open:e,onClose:t,onSave:r,editingFavourite:i,defaultPreset:s,defaultSlotCount:n}){const[o,l]=N.useState(""),[a,c]=N.useState("even-horizontal"),[u,h]=N.useState([{label:"",command:""}]),d=N.useRef(null);if(N.useEffect(()=>{if(e){if(i)l(i.name),c(i.preset),h(i.slots.map(f=>({...f})));else{l(""),c(s??"even-horizontal");const f=n??1;h(Array.from({length:f},()=>({label:"",command:""})))}setTimeout(()=>{var f;return(f=d.current)==null?void 0:f.focus()},50)}},[e,i,s,n]),!e)return null;const m=f=>{f.preventDefault(),!(!o.trim()||u.length===0)&&(r(o.trim(),a,u),t())},p=()=>{h([...u,{label:"",command:""}])},g=f=>{u.length<=1||h(u.filter((v,y)=>y!==f))},w=(f,v,y)=>{h(u.map((S,C)=>C===f?{...S,[v]:y}:S))};return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:_.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:f=>f.stopPropagation(),children:[_.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[_.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:i?"Edit Favourite":"Save Favourite"}),_.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:_.jsx(bi,{size:14})})]}),_.jsxs("form",{onSubmit:m,className:"p-4 space-y-4 overflow-y-auto",children:[_.jsxs("div",{children:[_.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Name"}),_.jsx("input",{ref:d,value:o,onChange:f=>l(f.target.value),placeholder:"My Workspace",className:`
|
|
339
|
+
w-full px-3 py-2 text-sm
|
|
340
|
+
bg-[var(--surface-0)] border border-[var(--border)]
|
|
341
|
+
text-[var(--text-primary)] placeholder:text-[var(--text-muted)]
|
|
342
|
+
rounded-lg outline-none
|
|
343
|
+
focus:border-accent focus:ring-1 focus:ring-accent/30
|
|
344
|
+
transition-colors
|
|
345
|
+
`})]}),_.jsxs("div",{children:[_.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Layout"}),_.jsx("div",{className:"flex gap-1",children:Xi.map(f=>_.jsxs("button",{type:"button",onClick:()=>c(f),className:`
|
|
346
|
+
flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors
|
|
347
|
+
${a===f?"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"}
|
|
348
|
+
`,title:If[f],children:[nC[f],_.jsx("span",{className:"hidden sm:inline",children:If[f]})]},f))})]}),_.jsxs("div",{children:[_.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[_.jsx("label",{className:"text-xs text-[var(--text-secondary)]",children:"Terminal Slots"}),_.jsxs("button",{type:"button",onClick:p,className:"flex items-center gap-0.5 text-[10px] text-accent hover:text-accent/80 transition-colors",children:[_.jsx(pn,{size:10}),"Add"]})]}),_.jsx("div",{className:"space-y-2",children:u.map((f,v)=>_.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-[var(--surface-0)] border border-[var(--border)]",children:[_.jsxs("div",{className:"flex-1 space-y-1.5",children:[_.jsx("input",{value:f.label,onChange:y=>w(v,"label",y.target.value),placeholder:`Terminal ${v+1}`,className:`
|
|
349
|
+
w-full px-2 py-1 text-xs
|
|
350
|
+
bg-transparent border border-[var(--border)]
|
|
351
|
+
text-[var(--text-primary)] placeholder:text-[var(--text-muted)]
|
|
352
|
+
rounded outline-none
|
|
353
|
+
focus:border-accent focus:ring-1 focus:ring-accent/30
|
|
354
|
+
transition-colors
|
|
355
|
+
`}),_.jsx("input",{value:f.command,onChange:y=>w(v,"command",y.target.value),placeholder:"Command (optional)",className:`
|
|
356
|
+
w-full px-2 py-1 text-xs font-mono
|
|
357
|
+
bg-transparent border border-[var(--border)]
|
|
358
|
+
text-[var(--text-primary)] placeholder:text-[var(--text-muted)]
|
|
359
|
+
rounded outline-none
|
|
360
|
+
focus:border-accent focus:ring-1 focus:ring-accent/30
|
|
361
|
+
transition-colors
|
|
362
|
+
`})]}),u.length>1&&_.jsx("button",{type:"button",onClick:()=>g(v),className:"p-1 mt-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:_.jsx(yu,{size:12})})]},v))})]}),_.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[_.jsx("button",{type:"button",onClick:t,className:`
|
|
363
|
+
px-3 py-1.5 text-xs text-[var(--text-secondary)]
|
|
364
|
+
hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]
|
|
365
|
+
rounded-lg transition-colors
|
|
366
|
+
`,children:"Cancel"}),_.jsx("button",{type:"submit",disabled:!o.trim()||u.length===0,className:`
|
|
367
|
+
px-3 py-1.5 text-xs font-medium
|
|
368
|
+
bg-accent hover:bg-accent/80
|
|
369
|
+
disabled:opacity-40 disabled:cursor-not-allowed
|
|
370
|
+
text-white rounded-lg transition-colors
|
|
371
|
+
`,children:i?"Update":"Save"})]})]})]})})}function oC({open:e,onClose:t,onConfirm:r,terminalCount:i,favouriteName:s}){return e?_.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:_.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[380px] shadow-2xl animate-fade-in",onClick:n=>n.stopPropagation(),children:[_.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[_.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Launch Favourite"}),_.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:_.jsx(bi,{size:14})})]}),_.jsxs("div",{className:"p-4 space-y-4",children:[_.jsxs("div",{className:"flex items-start gap-3",children:[_.jsx("div",{className:"p-2 rounded-lg bg-yellow-500/10",children:_.jsx(Zx,{size:16,className:"text-yellow-500"})}),_.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:["Launching ",_.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:s})," will close ",i," existing terminal",i!==1?"s":"",". Continue?"]})]}),_.jsxs("div",{className:"flex justify-end gap-2",children:[_.jsx("button",{onClick:t,className:`
|
|
372
|
+
px-3 py-1.5 text-xs text-[var(--text-secondary)]
|
|
373
|
+
hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]
|
|
374
|
+
rounded-lg transition-colors
|
|
375
|
+
`,children:"Cancel"}),_.jsx("button",{onClick:()=>{r(),t()},className:`
|
|
376
|
+
px-3 py-1.5 text-xs font-medium
|
|
377
|
+
bg-accent hover:bg-accent/80
|
|
378
|
+
text-white rounded-lg transition-colors
|
|
379
|
+
`,children:"Launch"})]})]})]})}):null}function lC(){const[e,t]=N.useState(!1),[r,i]=N.useState(!1),[s,n]=N.useState(!1),[o,l]=N.useState(null),[a,c]=N.useState(null),[u,h]=N.useState(null),[d,m]=N.useState(!1),[p,g]=N.useState(null);N.useEffect(()=>{fetch("/api/version").then(T=>T.json()).then(T=>{T.latest&&aC(T.latest,T.current)&&g({current:T.current,latest:T.latest})}).catch(()=>{})},[]);const w=se(T=>T.projects),f=se(T=>T.activeProjectId),v=se(T=>T.setActiveProject),y=se(T=>T.addProject),S=se(T=>T.removeProject),C=se(T=>T.addTerminalToProject),P=W(T=>T.sidebarOpen),M=W(T=>T.sidebarWidth),z=W(T=>T.setSidebarWidth),Y=W(T=>T.toggleSidebar),U=W(T=>T.connectionStatus),q=N.useRef(!1),L=W(T=>T.editorSyncEnabled),x=W(T=>T.toggleEditorSync),E=W(T=>T.theme),k=W(T=>T.cycleTheme),D=ne(T=>T.activePorts),O=ne(T=>T.claudeStatus),b=ne(T=>T.gitBranches),A=Ar(T=>T.favourites);Ar(T=>T.addFavourite);const j=Ar(T=>T.updateFavourite),V=Ar(T=>T.removeFavourite),J=W(T=>T.pendingFavouriteLaunchId),le=W(T=>T.clearPendingFavouriteLaunch),[ee,he]=N.useState(null),[re,Me]=N.useState(null),us=N.useCallback(()=>{fetch("/api/cleanup-projects").then(T=>T.json()).then(T=>{T.stale.length===0?(he([]),setTimeout(()=>he(null),2e3)):he(T.stale)}).catch(()=>{})},[]),Kt=N.useCallback(()=>{fetch("/api/cleanup-projects",{method:"POST"}).then(T=>T.json()).then(T=>{for(const ve of Object.values(w))T.removed.includes(ve.name)&&(K.getState().removeProjectLayout(ve.id),S(ve.id));he(null)}).catch(()=>{})},[w,S]),ki=(T,ve)=>{const Le=Object.values(w).find(xr=>xr.cwd===ve);if(Le){v(Le.id);return}const qt=crypto.randomUUID();y({id:qt,name:T,cwd:ve,terminalIds:[]}),je({type:"project:create",projectId:qt,name:T,cwd:ve}),v(qt)},wr=T=>{Af(T)},Vt=T=>{Me(T)},ie=()=>{re&&(wr(re),je({type:"project:remove",projectId:re}),K.getState().removeProjectLayout(re),S(re),Me(null))},Jr=N.useCallback(T=>{if(!f||!w[f])return;Af(f);const Le=T.slots.map(()=>crypto.randomUUID());T.slots.forEach((xr,bv)=>{xr.command.trim()&&Lx(Le[bv],xr.command+`
|
|
380
|
+
`)});const qt=gi(Le,T.preset);K.getState().setLayout(f,qt),Le.forEach(xr=>{C(f,xr)}),Le.length>0&&W.getState().setFocusedTerminal(Le[0])},[f,w,C]),El=N.useCallback(T=>{if(!f)return;const ve=K.getState().getLayout(f);ce(ve).length>0?(c(T),n(!0)):Jr(T)},[f,Jr]);N.useEffect(()=>{if(!J)return;const T=A[J];le(),T&&El(T)},[J,A,le,El]);const vv=T=>{l(T),i(!0)},gv=(T,ve,Le)=>{o&&j(o.id,{name:T,preset:ve,slots:Le}),l(null)},yv=N.useCallback(T=>{T.dataTransfer.types.includes("Files")&&(T.preventDefault(),T.dataTransfer.dropEffect="copy",m(!0))},[]),Sv=N.useCallback(T=>{T.currentTarget.contains(T.relatedTarget)||m(!1)},[]),wv=N.useCallback(T=>{T.preventDefault(),q.current=!0;const ve=qt=>{z(qt.clientX)},Le=()=>{q.current=!1,window.removeEventListener("mousemove",ve),window.removeEventListener("mouseup",Le),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",ve),window.addEventListener("mouseup",Le)},[z]),xv=N.useCallback(T=>{if(m(!1),!T.dataTransfer.types.includes("Files")||T.dataTransfer.files.length===0)return;T.preventDefault(),T.stopPropagation();const ve=T.dataTransfer.files[0];fetch("/api/resolve-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ve.name,size:ve.size,lastModified:ve.lastModified})}).then(Le=>Le.json()).then(Le=>{if(!Le.path||!Le.isDirectory)return;const qt=Le.path,xr=qt.split("/").pop()||ve.name;h({name:xr,cwd:qt}),t(!0)}).catch(()=>{})},[]);if(!P)return null;const Su=Object.values(w),wu=Object.values(A),Cv=(f?w[f]:null)?ce(K.getState().getLayout(f)).length:0;return _.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:M},onDragOver:yv,onDragLeave:Sv,onDrop:xv,children:[_.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:wv}),_.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"text-sm font-semibold tracking-tight text-[var(--text-primary)]",children:"Paneful"}),_.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${U==="connected"?"bg-[var(--success)]":U==="connecting"?"bg-yellow-500 animate-pulse":"bg-[var(--danger)]"}`,title:U})]}),_.jsxs("div",{className:"flex items-center gap-1",children:[_.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:`Theme: ${E}. Click to cycle.`,children:E==="light"?_.jsx(Jx,{size:14}):E==="dark"?_.jsx(Yx,{size:14}):_.jsx(qx,{size:14})}),_.jsx("button",{onClick:x,className:`p-1 rounded transition-colors ${L?"text-[var(--accent)] hover:bg-[var(--surface-3)]":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]"}`,title:L?"Editor sync ON — auto-switches project based on your active editor. Click to disable.":"Editor sync OFF — click to enable. Requires: (1) Paneful (or Terminal, if running from CLI) in System Settings → Privacy & Security → Accessibility, (2) Editor window title includes folder name (default in VS Code/Cursor). Note: after updating paneful, you may need to remove and re-add it in Accessibility settings.",children:_.jsx(tl,{size:14})}),_.jsx("button",{onClick:us,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:_.jsx(zx,{size:14})}),_.jsx("button",{onClick:Y,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Hide sidebar",children:_.jsx(_v,{size:14})})]})]}),_.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Su.length===0&&wu.length===0?_.jsx("div",{className:"px-4 py-8 text-center",children:_.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"No projects yet"})}):_.jsxs(_.Fragment,{children:[Su.map(T=>{var ve;return _.jsx(eC,{project:T,isActive:T.id===f,hasActivePorts:(((ve=D[T.id])==null?void 0:ve.length)??0)>0,claudeStatus:O[T.id]??null,gitBranch:b[T.id]??null,onClick:()=>v(T.id),onKill:()=>wr(T.id),onRemove:()=>Vt(T.id)},T.id)}),_.jsx(sC,{favourites:wu,onLaunch:El,onEdit:vv,onDelete:V})]})}),_.jsxs("div",{className:"mx-3 mb-2 px-3 py-2.5 rounded-lg bg-[var(--surface-2)] text-[10px] text-[var(--text-muted)] leading-relaxed flex flex-col items-center gap-1.5 text-center",children:[_.jsx(Vx,{size:12,className:"text-yellow-500"}),"Drag a folder into this sidebar to create a project"]}),_.jsx("div",{className:"p-2 border-t border-[var(--border)]",children:_.jsxs("button",{onClick:()=>t(!0),className:`
|
|
381
|
+
w-full flex items-center justify-center gap-1.5
|
|
382
|
+
px-3 py-2 text-xs
|
|
383
|
+
text-[var(--text-secondary)] hover:text-[var(--text-primary)]
|
|
384
|
+
bg-[var(--surface-2)] hover:bg-[var(--surface-3)]
|
|
385
|
+
rounded-lg transition-colors
|
|
386
|
+
`,children:[_.jsx(pn,{size:14}),"New Project"]})}),p&&_.jsxs("div",{className:"px-4 py-3 border-t border-[var(--border)]",children:[_.jsxs("a",{href:"https://www.npmjs.com/package/paneful",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-xs text-[var(--accent)] hover:underline",children:[_.jsx(Fx,{size:14}),_.jsxs("span",{children:["v",p.latest," available (current: v",p.current,")"]})]}),_.jsx("p",{className:"text-[10px] text-[var(--text-muted)] mt-1",children:"paneful update"})]}),_.jsx(tC,{open:e,onClose:()=>{t(!1),h(null)},onCreate:ki,initialName:u==null?void 0:u.name,initialCwd:u==null?void 0:u.cwd}),_.jsx(mv,{open:r,onClose:()=>{i(!1),l(null)},onSave:gv,editingFavourite:o}),_.jsx(oC,{open:s,onClose:()=>{n(!1),c(null)},onConfirm:()=>{a&&Jr(a)},terminalCount:Cv,favouriteName:(a==null?void 0:a.name)??""}),ee!==null&&_.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>he(null),children:_.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:T=>T.stopPropagation(),children:[_.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Clean Up Projects"}),ee.length===0?_.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"All projects have valid directories."}):_.jsxs(_.Fragment,{children:[_.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-3",children:[ee.length," project",ee.length>1?"s":""," with missing directories:"]}),_.jsx("div",{className:"space-y-1.5 mb-4 max-h-40 overflow-y-auto",children:ee.map(T=>_.jsxs("div",{className:"text-xs px-2 py-1.5 rounded bg-[var(--surface-2)]",children:[_.jsx("div",{className:"font-medium text-[var(--text-primary)]",children:T.name}),_.jsx("div",{className:"text-[10px] text-[var(--text-muted)] font-mono truncate",children:T.cwd})]},T.id))}),_.jsxs("div",{className:"flex gap-2 justify-end",children:[_.jsx("button",{onClick:()=>he(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),_.jsxs("button",{onClick:Kt,className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:["Remove ",ee.length," project",ee.length>1?"s":""]})]})]})]})}),re&&w[re]&&_.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>Me(null),children:_.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:T=>T.stopPropagation(),children:[_.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Remove Project"}),_.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-4",children:["Remove ",_.jsx("strong",{children:w[re].name}),"? This will kill all its terminals."]}),_.jsxs("div",{className:"flex gap-2 justify-end",children:[_.jsx("button",{onClick:()=>Me(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),_.jsx("button",{onClick:ie,className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:"Remove"})]})]})})]})}function aC(e,t){const r=e.split(".").map(Number),i=t.split(".").map(Number);for(let s=0;s<3;s++){if((r[s]||0)>(i[s]||0))return!0;if((r[s]||0)<(i[s]||0))return!1}return!1}const cC="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)]",hC=[{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 uC({open:e,onClose:t}){return e?_.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:_.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[440px] shadow-2xl animate-fade-in",onClick:r=>r.stopPropagation(),children:[_.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[_.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Keyboard Shortcuts"}),_.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:_.jsx(bi,{size:14})})]}),_.jsx("div",{className:"p-4 space-y-2",children:hC.map((r,i)=>_.jsxs("div",{className:"flex items-center justify-between py-1",children:[_.jsx("div",{className:"flex items-center gap-1",children:r.keys.map((s,n)=>_.jsx("kbd",{className:cC,children:s},n))}),_.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:r.action})]},i))})]})}):null}const dC={"even-horizontal":_.jsx(bl,{size:14}),"even-vertical":_.jsx(Cl,{size:14}),"main-left":_.jsx(mu,{size:14}),"main-top":_.jsx(vu,{size:14}),grid:_.jsx(pu,{size:14})},fC={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function _C({onNewPane:e}){const[t,r]=N.useState(!1),[i,s]=N.useState(!1),n=W(w=>w.sidebarOpen),o=W(w=>w.toggleSidebar),l=se(w=>w.activeProjectId),a=K(w=>w.currentPresetIndex),c=K(w=>w.cyclePreset),u=Ar(w=>w.addFavourite),h=()=>{if(!l)return;const w=K.getState().getLayout(l),f=ce(w);f.length>0&&c(l,f)},d=()=>{if(!l)return;const w=K.getState().getLayout(l),f=ce(w);if(f.length===0)return;let v;f.length<=2?v="even-vertical":f.length===3?v="main-left":v="grid";const y=gi(f,v);y&&K.getState().setLayout(l,y)},m=(w,f,v)=>{u({id:crypto.randomUUID(),name:w,preset:f,slots:v})},p=Xi[a],g=l?ce(K.getState().getLayout(l)).length:0;return _.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&&_.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:_.jsx(Xx,{size:14})}),_.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),_.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:_.jsx(Cl,{size:14})}),_.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:_.jsx(bl,{size:14})}),_.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),_.jsxs("button",{onClick:h,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:[dC[p],_.jsx("span",{className:"hidden sm:inline",children:fC[p]})]}),_.jsx("button",{onClick:d,className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Auto reorganize (Cmd+R)",children:_.jsx(fv,{size:14})}),_.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),_.jsx("button",{onClick:()=>r(!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:_.jsx(kl,{size:14})}),_.jsx("div",{className:"flex-1"}),_.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:_.jsx(Kx,{size:14})}),_.jsx(mv,{open:t,onClose:()=>r(!1),onSave:m,defaultPreset:p,defaultSlotCount:Math.max(g,1)}),_.jsx(uC,{open:i,onClose:()=>s(!1)})]})}function pC(e,t){const r=N.useRef();N.useEffect(()=>{const i=e.current;if(!i)return;const s=new ResizeObserver(()=>{clearTimeout(r.current),r.current=setTimeout(t,kS)});return s.observe(i),()=>{s.disconnect(),clearTimeout(r.current)}},[e,t])}function mC(e,t){const r=W(d=>d.setDragging),i=W(d=>d.setDropTarget),s=W(d=>d.draggingTerminalId),n=K(d=>d.movePaneInProject),o=K(d=>d.swapPanesInProject),l=N.useCallback(d=>{d.dataTransfer.setData("text/plain",e),d.dataTransfer.effectAllowed="move",r(e)},[e,r]),a=N.useCallback(()=>{r(null),i(null)},[r,i]),c=N.useCallback(d=>{if(d.preventDefault(),d.dataTransfer.dropEffect="move",!s||s===e){i(null);return}const m=d.currentTarget.getBoundingClientRect(),p=(d.clientX-m.left)/m.width,g=(d.clientY-m.top)/m.height;let w="center";const f=.2;p<f?w="left":p>1-f?w="right":g<f?w="top":g>1-f&&(w="bottom"),i({terminalId:e,edge:w})},[e,s,i]),u=N.useCallback(()=>{i(null)},[i]),h=N.useCallback(d=>{d.preventDefault();const m=d.dataTransfer.getData("text/plain");if(!m||m===e)return;const p=W.getState().dropTarget;p&&(p.edge==="center"?o(t,m,e):n(t,m,e,p.edge),r(null),i(null))},[e,t,n,o,r,i]);return{onDragStart:l,onDragEnd:a,onDragOver:c,onDragLeave:u,onDrop:h}}function vC({terminalId:e,projectId:t,isFocused:r,onClose:i,dragProps:s}){const n=ne(h=>h.sessions[e]),o=(n==null?void 0:n.title)??"Terminal",l=(n==null?void 0:n.alive)??!0,a=K(h=>h.getLayout(t)),u=ce(a).indexOf(e)+1;return _.jsxs("div",{draggable:!0,onDragStart:s.onDragStart,onDragEnd:s.onDragEnd,className:`
|
|
387
|
+
flex items-center h-7 px-2 gap-1.5 flex-shrink-0
|
|
388
|
+
border-b transition-colors duration-100
|
|
389
|
+
select-none cursor-grab active:cursor-grabbing
|
|
390
|
+
${r?"bg-[var(--surface-3)] border-[var(--accent)]":"bg-[var(--surface-2)] border-[var(--border)]"}
|
|
391
|
+
`,children:[_.jsx("div",{className:"text-[var(--text-muted)]",children:_.jsx(Ux,{size:12})}),_.jsx("span",{className:"text-[10px] font-medium text-[var(--text-muted)] tabular-nums",children:u}),_.jsx("span",{className:"text-xs text-[var(--text-secondary)] truncate flex-1",children:o}),!l&&_.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--danger)]"}),_.jsx("button",{onClick:h=>{h.stopPropagation(),i()},onMouseDown:h=>h.stopPropagation(),draggable:!1,className:`
|
|
392
|
+
p-0.5 rounded text-[var(--text-muted)]
|
|
393
|
+
hover:text-[var(--danger)] hover:bg-[var(--danger-dim)]
|
|
394
|
+
transition-colors
|
|
395
|
+
`,children:_.jsx(bi,{size:12})})]})}const va={matchBackground:void 0,matchBorder:"#facc15aa",matchOverviewRuler:"#facc15",activeMatchBackground:"#694d00",activeMatchBorder:"#fde047",activeMatchColorOverviewRuler:"#facc15"};function gC({terminalId:e,onClose:t}){const r=N.useRef(null),[i,s]=N.useState("");N.useEffect(()=>{var u;(u=r.current)==null||u.focus()},[]);const n=N.useCallback(()=>{const u=Zn(e);u&&i&&u.findNext(i,{regex:!1,caseSensitive:!1,incremental:!1,decorations:va})},[e,i]),o=N.useCallback(()=>{const u=Zn(e);u&&i&&u.findPrevious(i,{regex:!1,caseSensitive:!1,incremental:!1,decorations:va})},[e,i]),l=N.useCallback(()=>{const u=Zn(e);u==null||u.clearDecorations(),t()},[e,t]),a=u=>{const h=u.target.value;s(h);const d=Zn(e);d&&(h?d.findNext(h,{regex:!1,caseSensitive:!1,incremental:!0,decorations:va}):d.clearDecorations())},c=u=>{if(u.key==="Escape"){u.stopPropagation(),l();return}u.key==="Enter"&&(u.preventDefault(),u.shiftKey?o():n())};return _.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-[var(--surface-2)] border-b border-[var(--border)]",onClick:u=>u.stopPropagation(),children:[_.jsx("input",{ref:r,type:"text",value:i,onChange:a,onKeyDown:c,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)]"}),_.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:_.jsx($x,{size:16})}),_.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:_.jsx(uv,{size:16})}),_.jsx("button",{onClick:l,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:_.jsx(bi,{size:16})})]})}function yC({terminalId:e}){const t=W(n=>n.dropTarget);if(!t||t.terminalId!==e)return null;const r=t.edge,i=r==="center",s={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"};return _.jsx("div",{className:`
|
|
396
|
+
absolute ${s[r]??"inset-0"}
|
|
397
|
+
pointer-events-none z-20
|
|
398
|
+
${i?"bg-accent/15 border-2 border-accent/40":"bg-accent/20 border-2 border-accent/50"}
|
|
399
|
+
rounded-sm transition-all duration-100
|
|
400
|
+
`})}function SC({terminalId:e,projectId:t,cwd:r}){const i=W(w=>w.focusedTerminalId),s=W(w=>w.draggingTerminalId),n=W(w=>w.searchTerminalId),o=i===e,l=s===e,a=n===e,{containerRef:c,fit:u,focus:h}=Tx({terminalId:e,projectId:t,cwd:r}),d=mC(e,t);pC(c,u);const m=N.useCallback(()=>{var v;je({type:"pty:kill",terminalId:e}),K.getState().removePaneFromProject(t,e),se.getState().removeTerminalFromProject(t,e);const w=ne.getState().sessions[e];(v=w==null?void 0:w.terminal)==null||v.dispose(),ne.getState().removeSession(e),En(e);const f=ce(K.getState().getLayout(t));W.getState().setFocusedTerminal(f[0]??null)},[e,t]),p=N.useCallback(w=>{if(!(W.getState().draggingTerminalId!=null)&&(w.dataTransfer.types.includes("codefiles")||w.dataTransfer.types.includes("text/plain"))){const v=w.dataTransfer.getData("codefiles");let y=[];if(v)try{y=JSON.parse(v)}catch{}if(y.length===0){const S=w.dataTransfer.getData("text/plain").trim();S&&S.startsWith("/")&&(y=S.split(`
|
|
401
|
+
`).map(C=>C.trim()).filter(Boolean))}if(y.length>0&&!w.dataTransfer.types.includes("Files")){w.preventDefault(),w.stopPropagation();const S=y.map(C=>/[ ()'"]/.test(C)?`'${C.replace(/'/g,"'\\''")}'`:C);je({type:"pty:input",terminalId:e,data:S.join(" ")}),h();return}}if(w.dataTransfer.types.includes("Files")&&w.dataTransfer.files.length>0){w.preventDefault(),w.stopPropagation();const v=Array.from(w.dataTransfer.files);Promise.all(v.map(y=>fetch("/api/resolve-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y.name,size:y.size,lastModified:y.lastModified})}).then(S=>S.json()).then(S=>S.path).catch(()=>null))).then(y=>{const S=y.filter(Boolean);if(S.length>0){const C=S.map(P=>/[ ()'"]/.test(P)?`'${P.replace(/'/g,"'\\''")}'`:P);je({type:"pty:input",terminalId:e,data:C.join(" ")}),h()}});return}d.onDrop(w)},[e,d,h]),g=N.useCallback(w=>{if(W.getState().draggingTerminalId!=null){d.onDragOver(w);return}if(w.dataTransfer.types.includes("Files")||w.dataTransfer.types.includes("codefiles")||w.dataTransfer.types.includes("text/plain")){w.preventDefault(),w.dataTransfer.dropEffect="copy";return}d.onDragOver(w)},[d]);return _.jsxs("div",{style:{borderColor:o?"var(--accent)":"transparent"},className:`
|
|
402
|
+
flex flex-col h-full w-full relative border
|
|
403
|
+
${l?"opacity-40":""}
|
|
404
|
+
transition-colors duration-100
|
|
405
|
+
`,onClick:h,onDragOver:g,onDragLeave:d.onDragLeave,onDrop:p,children:[_.jsx(vC,{terminalId:e,projectId:t,isFocused:o,onClose:m,dragProps:{onDragStart:d.onDragStart,onDragEnd:d.onDragEnd}}),a&&_.jsx(gC,{terminalId:e,onClose:()=>{W.getState().closeSearch(),h()}}),_.jsx("div",{ref:c,className:"flex-1 min-h-0 min-w-0 overflow-hidden"}),_.jsx(yC,{terminalId:e})]})}function wC({projectId:e,path:t,direction:r}){const i=K(o=>o.resizePaneInProject),s=N.useRef(null);return{onMouseDown:N.useCallback(o=>{var d;o.preventDefault(),o.stopPropagation();const l=(d=s.current)==null?void 0:d.parentElement;if(!l)return;const a=l.getBoundingClientRect();r==="vertical"?o.clientX:o.clientY;const c=r==="vertical"?a.width:a.height,u=m=>{const p=r==="vertical"?m.clientX:m.clientY,g=r==="vertical"?a.left:a.top,w=(p-g)/c;i(e,t,w)},h=()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",h),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",u),document.addEventListener("mouseup",h),document.body.style.cursor=r==="vertical"?"col-resize":"row-resize",document.body.style.userSelect="none"},[e,t,r,i]),containerRef:s}}function xC({projectId:e,path:t,direction:r}){const{onMouseDown:i,containerRef:s}=wC({projectId:e,path:t,direction:r}),n=r==="vertical";return _.jsxs("div",{ref:s,className:`
|
|
406
|
+
relative z-10 flex-shrink-0
|
|
407
|
+
${n?"w-[4px] cursor-col-resize":"h-[4px] cursor-row-resize"}
|
|
408
|
+
group
|
|
409
|
+
`,onMouseDown:i,children:[_.jsx("div",{className:`
|
|
410
|
+
absolute
|
|
411
|
+
${n?"inset-y-0 -left-[2px] w-[8px]":"inset-x-0 -top-[2px] h-[8px]"}
|
|
412
|
+
transition-colors duration-150
|
|
413
|
+
hover:bg-accent/40
|
|
414
|
+
group-active:bg-accent/60
|
|
415
|
+
`}),_.jsx("div",{className:`
|
|
416
|
+
${n?"w-full h-full":"h-full w-full"}
|
|
417
|
+
bg-[var(--border)]
|
|
418
|
+
transition-colors duration-150
|
|
419
|
+
group-hover:bg-accent/60
|
|
420
|
+
group-active:bg-accent
|
|
421
|
+
`})]})}function lh({node:e,projectId:t,cwd:r,path:i=[]}){if(e.type==="leaf")return _.jsx(SC,{terminalId:e.terminalId,projectId:t,cwd:r});const s=e.direction==="vertical",n=`${e.ratio*100}%`,o=`${(1-e.ratio)*100}%`;return _.jsxs("div",{className:`flex ${s?"flex-row":"flex-col"} h-full w-full`,children:[_.jsx("div",{style:{flexBasis:n,minWidth:0,minHeight:0,overflow:"hidden"},className:"flex",children:_.jsx(lh,{node:e.first,projectId:t,cwd:r,path:[...i,0]})}),_.jsx(xC,{projectId:t,path:i,direction:e.direction}),_.jsx("div",{style:{flexBasis:o,minWidth:0,minHeight:0,overflow:"hidden"},className:"flex",children:_.jsx(lh,{node:e.second,projectId:t,cwd:r,path:[...i,1]})})]})}function CC(){const[e,t]=N.useState(null);return N.useEffect(()=>{let r=!1;return Math.random()<.5?fetch("https://dummyjson.com/quotes/random").then(s=>s.json()).then(s=>{!r&&(s!=null&&s.quote)&&t({text:s.quote,attribution:s.author})}).catch(()=>{}):fetch("https://uselessfacts.jsph.pl/api/v2/facts/random?language=en").then(s=>s.json()).then(s=>{!r&&(s!=null&&s.text)&&t({text:s.text})}).catch(()=>{}),()=>{r=!0}},[]),e}function bC({onNewTerminal:e,projectName:t}){const r=CC(),i=Ar(n=>n.favourites),s=Object.values(i);return _.jsx("div",{className:"h-full w-full flex items-center justify-center bg-[var(--surface-0)]",children:_.jsxs("div",{className:"flex flex-col items-center gap-8 text-center max-w-md px-8",children:[_.jsxs("div",{className:"flex flex-col items-center gap-4",children:[_.jsx("div",{className:"w-16 h-16 rounded-2xl bg-[var(--surface-2)] border border-[var(--border)] flex items-center justify-center",children:_.jsx(gu,{size:28,className:"text-[var(--text-muted)]"})}),_.jsxs("div",{children:[_.jsx("h2",{className:"text-lg font-medium text-[var(--text-primary)] mb-1",children:t??"No project selected"}),_.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:t?"This project has no active terminals.":"Create a project to get started."})]}),t&&_.jsxs("button",{onClick:e,className:`
|
|
422
|
+
flex items-center gap-2 px-5 py-2.5
|
|
423
|
+
bg-accent hover:bg-accent/80
|
|
424
|
+
text-white text-sm font-medium
|
|
425
|
+
rounded-lg transition-colors
|
|
426
|
+
`,children:[_.jsx(pn,{size:16}),"New Terminal"]})]}),t&&s.length>0&&_.jsxs("div",{className:"w-full rounded-xl bg-[var(--surface-1)] border border-[var(--border)] p-4",children:[_.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:[_.jsx(kl,{size:11}),"Favourites"]}),_.jsx("div",{className:"space-y-1.5",children:s.map(n=>_.jsxs("button",{onClick:()=>W.getState().requestFavouriteLaunch(n.id),className:`
|
|
427
|
+
group w-full flex items-center gap-2.5 px-3 py-2.5
|
|
428
|
+
bg-[var(--surface-2)] hover:bg-[var(--surface-3)]
|
|
429
|
+
text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]
|
|
430
|
+
rounded-lg transition-colors text-left
|
|
431
|
+
`,children:[_.jsx(pv,{size:12,className:"text-[var(--text-muted)] group-hover:text-[var(--accent)] shrink-0 transition-colors"}),_.jsx("span",{className:"truncate font-medium",children:n.name}),_.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)] tabular-nums shrink-0",children:[n.slots.length," pane",n.slots.length!==1?"s":""]})]},n.id))})]}),r&&_.jsxs("div",{className:"max-w-sm",children:[_.jsxs("p",{className:"text-sm italic text-[var(--text-muted)] leading-relaxed",children:['"',r.text,'"']}),r.attribution&&_.jsxs("p",{className:"text-xs text-[var(--text-muted)]/60 mt-2",children:["— ",r.attribution]})]})]})})}function kC(){const e=W(s=>s.syncToast),t=W(s=>s.dismissSyncToast),[r,i]=N.useState(!1);return N.useEffect(()=>{if(!e){i(!1);return}requestAnimationFrame(()=>i(!0));const s=setTimeout(()=>{i(!1),setTimeout(t,200)},3e3);return()=>clearTimeout(s)},[e==null?void 0:e.id]),e?_.jsxs("div",{onClick:()=>{i(!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:r?1:0,transform:r?"translate(-50%, 0)":"translate(-50%, -8px)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:r?"auto":"none"},children:[_.jsx(tl,{size:15,style:{color:"#a16207",flexShrink:0}}),_.jsxs("span",{children:["Synced to ",_.jsx("strong",{children:e.projectName})]})]}):null}function EC(){const e=W(r=>r.commandPaletteOpen),t=W(r=>r.closeCommandPalette);return e?_.jsx(PC,{onClose:t}):null}function PC({onClose:e}){const[t,r]=N.useState(""),[i,s]=N.useState(0),n=N.useRef(null),o=N.useRef(null);N.useEffect(()=>{var h;(h=n.current)==null||h.focus()},[]);const l=N.useMemo(()=>LC(),[e]),a=N.useMemo(()=>{if(!t.trim())return l;const h=t.toLowerCase();return l.filter(d=>d.label.toLowerCase().includes(h))},[l,t]);N.useEffect(()=>{s(0)},[t]);const c=N.useCallback(h=>{h.action(),e()},[e]),u=h=>{if(h.key==="Escape"){h.preventDefault(),h.stopPropagation(),e();return}if(h.key==="ArrowDown"){h.preventDefault(),s(d=>Math.min(d+1,a.length-1));return}if(h.key==="ArrowUp"){h.preventDefault(),s(d=>Math.max(d-1,0));return}if(h.key==="Enter"){h.preventDefault(),a[i]&&c(a[i]);return}};return N.useEffect(()=>{const h=o.current;if(!h)return;const d=h.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),_.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",onClick:e,children:_.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:h=>h.stopPropagation(),children:[_.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[var(--border)]",children:[_.jsx(Qx,{size:16,className:"text-[var(--text-muted)] shrink-0"}),_.jsx("input",{ref:n,type:"text",value:t,onChange:h=>r(h.target.value),onKeyDown:u,placeholder:"Search commands...",className:"flex-1 bg-transparent text-sm text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"}),_.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"})]}),_.jsx("div",{ref:o,className:"max-h-72 overflow-y-auto py-1",children:a.length===0?_.jsx("div",{className:"px-4 py-6 text-center text-xs text-[var(--text-muted)]",children:"No matching commands"}):a.map((h,d)=>_.jsxs("button",{onClick:()=>c(h),onMouseEnter:()=>s(d),className:`
|
|
432
|
+
w-full flex items-center gap-3 px-4 py-2 text-left transition-colors
|
|
433
|
+
${d===i?"bg-[var(--surface-2)] text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--surface-2)]"}
|
|
434
|
+
`,children:[_.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:h.icon}),_.jsx("span",{className:"flex-1 text-xs truncate",children:h.label}),_.jsx("span",{className:"shrink-0 text-[9px] px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[var(--text-muted)]",children:h.category}),h.shortcut&&_.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:h.shortcut})]},h.id))})]})})}function LC(e){const t=[],r=se.getState().projects,i=Ar.getState().favourites,s=se.getState().activeProjectId;for(const o of Object.values(r))t.push({id:`project:${o.id}`,label:`Switch to ${o.name}`,category:"Project",icon:_.jsx(dv,{size:14}),action:()=>{se.getState().setActiveProject(o.id)}});for(const o of Object.values(i))t.push({id:`fav:${o.id}`,label:`Launch ${o.name}`,category:"Favourite",icon:_.jsx(kl,{size:14}),action:()=>{W.getState().requestFavouriteLaunch(o.id)}});const n={"even-horizontal":{label:"Layout: Rows",icon:_.jsx(bl,{size:14})},"even-vertical":{label:"Layout: Columns",icon:_.jsx(Cl,{size:14})},"main-left":{label:"Layout: Main + Stack",icon:_.jsx(mu,{size:14})},"main-top":{label:"Layout: Main + Row",icon:_.jsx(vu,{size:14})},grid:{label:"Layout: Grid",icon:_.jsx(pu,{size:14})}};for(const o of Xi){const l=n[o];t.push({id:`layout:${o}`,label:l.label,category:"Layout",icon:l.icon,action:()=>{if(!s)return;const a=K.getState().getLayout(s),c=ce(a);if(c.length===0)return;const u=gi(c,o);u&&K.getState().setLayout(s,u)}})}return t.push({id:"action:new-pane-v",label:"New pane (vertical)",category:"Action",icon:_.jsx(pn,{size:14}),shortcut:"⌘N",action:()=>{if(!s)return;const o=K.getState().getLayout(s),l=ce(o),a=W.getState().focusedTerminalId,c=crypto.randomUUID(),u=a??l[l.length-1];u?K.getState().addPaneToProject(s,u,c,"vertical"):K.getState().setLayout(s,{type:"leaf",terminalId:c}),se.getState().addTerminalToProject(s,c),W.getState().setFocusedTerminal(c)}}),t.push({id:"action:new-pane-h",label:"New pane (horizontal)",category:"Action",icon:_.jsx(pn,{size:14}),shortcut:"⌘⇧N",action:()=>{if(!s)return;const o=K.getState().getLayout(s),l=ce(o),a=W.getState().focusedTerminalId,c=crypto.randomUUID(),u=a??l[l.length-1];u?K.getState().addPaneToProject(s,u,c,"horizontal"):K.getState().setLayout(s,{type:"leaf",terminalId:c}),se.getState().addTerminalToProject(s,c),W.getState().setFocusedTerminal(c)}}),t.push({id:"action:close-pane",label:"Close pane",category:"Action",icon:_.jsx(bi,{size:14}),shortcut:"⌘W",action:()=>{var c;if(!s)return;const o=W.getState().focusedTerminalId;if(!o)return;je({type:"pty:kill",terminalId:o}),K.getState().removePaneFromProject(s,o),se.getState().removeTerminalFromProject(s,o);const l=ne.getState().sessions[o];(c=l==null?void 0:l.terminal)==null||c.dispose(),ne.getState().removeSession(o),En(o);const a=ce(K.getState().getLayout(s));W.getState().setFocusedTerminal(a[0]??null)}}),t.push({id:"action:toggle-sidebar",label:"Toggle sidebar",category:"Action",icon:_.jsx(_v,{size:14}),shortcut:"⌘D",action:()=>{W.getState().toggleSidebar()}}),t.push({id:"action:cycle-theme",label:"Cycle theme",category:"Action",icon:_.jsx(tl,{size:14}),action:()=>{W.getState().cycleTheme()}}),t.push({id:"action:toggle-editor-sync",label:"Toggle editor sync",category:"Action",icon:_.jsx(tl,{size:14}),action:()=>{W.getState().toggleEditorSync()}}),t.push({id:"action:auto-reorganize",label:"Auto reorganize",category:"Action",icon:_.jsx(fv,{size:14}),shortcut:"⌘R",action:()=>{if(!s)return;const o=K.getState().getLayout(s),l=ce(o);if(l.length===0)return;let a;l.length<=2?a="even-vertical":l.length===3?a="main-left":a="grid";const c=gi(l,a);c&&K.getState().setLayout(s,c)}}),t}function DC(){Mx(),Bx(),N.useEffect(()=>{se.getState().hydrateFromServer(),Ar.getState().hydrateFromServer(),W.getState().hydrateFromServer()},[]);const e=se(a=>a.activeProjectId),t=se(a=>a.activeProjectId?a.projects[a.activeProjectId]:null),r=K(a=>e?a.getLayout(e):null),i=W(a=>a.focusedTerminalId),s=W(a=>a.setFocusedTerminal),n=se(a=>a.addTerminalToProject),o=N.useCallback(a=>{if(!e||!t)return;const c=crypto.randomUUID(),u=ce(r),h=i??u[0];h?K.getState().addPaneToProject(e,h,c,a):K.getState().setLayout(e,{type:"leaf",terminalId:c}),n(e,c),s(c)},[e,t,r,i,n,s]),l=N.useCallback(()=>{o("vertical")},[o]);return _.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-[var(--surface-0)]",children:[_.jsx(lC,{}),_.jsx(EC,{}),_.jsxs("div",{className:"relative flex-1 flex flex-col min-w-0",children:[_.jsx(kC,{}),_.jsx(_C,{onNewPane:o}),_.jsx("div",{className:"flex-1 min-h-0 min-w-0",children:r?_.jsx(lh,{node:r,projectId:e,cwd:(t==null?void 0:t.cwd)??"/"},e):_.jsx(bC,{onNewTerminal:l,projectName:t==null?void 0:t.name})})]})]})}ga.createRoot(document.getElementById("root")).render(_.jsx(t_.StrictMode,{children:_.jsx(DC,{})}));
|