deckide 3.5.42 → 3.5.43

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,178 @@
1
+ (function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))_(p);new MutationObserver(p=>{for(const L of p)if(L.type==="childList")for(const R of L.addedNodes)R.tagName==="LINK"&&R.rel==="modulepreload"&&_(R)}).observe(document,{childList:!0,subtree:!0});function n(p){const L={};return p.integrity&&(L.integrity=p.integrity),p.referrerPolicy&&(L.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?L.credentials="include":p.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function _(p){if(p.ep)return;p.ep=!0;const L=n(p);fetch(p.href,L)}})();function Nf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ec={exports:{}},wn={},tc={exports:{}},Ie={};/**
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 Sd;function Bv(){if(Sd)return Ie;Sd=1;var r=Symbol.for("react.element"),i=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),L=Symbol.for("react.provider"),R=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),f=Symbol.iterator;function S(P){return P===null||typeof P!="object"?null:(P=f&&P[f]||P["@@iterator"],typeof P=="function"?P:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,w={};function c(P,H,J){this.props=P,this.context=H,this.refs=w,this.updater=J||x}c.prototype.isReactComponent={},c.prototype.setState=function(P,H){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,H,"setState")},c.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function h(){}h.prototype=c.prototype;function l(P,H,J){this.props=P,this.context=H,this.refs=w,this.updater=J||x}var u=l.prototype=new h;u.constructor=l,T(u,c.prototype),u.isPureReactComponent=!0;var g=Array.isArray,C=Object.prototype.hasOwnProperty,k={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function E(P,H,J){var se,le={},de=null,X=null;if(H!=null)for(se in H.ref!==void 0&&(X=H.ref),H.key!==void 0&&(de=""+H.key),H)C.call(H,se)&&!D.hasOwnProperty(se)&&(le[se]=H[se]);var j=arguments.length-2;if(j===1)le.children=J;else if(1<j){for(var ne=Array(j),ee=0;ee<j;ee++)ne[ee]=arguments[ee+2];le.children=ne}if(P&&P.defaultProps)for(se in j=P.defaultProps,j)le[se]===void 0&&(le[se]=j[se]);return{$$typeof:r,type:P,key:de,ref:X,props:le,_owner:k.current}}function N(P,H){return{$$typeof:r,type:P.type,key:H,ref:P.ref,props:P.props,_owner:P._owner}}function V(P){return typeof P=="object"&&P!==null&&P.$$typeof===r}function q(P){var H={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(J){return H[J]})}var O=/\/+/g;function A(P,H){return typeof P=="object"&&P!==null&&P.key!=null?q(""+P.key):H.toString(36)}function U(P,H,J,se,le){var de=typeof P;(de==="undefined"||de==="boolean")&&(P=null);var X=!1;if(P===null)X=!0;else switch(de){case"string":case"number":X=!0;break;case"object":switch(P.$$typeof){case r:case i:X=!0}}if(X)return X=P,le=le(X),P=se===""?"."+A(X,0):se,g(le)?(J="",P!=null&&(J=P.replace(O,"$&/")+"/"),U(le,H,J,"",function(ee){return ee})):le!=null&&(V(le)&&(le=N(le,J+(!le.key||X&&X.key===le.key?"":(""+le.key).replace(O,"$&/")+"/")+P)),H.push(le)),1;if(X=0,se=se===""?".":se+":",g(P))for(var j=0;j<P.length;j++){de=P[j];var ne=se+A(de,j);X+=U(de,H,J,ne,le)}else if(ne=S(P),typeof ne=="function")for(P=ne.call(P),j=0;!(de=P.next()).done;)de=de.value,ne=se+A(de,j++),X+=U(de,H,J,ne,le);else if(de==="object")throw H=String(P),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.");return X}function z(P,H,J){if(P==null)return P;var se=[],le=0;return U(P,se,"","",function(de){return H.call(J,de,le++)}),se}function K(P){if(P._status===-1){var H=P._result;H=H(),H.then(function(J){(P._status===0||P._status===-1)&&(P._status=1,P._result=J)},function(J){(P._status===0||P._status===-1)&&(P._status=2,P._result=J)}),P._status===-1&&(P._status=0,P._result=H)}if(P._status===1)return P._result.default;throw P._result}var Y={current:null},W={transition:null},B={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:W,ReactCurrentOwner:k};function I(){throw Error("act(...) is not supported in production builds of React.")}return Ie.Children={map:z,forEach:function(P,H,J){z(P,function(){H.apply(this,arguments)},J)},count:function(P){var H=0;return z(P,function(){H++}),H},toArray:function(P){return z(P,function(H){return H})||[]},only:function(P){if(!V(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},Ie.Component=c,Ie.Fragment=n,Ie.Profiler=p,Ie.PureComponent=l,Ie.StrictMode=_,Ie.Suspense=d,Ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=B,Ie.act=I,Ie.cloneElement=function(P,H,J){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var se=T({},P.props),le=P.key,de=P.ref,X=P._owner;if(H!=null){if(H.ref!==void 0&&(de=H.ref,X=k.current),H.key!==void 0&&(le=""+H.key),P.type&&P.type.defaultProps)var j=P.type.defaultProps;for(ne in H)C.call(H,ne)&&!D.hasOwnProperty(ne)&&(se[ne]=H[ne]===void 0&&j!==void 0?j[ne]:H[ne])}var ne=arguments.length-2;if(ne===1)se.children=J;else if(1<ne){j=Array(ne);for(var ee=0;ee<ne;ee++)j[ee]=arguments[ee+2];se.children=j}return{$$typeof:r,type:P.type,key:le,ref:de,props:se,_owner:X}},Ie.createContext=function(P){return P={$$typeof:R,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},P.Provider={$$typeof:L,_context:P},P.Consumer=P},Ie.createElement=E,Ie.createFactory=function(P){var H=E.bind(null,P);return H.type=P,H},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(P){return{$$typeof:o,render:P}},Ie.isValidElement=V,Ie.lazy=function(P){return{$$typeof:y,_payload:{_status:-1,_result:P},_init:K}},Ie.memo=function(P,H){return{$$typeof:v,type:P,compare:H===void 0?null:H}},Ie.startTransition=function(P){var H=W.transition;W.transition={};try{P()}finally{W.transition=H}},Ie.unstable_act=I,Ie.useCallback=function(P,H){return Y.current.useCallback(P,H)},Ie.useContext=function(P){return Y.current.useContext(P)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(P){return Y.current.useDeferredValue(P)},Ie.useEffect=function(P,H){return Y.current.useEffect(P,H)},Ie.useId=function(){return Y.current.useId()},Ie.useImperativeHandle=function(P,H,J){return Y.current.useImperativeHandle(P,H,J)},Ie.useInsertionEffect=function(P,H){return Y.current.useInsertionEffect(P,H)},Ie.useLayoutEffect=function(P,H){return Y.current.useLayoutEffect(P,H)},Ie.useMemo=function(P,H){return Y.current.useMemo(P,H)},Ie.useReducer=function(P,H,J){return Y.current.useReducer(P,H,J)},Ie.useRef=function(P){return Y.current.useRef(P)},Ie.useState=function(P){return Y.current.useState(P)},Ie.useSyncExternalStore=function(P,H,J){return Y.current.useSyncExternalStore(P,H,J)},Ie.useTransition=function(){return Y.current.useTransition()},Ie.version="18.3.1",Ie}var Cd;function qc(){return Cd||(Cd=1,tc.exports=Bv()),tc.exports}/**
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 xd;function Pv(){if(xd)return wn;xd=1;var r=qc(),i=Symbol.for("react.element"),n=Symbol.for("react.fragment"),_=Object.prototype.hasOwnProperty,p=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,L={key:!0,ref:!0,__self:!0,__source:!0};function R(o,d,v){var y,f={},S=null,x=null;v!==void 0&&(S=""+v),d.key!==void 0&&(S=""+d.key),d.ref!==void 0&&(x=d.ref);for(y in d)_.call(d,y)&&!L.hasOwnProperty(y)&&(f[y]=d[y]);if(o&&o.defaultProps)for(y in d=o.defaultProps,d)f[y]===void 0&&(f[y]=d[y]);return{$$typeof:i,type:o,key:S,ref:x,props:f,_owner:p.current}}return wn.Fragment=n,wn.jsx=R,wn.jsxs=R,wn}var bd;function Ov(){return bd||(bd=1,ec.exports=Pv()),ec.exports}var M=Ov(),$=qc();const ts=Nf($);var Vo={},rc={exports:{}},pr={},ic={exports:{}},sc={};/**
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
+ */var Ed;function Nv(){return Ed||(Ed=1,(function(r){function i(W,B){var I=W.length;W.push(B);e:for(;0<I;){var P=I-1>>>1,H=W[P];if(0<p(H,B))W[P]=B,W[I]=H,I=P;else break e}}function n(W){return W.length===0?null:W[0]}function _(W){if(W.length===0)return null;var B=W[0],I=W.pop();if(I!==B){W[0]=I;e:for(var P=0,H=W.length,J=H>>>1;P<J;){var se=2*(P+1)-1,le=W[se],de=se+1,X=W[de];if(0>p(le,I))de<H&&0>p(X,le)?(W[P]=X,W[de]=I,P=de):(W[P]=le,W[se]=I,P=se);else if(de<H&&0>p(X,I))W[P]=X,W[de]=I,P=de;else break e}}return B}function p(W,B){var I=W.sortIndex-B.sortIndex;return I!==0?I:W.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var L=performance;r.unstable_now=function(){return L.now()}}else{var R=Date,o=R.now();r.unstable_now=function(){return R.now()-o}}var d=[],v=[],y=1,f=null,S=3,x=!1,T=!1,w=!1,c=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,l=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function u(W){for(var B=n(v);B!==null;){if(B.callback===null)_(v);else if(B.startTime<=W)_(v),B.sortIndex=B.expirationTime,i(d,B);else break;B=n(v)}}function g(W){if(w=!1,u(W),!T)if(n(d)!==null)T=!0,K(C);else{var B=n(v);B!==null&&Y(g,B.startTime-W)}}function C(W,B){T=!1,w&&(w=!1,h(E),E=-1),x=!0;var I=S;try{for(u(B),f=n(d);f!==null&&(!(f.expirationTime>B)||W&&!q());){var P=f.callback;if(typeof P=="function"){f.callback=null,S=f.priorityLevel;var H=P(f.expirationTime<=B);B=r.unstable_now(),typeof H=="function"?f.callback=H:f===n(d)&&_(d),u(B)}else _(d);f=n(d)}if(f!==null)var J=!0;else{var se=n(v);se!==null&&Y(g,se.startTime-B),J=!1}return J}finally{f=null,S=I,x=!1}}var k=!1,D=null,E=-1,N=5,V=-1;function q(){return!(r.unstable_now()-V<N)}function O(){if(D!==null){var W=r.unstable_now();V=W;var B=!0;try{B=D(!0,W)}finally{B?A():(k=!1,D=null)}}else k=!1}var A;if(typeof l=="function")A=function(){l(O)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,z=U.port2;U.port1.onmessage=O,A=function(){z.postMessage(null)}}else A=function(){c(O,0)};function K(W){D=W,k||(k=!0,A())}function Y(W,B){E=c(function(){W(r.unstable_now())},B)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(W){W.callback=null},r.unstable_continueExecution=function(){T||x||(T=!0,K(C))},r.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<W?Math.floor(1e3/W):5},r.unstable_getCurrentPriorityLevel=function(){return S},r.unstable_getFirstCallbackNode=function(){return n(d)},r.unstable_next=function(W){switch(S){case 1:case 2:case 3:var B=3;break;default:B=S}var I=S;S=B;try{return W()}finally{S=I}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(W,B){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var I=S;S=W;try{return B()}finally{S=I}},r.unstable_scheduleCallback=function(W,B,I){var P=r.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?P+I:P):I=P,W){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=I+H,W={id:y++,callback:B,priorityLevel:W,startTime:I,expirationTime:H,sortIndex:-1},I>P?(W.sortIndex=I,i(v,W),n(d)===null&&W===n(v)&&(w?(h(E),E=-1):w=!0,Y(g,I-P))):(W.sortIndex=H,i(d,W),T||x||(T=!0,K(C))),W},r.unstable_shouldYield=q,r.unstable_wrapCallback=function(W){var B=S;return function(){var I=S;S=B;try{return W.apply(this,arguments)}finally{S=I}}}})(sc)),sc}var kd;function Iv(){return kd||(kd=1,ic.exports=Nv()),ic.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 Ld;function jv(){if(Ld)return pr;Ld=1;var r=qc(),i=Iv();function n(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s]);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 _=new Set,p={};function L(e,t){R(e,t),R(e+"Capture",t)}function R(e,t){for(p[e]=t,e=0;e<t.length;e++)_.add(t[e])}var o=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,v=/^[: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]*$/,y={},f={};function S(e){return d.call(f,e)?!0:d.call(y,e)?!1:v.test(e)?f[e]=!0:(y[e]=!0,!1)}function x(e,t,s,a){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return a?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function T(e,t,s,a){if(t===null||typeof t>"u"||x(e,t,s,a))return!0;if(a)return!1;if(s!==null)switch(s.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 w(e,t,s,a,m,b,F){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=a,this.attributeNamespace=m,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=b,this.removeEmptyString=F}var c={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){c[e]=new w(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];c[t]=new w(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){c[e]=new w(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){c[e]=new w(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){c[e]=new w(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){c[e]=new w(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){c[e]=new w(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){c[e]=new w(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){c[e]=new w(e,5,!1,e.toLowerCase(),null,!1,!1)});var h=/[\-:]([a-z])/g;function l(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(h,l);c[t]=new w(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(h,l);c[t]=new w(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(h,l);c[t]=new w(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){c[e]=new w(e,1,!1,e.toLowerCase(),null,!1,!1)}),c.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){c[e]=new w(e,1,!1,e.toLowerCase(),null,!0,!0)});function u(e,t,s,a){var m=c.hasOwnProperty(t)?c[t]:null;(m!==null?m.type!==0:a||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(T(t,s,m,a)&&(s=null),a||m===null?S(t)&&(s===null?e.removeAttribute(t):e.setAttribute(t,""+s)):m.mustUseProperty?e[m.propertyName]=s===null?m.type===3?!1:"":s:(t=m.attributeName,a=m.attributeNamespace,s===null?e.removeAttribute(t):(m=m.type,s=m===3||m===4&&s===!0?"":""+s,a?e.setAttributeNS(a,t,s):e.setAttribute(t,s))))}var g=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,C=Symbol.for("react.element"),k=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),V=Symbol.for("react.provider"),q=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),W=Symbol.iterator;function B(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var I=Object.assign,P;function H(e){if(P===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);P=t&&t[1]||""}return`
34
+ `+P+e}var J=!1;function se(e,t){if(!e||J)return"";J=!0;var s=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(ae){var a=ae}Reflect.construct(e,[],t)}else{try{t.call()}catch(ae){a=ae}e.call(t.prototype)}else{try{throw Error()}catch(ae){a=ae}e()}}catch(ae){if(ae&&a&&typeof ae.stack=="string"){for(var m=ae.stack.split(`
35
+ `),b=a.stack.split(`
36
+ `),F=m.length-1,G=b.length-1;1<=F&&0<=G&&m[F]!==b[G];)G--;for(;1<=F&&0<=G;F--,G--)if(m[F]!==b[G]){if(F!==1||G!==1)do if(F--,G--,0>G||m[F]!==b[G]){var Q=`
37
+ `+m[F].replace(" at new "," at ");return e.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",e.displayName)),Q}while(1<=F&&0<=G);break}}}finally{J=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?H(e):""}function le(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=se(e.type,!1),e;case 11:return e=se(e.type.render,!1),e;case 1:return e=se(e.type,!0),e;default:return""}}function de(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 D:return"Fragment";case k:return"Portal";case N:return"Profiler";case E:return"StrictMode";case A:return"Suspense";case U:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case q:return(e.displayName||"Context")+".Consumer";case V:return(e._context.displayName||"Context")+".Provider";case O:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return t=e.displayName||null,t!==null?t:de(e.type)||"Memo";case K:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}function X(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 de(t);case 8:return t===E?"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 j(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ne(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ee(e){var t=ne(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),a=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var m=s.get,b=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return m.call(this)},set:function(F){a=""+F,b.call(this,F)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(F){a=""+F},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ce(e){e._valueTracker||(e._valueTracker=ee(e))}function ve(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),a="";return e&&(a=ne(e)?e.checked?"true":"false":e.value),e=a,e!==s?(t.setValue(e),!0):!1}function ie(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 pe(e,t){var s=t.checked;return I({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Re(e,t){var s=t.defaultValue==null?"":t.defaultValue,a=t.checked!=null?t.checked:t.defaultChecked;s=j(t.value!=null?t.value:s),e._wrapperState={initialChecked:a,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Te(e,t){t=t.checked,t!=null&&u(e,"checked",t,!1)}function ye(e,t){Te(e,t);var s=j(t.value),a=t.type;if(s!=null)a==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?kt(e,t.type,s):t.hasOwnProperty("defaultValue")&&kt(e,t.type,j(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Je(e,t,s){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var a=t.type;if(!(a!=="submit"&&a!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function kt(e,t,s){(t!=="number"||ie(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ct=Array.isArray;function Qe(e,t,s,a){if(e=e.options,t){t={};for(var m=0;m<s.length;m++)t["$"+s[m]]=!0;for(s=0;s<e.length;s++)m=t.hasOwnProperty("$"+e[s].value),e[s].selected!==m&&(e[s].selected=m),m&&a&&(e[s].defaultSelected=!0)}else{for(s=""+j(s),t=null,m=0;m<e.length;m++){if(e[m].value===s){e[m].selected=!0,a&&(e[m].defaultSelected=!0);return}t!==null||e[m].disabled||(t=e[m])}t!==null&&(t.selected=!0)}}function Ze(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(n(91));return I({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function et(e,t){var s=t.value;if(s==null){if(s=t.children,t=t.defaultValue,s!=null){if(t!=null)throw Error(n(92));if(Ct(s)){if(1<s.length)throw Error(n(93));s=s[0]}t=s}t==null&&(t=""),s=t}e._wrapperState={initialValue:j(s)}}function Vt(e,t){var s=j(t.value),a=j(t.defaultValue);s!=null&&(s=""+s,s!==e.value&&(e.value=s),t.defaultValue==null&&e.defaultValue!==s&&(e.defaultValue=s)),a!=null&&(e.defaultValue=""+a)}function xt(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function at(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 bt(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?at(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ht,sr=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,s,a,m){MSApp.execUnsafeLocalFunction(function(){return e(t,s,a,m)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ht=ht||document.createElement("div"),ht.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ht.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function _t(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Tt={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},ze=["Webkit","ms","Moz","O"];Object.keys(Tt).forEach(function(e){ze.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Tt[t]=Tt[e]})});function Pr(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||Tt.hasOwnProperty(e)&&Tt[e]?(""+t).trim():t+"px"}function xe(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var a=s.indexOf("--")===0,m=Pr(s,t[s],a);s==="float"&&(s="cssFloat"),a?e.setProperty(s,m):e[s]=m}}var Me=I({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 Ve(e,t){if(t){if(Me[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(n(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(n(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(n(61))}if(t.style!=null&&typeof t.style!="object")throw Error(n(62))}}function Ge(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 Mt=null;function He(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vt=null,Ye=null,oe=null;function ue(e){if(e=nn(e)){if(typeof vt!="function")throw Error(n(280));var t=e.stateNode;t&&(t=no(t),vt(e.stateNode,e.type,t))}}function be(e){Ye?oe?oe.push(e):oe=[e]:Ye=e}function Oe(){if(Ye){var e=Ye,t=oe;if(oe=Ye=null,ue(e),t)for(e=0;e<t.length;e++)ue(t[e])}}function Ke(e,t){return e(t)}function Fe(){}var Jt=!1;function ut(e,t,s){if(Jt)return e(t,s);Jt=!0;try{return Ke(e,t,s)}finally{Jt=!1,(Ye!==null||oe!==null)&&(Fe(),Oe())}}function gt(e,t){var s=e.stateNode;if(s===null)return null;var a=no(s);if(a===null)return null;s=a[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":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(n(231,t,typeof s));return s}var Xe=!1;if(o)try{var Pe={};Object.defineProperty(Pe,"passive",{get:function(){Xe=!0}}),window.addEventListener("test",Pe,Pe),window.removeEventListener("test",Pe,Pe)}catch{Xe=!1}function dt(e,t,s,a,m,b,F,G,Q){var ae=Array.prototype.slice.call(arguments,3);try{t.apply(s,ae)}catch(_e){this.onError(_e)}}var rt=!1,Wr=null,Qt=!1,Or=null,pi={onError:function(e){rt=!0,Wr=e}};function fa(e,t,s,a,m,b,F,G,Q){rt=!1,Wr=null,dt.apply(pi,arguments)}function pa(e,t,s,a,m,b,F,G,Q){if(fa.apply(this,arguments),rt){if(rt){var ae=Wr;rt=!1,Wr=null}else throw Error(n(198));Qt||(Qt=!0,Or=ae)}}function Zr(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function Nn(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 In(e){if(Zr(e)!==e)throw Error(n(188))}function _a(e){var t=e.alternate;if(!t){if(t=Zr(e),t===null)throw Error(n(188));return t!==e?null:e}for(var s=e,a=t;;){var m=s.return;if(m===null)break;var b=m.alternate;if(b===null){if(a=m.return,a!==null){s=a;continue}break}if(m.child===b.child){for(b=m.child;b;){if(b===s)return In(m),e;if(b===a)return In(m),t;b=b.sibling}throw Error(n(188))}if(s.return!==a.return)s=m,a=b;else{for(var F=!1,G=m.child;G;){if(G===s){F=!0,s=m,a=b;break}if(G===a){F=!0,a=m,s=b;break}G=G.sibling}if(!F){for(G=b.child;G;){if(G===s){F=!0,s=b,a=m;break}if(G===a){F=!0,a=b,s=m;break}G=G.sibling}if(!F)throw Error(n(189))}}if(s.alternate!==a)throw Error(n(190))}if(s.tag!==3)throw Error(n(188));return s.stateNode.current===s?e:t}function jn(e){return e=_a(e),e!==null?Fn(e):null}function Fn(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Fn(e);if(t!==null)return t;e=e.sibling}return null}var Hn=i.unstable_scheduleCallback,$n=i.unstable_cancelCallback,va=i.unstable_shouldYield,ga=i.unstable_requestPaint,lt=i.unstable_now,ma=i.unstable_getCurrentPriorityLevel,Hs=i.unstable_ImmediatePriority,zn=i.unstable_UserBlockingPriority,Fi=i.unstable_NormalPriority,ya=i.unstable_LowPriority,Un=i.unstable_IdlePriority,ss=null,Cr=null;function wa(e){if(Cr&&typeof Cr.onCommitFiberRoot=="function")try{Cr.onCommitFiberRoot(ss,e,void 0,(e.current.flags&128)===128)}catch{}}var vr=Math.clz32?Math.clz32:xa,Sa=Math.log,Ca=Math.LN2;function xa(e){return e>>>=0,e===0?32:31-(Sa(e)/Ca|0)|0}var ns=64,os=4194304;function Hi(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 as(e,t){var s=e.pendingLanes;if(s===0)return 0;var a=0,m=e.suspendedLanes,b=e.pingedLanes,F=s&268435455;if(F!==0){var G=F&~m;G!==0?a=Hi(G):(b&=F,b!==0&&(a=Hi(b)))}else F=s&~m,F!==0?a=Hi(F):b!==0&&(a=Hi(b));if(a===0)return 0;if(t!==0&&t!==a&&(t&m)===0&&(m=a&-a,b=t&-t,m>=b||m===16&&(b&4194240)!==0))return t;if((a&4)!==0&&(a|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=a;0<t;)s=31-vr(t),m=1<<s,a|=e[s],t&=~m;return a}function he(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 we(e,t){for(var s=e.suspendedLanes,a=e.pingedLanes,m=e.expirationTimes,b=e.pendingLanes;0<b;){var F=31-vr(b),G=1<<F,Q=m[F];Q===-1?((G&s)===0||(G&a)!==0)&&(m[F]=he(G,t)):Q<=t&&(e.expiredLanes|=G),b&=~G}}function je(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function We(){var e=ns;return ns<<=1,(ns&4194240)===0&&(ns=64),e}function xr(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function br(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vr(t),e[t]=s}function $s(e,t){var s=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 a=e.eventTimes;for(e=e.expirationTimes;0<s;){var m=31-vr(s),b=1<<m;t[m]=0,a[m]=-1,e[m]=-1,s&=~b}}function Vr(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var a=31-vr(s),m=1<<a;m&t|e[a]&t&&(e[a]|=t),s&=~m}}var qe=0;function Zc(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var eh,ba,th,rh,ih,Ea=!1,Wn=[],_i=null,vi=null,gi=null,zs=new Map,Us=new Map,mi=[],t_="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 sh(e,t){switch(e){case"focusin":case"focusout":_i=null;break;case"dragenter":case"dragleave":vi=null;break;case"mouseover":case"mouseout":gi=null;break;case"pointerover":case"pointerout":zs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Us.delete(t.pointerId)}}function Ws(e,t,s,a,m,b){return e===null||e.nativeEvent!==b?(e={blockedOn:t,domEventName:s,eventSystemFlags:a,nativeEvent:b,targetContainers:[m]},t!==null&&(t=nn(t),t!==null&&ba(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,m!==null&&t.indexOf(m)===-1&&t.push(m),e)}function r_(e,t,s,a,m){switch(t){case"focusin":return _i=Ws(_i,e,t,s,a,m),!0;case"dragenter":return vi=Ws(vi,e,t,s,a,m),!0;case"mouseover":return gi=Ws(gi,e,t,s,a,m),!0;case"pointerover":var b=m.pointerId;return zs.set(b,Ws(zs.get(b)||null,e,t,s,a,m)),!0;case"gotpointercapture":return b=m.pointerId,Us.set(b,Ws(Us.get(b)||null,e,t,s,a,m)),!0}return!1}function nh(e){var t=$i(e.target);if(t!==null){var s=Zr(t);if(s!==null){if(t=s.tag,t===13){if(t=Nn(s),t!==null){e.blockedOn=t,ih(e.priority,function(){th(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Vn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=La(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(s===null){s=e.nativeEvent;var a=new s.constructor(s.type,s);Mt=a,s.target.dispatchEvent(a),Mt=null}else return t=nn(s),t!==null&&ba(t),e.blockedOn=s,!1;t.shift()}return!0}function oh(e,t,s){Vn(e)&&s.delete(t)}function i_(){Ea=!1,_i!==null&&Vn(_i)&&(_i=null),vi!==null&&Vn(vi)&&(vi=null),gi!==null&&Vn(gi)&&(gi=null),zs.forEach(oh),Us.forEach(oh)}function Vs(e,t){e.blockedOn===t&&(e.blockedOn=null,Ea||(Ea=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,i_)))}function Ks(e){function t(m){return Vs(m,e)}if(0<Wn.length){Vs(Wn[0],e);for(var s=1;s<Wn.length;s++){var a=Wn[s];a.blockedOn===e&&(a.blockedOn=null)}}for(_i!==null&&Vs(_i,e),vi!==null&&Vs(vi,e),gi!==null&&Vs(gi,e),zs.forEach(t),Us.forEach(t),s=0;s<mi.length;s++)a=mi[s],a.blockedOn===e&&(a.blockedOn=null);for(;0<mi.length&&(s=mi[0],s.blockedOn===null);)nh(s),s.blockedOn===null&&mi.shift()}var ls=g.ReactCurrentBatchConfig,Kn=!0;function s_(e,t,s,a){var m=qe,b=ls.transition;ls.transition=null;try{qe=1,ka(e,t,s,a)}finally{qe=m,ls.transition=b}}function n_(e,t,s,a){var m=qe,b=ls.transition;ls.transition=null;try{qe=4,ka(e,t,s,a)}finally{qe=m,ls.transition=b}}function ka(e,t,s,a){if(Kn){var m=La(e,t,s,a);if(m===null)Wa(e,t,a,qn,s),sh(e,a);else if(r_(m,e,t,s,a))a.stopPropagation();else if(sh(e,a),t&4&&-1<t_.indexOf(e)){for(;m!==null;){var b=nn(m);if(b!==null&&eh(b),b=La(e,t,s,a),b===null&&Wa(e,t,a,qn,s),b===m)break;m=b}m!==null&&a.stopPropagation()}else Wa(e,t,a,null,s)}}var qn=null;function La(e,t,s,a){if(qn=null,e=He(a),e=$i(e),e!==null)if(t=Zr(e),t===null)e=null;else if(s=t.tag,s===13){if(e=Nn(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return qn=e,null}function ah(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(ma()){case Hs:return 1;case zn:return 4;case Fi:case ya:return 16;case Un:return 536870912;default:return 16}default:return 16}}var yi=null,Ra=null,Gn=null;function lh(){if(Gn)return Gn;var e,t=Ra,s=t.length,a,m="value"in yi?yi.value:yi.textContent,b=m.length;for(e=0;e<s&&t[e]===m[e];e++);var F=s-e;for(a=1;a<=F&&t[s-a]===m[b-a];a++);return Gn=m.slice(e,1<a?1-a:void 0)}function Yn(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 Xn(){return!0}function ch(){return!1}function gr(e){function t(s,a,m,b,F){this._reactName=s,this._targetInst=m,this.type=a,this.nativeEvent=b,this.target=F,this.currentTarget=null;for(var G in e)e.hasOwnProperty(G)&&(s=e[G],this[G]=s?s(b):b[G]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?Xn:ch,this.isPropagationStopped=ch,this}return I(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Xn)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Xn)},persist:function(){},isPersistent:Xn}),t}var cs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ta=gr(cs),qs=I({},cs,{view:0,detail:0}),o_=gr(qs),Ma,Da,Gs,Jn=I({},qs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ba,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!==Gs&&(Gs&&e.type==="mousemove"?(Ma=e.screenX-Gs.screenX,Da=e.screenY-Gs.screenY):Da=Ma=0,Gs=e),Ma)},movementY:function(e){return"movementY"in e?e.movementY:Da}}),hh=gr(Jn),a_=I({},Jn,{dataTransfer:0}),l_=gr(a_),c_=I({},qs,{relatedTarget:0}),Aa=gr(c_),h_=I({},cs,{animationName:0,elapsedTime:0,pseudoElement:0}),u_=gr(h_),d_=I({},cs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),f_=gr(d_),p_=I({},cs,{data:0}),uh=gr(p_),__={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},v_={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"},g_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function m_(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=g_[e])?!!t[e]:!1}function Ba(){return m_}var y_=I({},qs,{key:function(e){if(e.key){var t=__[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Yn(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?v_[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ba,charCode:function(e){return e.type==="keypress"?Yn(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Yn(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),w_=gr(y_),S_=I({},Jn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dh=gr(S_),C_=I({},qs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ba}),x_=gr(C_),b_=I({},cs,{propertyName:0,elapsedTime:0,pseudoElement:0}),E_=gr(b_),k_=I({},Jn,{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}),L_=gr(k_),R_=[9,13,27,32],Pa=o&&"CompositionEvent"in window,Ys=null;o&&"documentMode"in document&&(Ys=document.documentMode);var T_=o&&"TextEvent"in window&&!Ys,fh=o&&(!Pa||Ys&&8<Ys&&11>=Ys),ph=" ",_h=!1;function vh(e,t){switch(e){case"keyup":return R_.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var hs=!1;function M_(e,t){switch(e){case"compositionend":return gh(t);case"keypress":return t.which!==32?null:(_h=!0,ph);case"textInput":return e=t.data,e===ph&&_h?null:e;default:return null}}function D_(e,t){if(hs)return e==="compositionend"||!Pa&&vh(e,t)?(e=lh(),Gn=Ra=yi=null,hs=!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 fh&&t.locale!=="ko"?null:t.data;default:return null}}var A_={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 mh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!A_[e.type]:t==="textarea"}function yh(e,t,s,a){be(a),t=ro(t,"onChange"),0<t.length&&(s=new Ta("onChange","change",null,s,a),e.push({event:s,listeners:t}))}var Xs=null,Js=null;function B_(e){Ih(e,0)}function Qn(e){var t=_s(e);if(ve(t))return e}function P_(e,t){if(e==="change")return t}var wh=!1;if(o){var Oa;if(o){var Na="oninput"in document;if(!Na){var Sh=document.createElement("div");Sh.setAttribute("oninput","return;"),Na=typeof Sh.oninput=="function"}Oa=Na}else Oa=!1;wh=Oa&&(!document.documentMode||9<document.documentMode)}function Ch(){Xs&&(Xs.detachEvent("onpropertychange",xh),Js=Xs=null)}function xh(e){if(e.propertyName==="value"&&Qn(Js)){var t=[];yh(t,Js,e,He(e)),ut(B_,t)}}function O_(e,t,s){e==="focusin"?(Ch(),Xs=t,Js=s,Xs.attachEvent("onpropertychange",xh)):e==="focusout"&&Ch()}function N_(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qn(Js)}function I_(e,t){if(e==="click")return Qn(t)}function j_(e,t){if(e==="input"||e==="change")return Qn(t)}function F_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Nr=typeof Object.is=="function"?Object.is:F_;function Qs(e,t){if(Nr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;for(a=0;a<s.length;a++){var m=s[a];if(!d.call(t,m)||!Nr(e[m],t[m]))return!1}return!0}function bh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Eh(e,t){var s=bh(e);e=0;for(var a;s;){if(s.nodeType===3){if(a=e+s.textContent.length,e<=t&&a>=t)return{node:s,offset:t-e};e=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=bh(s)}}function kh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lh(){for(var e=window,t=ie();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=ie(e.document)}return t}function Ia(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 H_(e){var t=Lh(),s=e.focusedElem,a=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&kh(s.ownerDocument.documentElement,s)){if(a!==null&&Ia(s)){if(t=a.start,e=a.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var m=s.textContent.length,b=Math.min(a.start,m);a=a.end===void 0?b:Math.min(a.end,m),!e.extend&&b>a&&(m=a,a=b,b=m),m=Eh(s,b);var F=Eh(s,a);m&&F&&(e.rangeCount!==1||e.anchorNode!==m.node||e.anchorOffset!==m.offset||e.focusNode!==F.node||e.focusOffset!==F.offset)&&(t=t.createRange(),t.setStart(m.node,m.offset),e.removeAllRanges(),b>a?(e.addRange(t),e.extend(F.node,F.offset)):(t.setEnd(F.node,F.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<t.length;s++)e=t[s],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var $_=o&&"documentMode"in document&&11>=document.documentMode,us=null,ja=null,Zs=null,Fa=!1;function Rh(e,t,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Fa||us==null||us!==ie(a)||(a=us,"selectionStart"in a&&Ia(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Zs&&Qs(Zs,a)||(Zs=a,a=ro(ja,"onSelect"),0<a.length&&(t=new Ta("onSelect","select",null,t,s),e.push({event:t,listeners:a}),t.target=us)))}function Zn(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var ds={animationend:Zn("Animation","AnimationEnd"),animationiteration:Zn("Animation","AnimationIteration"),animationstart:Zn("Animation","AnimationStart"),transitionend:Zn("Transition","TransitionEnd")},Ha={},Th={};o&&(Th=document.createElement("div").style,"AnimationEvent"in window||(delete ds.animationend.animation,delete ds.animationiteration.animation,delete ds.animationstart.animation),"TransitionEvent"in window||delete ds.transitionend.transition);function eo(e){if(Ha[e])return Ha[e];if(!ds[e])return e;var t=ds[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Th)return Ha[e]=t[s];return e}var Mh=eo("animationend"),Dh=eo("animationiteration"),Ah=eo("animationstart"),Bh=eo("transitionend"),Ph=new Map,Oh="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 wi(e,t){Ph.set(e,t),L(t,[e])}for(var $a=0;$a<Oh.length;$a++){var za=Oh[$a],z_=za.toLowerCase(),U_=za[0].toUpperCase()+za.slice(1);wi(z_,"on"+U_)}wi(Mh,"onAnimationEnd"),wi(Dh,"onAnimationIteration"),wi(Ah,"onAnimationStart"),wi("dblclick","onDoubleClick"),wi("focusin","onFocus"),wi("focusout","onBlur"),wi(Bh,"onTransitionEnd"),R("onMouseEnter",["mouseout","mouseover"]),R("onMouseLeave",["mouseout","mouseover"]),R("onPointerEnter",["pointerout","pointerover"]),R("onPointerLeave",["pointerout","pointerover"]),L("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),L("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),L("onBeforeInput",["compositionend","keypress","textInput","paste"]),L("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),L("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),L("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var en="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(" "),W_=new Set("cancel close invalid load scroll toggle".split(" ").concat(en));function Nh(e,t,s){var a=e.type||"unknown-event";e.currentTarget=s,pa(a,t,void 0,e),e.currentTarget=null}function Ih(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var a=e[s],m=a.event;a=a.listeners;e:{var b=void 0;if(t)for(var F=a.length-1;0<=F;F--){var G=a[F],Q=G.instance,ae=G.currentTarget;if(G=G.listener,Q!==b&&m.isPropagationStopped())break e;Nh(m,G,ae),b=Q}else for(F=0;F<a.length;F++){if(G=a[F],Q=G.instance,ae=G.currentTarget,G=G.listener,Q!==b&&m.isPropagationStopped())break e;Nh(m,G,ae),b=Q}}}if(Qt)throw e=Or,Qt=!1,Or=null,e}function it(e,t){var s=t[Xa];s===void 0&&(s=t[Xa]=new Set);var a=e+"__bubble";s.has(a)||(jh(t,e,2,!1),s.add(a))}function Ua(e,t,s){var a=0;t&&(a|=4),jh(s,e,a,t)}var to="_reactListening"+Math.random().toString(36).slice(2);function tn(e){if(!e[to]){e[to]=!0,_.forEach(function(s){s!=="selectionchange"&&(W_.has(s)||Ua(s,!1,e),Ua(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[to]||(t[to]=!0,Ua("selectionchange",!1,t))}}function jh(e,t,s,a){switch(ah(t)){case 1:var m=s_;break;case 4:m=n_;break;default:m=ka}s=m.bind(null,t,s,e),m=void 0,!Xe||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(m=!0),a?m!==void 0?e.addEventListener(t,s,{capture:!0,passive:m}):e.addEventListener(t,s,!0):m!==void 0?e.addEventListener(t,s,{passive:m}):e.addEventListener(t,s,!1)}function Wa(e,t,s,a,m){var b=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var F=a.tag;if(F===3||F===4){var G=a.stateNode.containerInfo;if(G===m||G.nodeType===8&&G.parentNode===m)break;if(F===4)for(F=a.return;F!==null;){var Q=F.tag;if((Q===3||Q===4)&&(Q=F.stateNode.containerInfo,Q===m||Q.nodeType===8&&Q.parentNode===m))return;F=F.return}for(;G!==null;){if(F=$i(G),F===null)return;if(Q=F.tag,Q===5||Q===6){a=b=F;continue e}G=G.parentNode}}a=a.return}ut(function(){var ae=b,_e=He(s),ge=[];e:{var fe=Ph.get(e);if(fe!==void 0){var Se=Ta,Ee=e;switch(e){case"keypress":if(Yn(s)===0)break e;case"keydown":case"keyup":Se=w_;break;case"focusin":Ee="focus",Se=Aa;break;case"focusout":Ee="blur",Se=Aa;break;case"beforeblur":case"afterblur":Se=Aa;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=hh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=l_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=x_;break;case Mh:case Dh:case Ah:Se=u_;break;case Bh:Se=E_;break;case"scroll":Se=o_;break;case"wheel":Se=L_;break;case"copy":case"cut":case"paste":Se=f_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=dh}var ke=(t&4)!==0,Et=!ke&&e==="scroll",te=ke?fe!==null?fe+"Capture":null:fe;ke=[];for(var Z=ae,re;Z!==null;){re=Z;var me=re.stateNode;if(re.tag===5&&me!==null&&(re=me,te!==null&&(me=gt(Z,te),me!=null&&ke.push(rn(Z,me,re)))),Et)break;Z=Z.return}0<ke.length&&(fe=new Se(fe,Ee,null,s,_e),ge.push({event:fe,listeners:ke}))}}if((t&7)===0){e:{if(fe=e==="mouseover"||e==="pointerover",Se=e==="mouseout"||e==="pointerout",fe&&s!==Mt&&(Ee=s.relatedTarget||s.fromElement)&&($i(Ee)||Ee[ei]))break e;if((Se||fe)&&(fe=_e.window===_e?_e:(fe=_e.ownerDocument)?fe.defaultView||fe.parentWindow:window,Se?(Ee=s.relatedTarget||s.toElement,Se=ae,Ee=Ee?$i(Ee):null,Ee!==null&&(Et=Zr(Ee),Ee!==Et||Ee.tag!==5&&Ee.tag!==6)&&(Ee=null)):(Se=null,Ee=ae),Se!==Ee)){if(ke=hh,me="onMouseLeave",te="onMouseEnter",Z="mouse",(e==="pointerout"||e==="pointerover")&&(ke=dh,me="onPointerLeave",te="onPointerEnter",Z="pointer"),Et=Se==null?fe:_s(Se),re=Ee==null?fe:_s(Ee),fe=new ke(me,Z+"leave",Se,s,_e),fe.target=Et,fe.relatedTarget=re,me=null,$i(_e)===ae&&(ke=new ke(te,Z+"enter",Ee,s,_e),ke.target=re,ke.relatedTarget=Et,me=ke),Et=me,Se&&Ee)t:{for(ke=Se,te=Ee,Z=0,re=ke;re;re=fs(re))Z++;for(re=0,me=te;me;me=fs(me))re++;for(;0<Z-re;)ke=fs(ke),Z--;for(;0<re-Z;)te=fs(te),re--;for(;Z--;){if(ke===te||te!==null&&ke===te.alternate)break t;ke=fs(ke),te=fs(te)}ke=null}else ke=null;Se!==null&&Fh(ge,fe,Se,ke,!1),Ee!==null&&Et!==null&&Fh(ge,Et,Ee,ke,!0)}}e:{if(fe=ae?_s(ae):window,Se=fe.nodeName&&fe.nodeName.toLowerCase(),Se==="select"||Se==="input"&&fe.type==="file")var Le=P_;else if(mh(fe))if(wh)Le=j_;else{Le=N_;var De=O_}else(Se=fe.nodeName)&&Se.toLowerCase()==="input"&&(fe.type==="checkbox"||fe.type==="radio")&&(Le=I_);if(Le&&(Le=Le(e,ae))){yh(ge,Le,s,_e);break e}De&&De(e,fe,ae),e==="focusout"&&(De=fe._wrapperState)&&De.controlled&&fe.type==="number"&&kt(fe,"number",fe.value)}switch(De=ae?_s(ae):window,e){case"focusin":(mh(De)||De.contentEditable==="true")&&(us=De,ja=ae,Zs=null);break;case"focusout":Zs=ja=us=null;break;case"mousedown":Fa=!0;break;case"contextmenu":case"mouseup":case"dragend":Fa=!1,Rh(ge,s,_e);break;case"selectionchange":if($_)break;case"keydown":case"keyup":Rh(ge,s,_e)}var Ae;if(Pa)e:{switch(e){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else hs?vh(e,s)&&(Be="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Be="onCompositionStart");Be&&(fh&&s.locale!=="ko"&&(hs||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&hs&&(Ae=lh()):(yi=_e,Ra="value"in yi?yi.value:yi.textContent,hs=!0)),De=ro(ae,Be),0<De.length&&(Be=new uh(Be,e,null,s,_e),ge.push({event:Be,listeners:De}),Ae?Be.data=Ae:(Ae=gh(s),Ae!==null&&(Be.data=Ae)))),(Ae=T_?M_(e,s):D_(e,s))&&(ae=ro(ae,"onBeforeInput"),0<ae.length&&(_e=new uh("onBeforeInput","beforeinput",null,s,_e),ge.push({event:_e,listeners:ae}),_e.data=Ae))}Ih(ge,t)})}function rn(e,t,s){return{instance:e,listener:t,currentTarget:s}}function ro(e,t){for(var s=t+"Capture",a=[];e!==null;){var m=e,b=m.stateNode;m.tag===5&&b!==null&&(m=b,b=gt(e,s),b!=null&&a.unshift(rn(e,b,m)),b=gt(e,t),b!=null&&a.push(rn(e,b,m))),e=e.return}return a}function fs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Fh(e,t,s,a,m){for(var b=t._reactName,F=[];s!==null&&s!==a;){var G=s,Q=G.alternate,ae=G.stateNode;if(Q!==null&&Q===a)break;G.tag===5&&ae!==null&&(G=ae,m?(Q=gt(s,b),Q!=null&&F.unshift(rn(s,Q,G))):m||(Q=gt(s,b),Q!=null&&F.push(rn(s,Q,G)))),s=s.return}F.length!==0&&e.push({event:t,listeners:F})}var V_=/\r\n?/g,K_=/\u0000|\uFFFD/g;function Hh(e){return(typeof e=="string"?e:""+e).replace(V_,`
38
+ `).replace(K_,"")}function io(e,t,s){if(t=Hh(t),Hh(e)!==t&&s)throw Error(n(425))}function so(){}var Va=null,Ka=null;function qa(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 Ga=typeof setTimeout=="function"?setTimeout:void 0,q_=typeof clearTimeout=="function"?clearTimeout:void 0,$h=typeof Promise=="function"?Promise:void 0,G_=typeof queueMicrotask=="function"?queueMicrotask:typeof $h<"u"?function(e){return $h.resolve(null).then(e).catch(Y_)}:Ga;function Y_(e){setTimeout(function(){throw e})}function Ya(e,t){var s=t,a=0;do{var m=s.nextSibling;if(e.removeChild(s),m&&m.nodeType===8)if(s=m.data,s==="/$"){if(a===0){e.removeChild(m),Ks(t);return}a--}else s!=="$"&&s!=="$?"&&s!=="$!"||a++;s=m}while(s);Ks(t)}function Si(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 zh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"){if(t===0)return e;t--}else s==="/$"&&t++}e=e.previousSibling}return null}var ps=Math.random().toString(36).slice(2),Kr="__reactFiber$"+ps,sn="__reactProps$"+ps,ei="__reactContainer$"+ps,Xa="__reactEvents$"+ps,X_="__reactListeners$"+ps,J_="__reactHandles$"+ps;function $i(e){var t=e[Kr];if(t)return t;for(var s=e.parentNode;s;){if(t=s[ei]||s[Kr]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=zh(e);e!==null;){if(s=e[Kr])return s;e=zh(e)}return t}e=s,s=e.parentNode}return null}function nn(e){return e=e[Kr]||e[ei],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function _s(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(n(33))}function no(e){return e[sn]||null}var Ja=[],vs=-1;function Ci(e){return{current:e}}function st(e){0>vs||(e.current=Ja[vs],Ja[vs]=null,vs--)}function tt(e,t){vs++,Ja[vs]=e.current,e.current=t}var xi={},Zt=Ci(xi),cr=Ci(!1),zi=xi;function gs(e,t){var s=e.type.contextTypes;if(!s)return xi;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===t)return a.__reactInternalMemoizedMaskedChildContext;var m={},b;for(b in s)m[b]=t[b];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=m),m}function hr(e){return e=e.childContextTypes,e!=null}function oo(){st(cr),st(Zt)}function Uh(e,t,s){if(Zt.current!==xi)throw Error(n(168));tt(Zt,t),tt(cr,s)}function Wh(e,t,s){var a=e.stateNode;if(t=t.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var m in a)if(!(m in t))throw Error(n(108,X(e)||"Unknown",m));return I({},s,a)}function ao(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xi,zi=Zt.current,tt(Zt,e),tt(cr,cr.current),!0}function Vh(e,t,s){var a=e.stateNode;if(!a)throw Error(n(169));s?(e=Wh(e,t,zi),a.__reactInternalMemoizedMergedChildContext=e,st(cr),st(Zt),tt(Zt,e)):st(cr),tt(cr,s)}var ti=null,lo=!1,Qa=!1;function Kh(e){ti===null?ti=[e]:ti.push(e)}function Q_(e){lo=!0,Kh(e)}function bi(){if(!Qa&&ti!==null){Qa=!0;var e=0,t=qe;try{var s=ti;for(qe=1;e<s.length;e++){var a=s[e];do a=a(!0);while(a!==null)}ti=null,lo=!1}catch(m){throw ti!==null&&(ti=ti.slice(e+1)),Hn(Hs,bi),m}finally{qe=t,Qa=!1}}return null}var ms=[],ys=0,co=null,ho=0,Er=[],kr=0,Ui=null,ri=1,ii="";function Wi(e,t){ms[ys++]=ho,ms[ys++]=co,co=e,ho=t}function qh(e,t,s){Er[kr++]=ri,Er[kr++]=ii,Er[kr++]=Ui,Ui=e;var a=ri;e=ii;var m=32-vr(a)-1;a&=~(1<<m),s+=1;var b=32-vr(t)+m;if(30<b){var F=m-m%5;b=(a&(1<<F)-1).toString(32),a>>=F,m-=F,ri=1<<32-vr(t)+m|s<<m|a,ii=b+e}else ri=1<<b|s<<m|a,ii=e}function Za(e){e.return!==null&&(Wi(e,1),qh(e,1,0))}function el(e){for(;e===co;)co=ms[--ys],ms[ys]=null,ho=ms[--ys],ms[ys]=null;for(;e===Ui;)Ui=Er[--kr],Er[kr]=null,ii=Er[--kr],Er[kr]=null,ri=Er[--kr],Er[kr]=null}var mr=null,yr=null,ct=!1,Ir=null;function Gh(e,t){var s=Mr(5,null,null,0);s.elementType="DELETED",s.stateNode=t,s.return=e,t=e.deletions,t===null?(e.deletions=[s],e.flags|=16):t.push(s)}function Yh(e,t){switch(e.tag){case 5:var s=e.type;return t=t.nodeType!==1||s.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,mr=e,yr=Si(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,mr=e,yr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(s=Ui!==null?{id:ri,overflow:ii}:null,e.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},s=Mr(18,null,null,0),s.stateNode=t,s.return=e,e.child=s,mr=e,yr=null,!0):!1;default:return!1}}function tl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function rl(e){if(ct){var t=yr;if(t){var s=t;if(!Yh(e,t)){if(tl(e))throw Error(n(418));t=Si(s.nextSibling);var a=mr;t&&Yh(e,t)?Gh(a,s):(e.flags=e.flags&-4097|2,ct=!1,mr=e)}}else{if(tl(e))throw Error(n(418));e.flags=e.flags&-4097|2,ct=!1,mr=e}}}function Xh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;mr=e}function uo(e){if(e!==mr)return!1;if(!ct)return Xh(e),ct=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!qa(e.type,e.memoizedProps)),t&&(t=yr)){if(tl(e))throw Jh(),Error(n(418));for(;t;)Gh(e,t),t=Si(t.nextSibling)}if(Xh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(n(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"){if(t===0){yr=Si(e.nextSibling);break e}t--}else s!=="$"&&s!=="$!"&&s!=="$?"||t++}e=e.nextSibling}yr=null}}else yr=mr?Si(e.stateNode.nextSibling):null;return!0}function Jh(){for(var e=yr;e;)e=Si(e.nextSibling)}function ws(){yr=mr=null,ct=!1}function il(e){Ir===null?Ir=[e]:Ir.push(e)}var Z_=g.ReactCurrentBatchConfig;function on(e,t,s){if(e=s.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(n(309));var a=s.stateNode}if(!a)throw Error(n(147,e));var m=a,b=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===b?t.ref:(t=function(F){var G=m.refs;F===null?delete G[b]:G[b]=F},t._stringRef=b,t)}if(typeof e!="string")throw Error(n(284));if(!s._owner)throw Error(n(290,e))}return e}function fo(e,t){throw e=Object.prototype.toString.call(t),Error(n(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Qh(e){var t=e._init;return t(e._payload)}function Zh(e){function t(te,Z){if(e){var re=te.deletions;re===null?(te.deletions=[Z],te.flags|=16):re.push(Z)}}function s(te,Z){if(!e)return null;for(;Z!==null;)t(te,Z),Z=Z.sibling;return null}function a(te,Z){for(te=new Map;Z!==null;)Z.key!==null?te.set(Z.key,Z):te.set(Z.index,Z),Z=Z.sibling;return te}function m(te,Z){return te=Ai(te,Z),te.index=0,te.sibling=null,te}function b(te,Z,re){return te.index=re,e?(re=te.alternate,re!==null?(re=re.index,re<Z?(te.flags|=2,Z):re):(te.flags|=2,Z)):(te.flags|=1048576,Z)}function F(te){return e&&te.alternate===null&&(te.flags|=2),te}function G(te,Z,re,me){return Z===null||Z.tag!==6?(Z=Gl(re,te.mode,me),Z.return=te,Z):(Z=m(Z,re),Z.return=te,Z)}function Q(te,Z,re,me){var Le=re.type;return Le===D?_e(te,Z,re.props.children,me,re.key):Z!==null&&(Z.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===K&&Qh(Le)===Z.type)?(me=m(Z,re.props),me.ref=on(te,Z,re),me.return=te,me):(me=Io(re.type,re.key,re.props,null,te.mode,me),me.ref=on(te,Z,re),me.return=te,me)}function ae(te,Z,re,me){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==re.containerInfo||Z.stateNode.implementation!==re.implementation?(Z=Yl(re,te.mode,me),Z.return=te,Z):(Z=m(Z,re.children||[]),Z.return=te,Z)}function _e(te,Z,re,me,Le){return Z===null||Z.tag!==7?(Z=Qi(re,te.mode,me,Le),Z.return=te,Z):(Z=m(Z,re),Z.return=te,Z)}function ge(te,Z,re){if(typeof Z=="string"&&Z!==""||typeof Z=="number")return Z=Gl(""+Z,te.mode,re),Z.return=te,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case C:return re=Io(Z.type,Z.key,Z.props,null,te.mode,re),re.ref=on(te,null,Z),re.return=te,re;case k:return Z=Yl(Z,te.mode,re),Z.return=te,Z;case K:var me=Z._init;return ge(te,me(Z._payload),re)}if(Ct(Z)||B(Z))return Z=Qi(Z,te.mode,re,null),Z.return=te,Z;fo(te,Z)}return null}function fe(te,Z,re,me){var Le=Z!==null?Z.key:null;if(typeof re=="string"&&re!==""||typeof re=="number")return Le!==null?null:G(te,Z,""+re,me);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case C:return re.key===Le?Q(te,Z,re,me):null;case k:return re.key===Le?ae(te,Z,re,me):null;case K:return Le=re._init,fe(te,Z,Le(re._payload),me)}if(Ct(re)||B(re))return Le!==null?null:_e(te,Z,re,me,null);fo(te,re)}return null}function Se(te,Z,re,me,Le){if(typeof me=="string"&&me!==""||typeof me=="number")return te=te.get(re)||null,G(Z,te,""+me,Le);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case C:return te=te.get(me.key===null?re:me.key)||null,Q(Z,te,me,Le);case k:return te=te.get(me.key===null?re:me.key)||null,ae(Z,te,me,Le);case K:var De=me._init;return Se(te,Z,re,De(me._payload),Le)}if(Ct(me)||B(me))return te=te.get(re)||null,_e(Z,te,me,Le,null);fo(Z,me)}return null}function Ee(te,Z,re,me){for(var Le=null,De=null,Ae=Z,Be=Z=0,jt=null;Ae!==null&&Be<re.length;Be++){Ae.index>Be?(jt=Ae,Ae=null):jt=Ae.sibling;var Ue=fe(te,Ae,re[Be],me);if(Ue===null){Ae===null&&(Ae=jt);break}e&&Ae&&Ue.alternate===null&&t(te,Ae),Z=b(Ue,Z,Be),De===null?Le=Ue:De.sibling=Ue,De=Ue,Ae=jt}if(Be===re.length)return s(te,Ae),ct&&Wi(te,Be),Le;if(Ae===null){for(;Be<re.length;Be++)Ae=ge(te,re[Be],me),Ae!==null&&(Z=b(Ae,Z,Be),De===null?Le=Ae:De.sibling=Ae,De=Ae);return ct&&Wi(te,Be),Le}for(Ae=a(te,Ae);Be<re.length;Be++)jt=Se(Ae,te,Be,re[Be],me),jt!==null&&(e&&jt.alternate!==null&&Ae.delete(jt.key===null?Be:jt.key),Z=b(jt,Z,Be),De===null?Le=jt:De.sibling=jt,De=jt);return e&&Ae.forEach(function(Bi){return t(te,Bi)}),ct&&Wi(te,Be),Le}function ke(te,Z,re,me){var Le=B(re);if(typeof Le!="function")throw Error(n(150));if(re=Le.call(re),re==null)throw Error(n(151));for(var De=Le=null,Ae=Z,Be=Z=0,jt=null,Ue=re.next();Ae!==null&&!Ue.done;Be++,Ue=re.next()){Ae.index>Be?(jt=Ae,Ae=null):jt=Ae.sibling;var Bi=fe(te,Ae,Ue.value,me);if(Bi===null){Ae===null&&(Ae=jt);break}e&&Ae&&Bi.alternate===null&&t(te,Ae),Z=b(Bi,Z,Be),De===null?Le=Bi:De.sibling=Bi,De=Bi,Ae=jt}if(Ue.done)return s(te,Ae),ct&&Wi(te,Be),Le;if(Ae===null){for(;!Ue.done;Be++,Ue=re.next())Ue=ge(te,Ue.value,me),Ue!==null&&(Z=b(Ue,Z,Be),De===null?Le=Ue:De.sibling=Ue,De=Ue);return ct&&Wi(te,Be),Le}for(Ae=a(te,Ae);!Ue.done;Be++,Ue=re.next())Ue=Se(Ae,te,Be,Ue.value,me),Ue!==null&&(e&&Ue.alternate!==null&&Ae.delete(Ue.key===null?Be:Ue.key),Z=b(Ue,Z,Be),De===null?Le=Ue:De.sibling=Ue,De=Ue);return e&&Ae.forEach(function(Av){return t(te,Av)}),ct&&Wi(te,Be),Le}function Et(te,Z,re,me){if(typeof re=="object"&&re!==null&&re.type===D&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case C:e:{for(var Le=re.key,De=Z;De!==null;){if(De.key===Le){if(Le=re.type,Le===D){if(De.tag===7){s(te,De.sibling),Z=m(De,re.props.children),Z.return=te,te=Z;break e}}else if(De.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===K&&Qh(Le)===De.type){s(te,De.sibling),Z=m(De,re.props),Z.ref=on(te,De,re),Z.return=te,te=Z;break e}s(te,De);break}else t(te,De);De=De.sibling}re.type===D?(Z=Qi(re.props.children,te.mode,me,re.key),Z.return=te,te=Z):(me=Io(re.type,re.key,re.props,null,te.mode,me),me.ref=on(te,Z,re),me.return=te,te=me)}return F(te);case k:e:{for(De=re.key;Z!==null;){if(Z.key===De)if(Z.tag===4&&Z.stateNode.containerInfo===re.containerInfo&&Z.stateNode.implementation===re.implementation){s(te,Z.sibling),Z=m(Z,re.children||[]),Z.return=te,te=Z;break e}else{s(te,Z);break}else t(te,Z);Z=Z.sibling}Z=Yl(re,te.mode,me),Z.return=te,te=Z}return F(te);case K:return De=re._init,Et(te,Z,De(re._payload),me)}if(Ct(re))return Ee(te,Z,re,me);if(B(re))return ke(te,Z,re,me);fo(te,re)}return typeof re=="string"&&re!==""||typeof re=="number"?(re=""+re,Z!==null&&Z.tag===6?(s(te,Z.sibling),Z=m(Z,re),Z.return=te,te=Z):(s(te,Z),Z=Gl(re,te.mode,me),Z.return=te,te=Z),F(te)):s(te,Z)}return Et}var Ss=Zh(!0),eu=Zh(!1),po=Ci(null),_o=null,Cs=null,sl=null;function nl(){sl=Cs=_o=null}function ol(e){var t=po.current;st(po),e._currentValue=t}function al(e,t,s){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===s)break;e=e.return}}function xs(e,t){_o=e,sl=Cs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ur=!0),e.firstContext=null)}function Lr(e){var t=e._currentValue;if(sl!==e)if(e={context:e,memoizedValue:t,next:null},Cs===null){if(_o===null)throw Error(n(308));Cs=e,_o.dependencies={lanes:0,firstContext:e}}else Cs=Cs.next=e;return t}var Vi=null;function ll(e){Vi===null?Vi=[e]:Vi.push(e)}function tu(e,t,s,a){var m=t.interleaved;return m===null?(s.next=s,ll(t)):(s.next=m.next,m.next=s),t.interleaved=s,si(e,a)}function si(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Ei=!1;function cl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ru(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 ni(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ki(e,t,s){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,($e&2)!==0){var m=a.pending;return m===null?t.next=t:(t.next=m.next,m.next=t),a.pending=t,si(e,s)}return m=a.interleaved,m===null?(t.next=t,ll(a)):(t.next=m.next,m.next=t),a.interleaved=t,si(e,s)}function vo(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var a=t.lanes;a&=e.pendingLanes,s|=a,t.lanes=s,Vr(e,s)}}function iu(e,t){var s=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var m=null,b=null;if(s=s.firstBaseUpdate,s!==null){do{var F={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};b===null?m=b=F:b=b.next=F,s=s.next}while(s!==null);b===null?m=b=t:b=b.next=t}else m=b=t;s={baseState:a.baseState,firstBaseUpdate:m,lastBaseUpdate:b,shared:a.shared,effects:a.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function go(e,t,s,a){var m=e.updateQueue;Ei=!1;var b=m.firstBaseUpdate,F=m.lastBaseUpdate,G=m.shared.pending;if(G!==null){m.shared.pending=null;var Q=G,ae=Q.next;Q.next=null,F===null?b=ae:F.next=ae,F=Q;var _e=e.alternate;_e!==null&&(_e=_e.updateQueue,G=_e.lastBaseUpdate,G!==F&&(G===null?_e.firstBaseUpdate=ae:G.next=ae,_e.lastBaseUpdate=Q))}if(b!==null){var ge=m.baseState;F=0,_e=ae=Q=null,G=b;do{var fe=G.lane,Se=G.eventTime;if((a&fe)===fe){_e!==null&&(_e=_e.next={eventTime:Se,lane:0,tag:G.tag,payload:G.payload,callback:G.callback,next:null});e:{var Ee=e,ke=G;switch(fe=t,Se=s,ke.tag){case 1:if(Ee=ke.payload,typeof Ee=="function"){ge=Ee.call(Se,ge,fe);break e}ge=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=ke.payload,fe=typeof Ee=="function"?Ee.call(Se,ge,fe):Ee,fe==null)break e;ge=I({},ge,fe);break e;case 2:Ei=!0}}G.callback!==null&&G.lane!==0&&(e.flags|=64,fe=m.effects,fe===null?m.effects=[G]:fe.push(G))}else Se={eventTime:Se,lane:fe,tag:G.tag,payload:G.payload,callback:G.callback,next:null},_e===null?(ae=_e=Se,Q=ge):_e=_e.next=Se,F|=fe;if(G=G.next,G===null){if(G=m.shared.pending,G===null)break;fe=G,G=fe.next,fe.next=null,m.lastBaseUpdate=fe,m.shared.pending=null}}while(!0);if(_e===null&&(Q=ge),m.baseState=Q,m.firstBaseUpdate=ae,m.lastBaseUpdate=_e,t=m.shared.interleaved,t!==null){m=t;do F|=m.lane,m=m.next;while(m!==t)}else b===null&&(m.shared.lanes=0);Gi|=F,e.lanes=F,e.memoizedState=ge}}function su(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var a=e[t],m=a.callback;if(m!==null){if(a.callback=null,a=s,typeof m!="function")throw Error(n(191,m));m.call(a)}}}var an={},qr=Ci(an),ln=Ci(an),cn=Ci(an);function Ki(e){if(e===an)throw Error(n(174));return e}function hl(e,t){switch(tt(cn,t),tt(ln,e),tt(qr,an),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:bt(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=bt(t,e)}st(qr),tt(qr,t)}function bs(){st(qr),st(ln),st(cn)}function nu(e){Ki(cn.current);var t=Ki(qr.current),s=bt(t,e.type);t!==s&&(tt(ln,e),tt(qr,s))}function ul(e){ln.current===e&&(st(qr),st(ln))}var ft=Ci(0);function mo(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)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 dl=[];function fl(){for(var e=0;e<dl.length;e++)dl[e]._workInProgressVersionPrimary=null;dl.length=0}var yo=g.ReactCurrentDispatcher,pl=g.ReactCurrentBatchConfig,qi=0,pt=null,Dt=null,Nt=null,wo=!1,hn=!1,un=0,ev=0;function er(){throw Error(n(321))}function _l(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Nr(e[s],t[s]))return!1;return!0}function vl(e,t,s,a,m,b){if(qi=b,pt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,yo.current=e===null||e.memoizedState===null?sv:nv,e=s(a,m),hn){b=0;do{if(hn=!1,un=0,25<=b)throw Error(n(301));b+=1,Nt=Dt=null,t.updateQueue=null,yo.current=ov,e=s(a,m)}while(hn)}if(yo.current=xo,t=Dt!==null&&Dt.next!==null,qi=0,Nt=Dt=pt=null,wo=!1,t)throw Error(n(300));return e}function gl(){var e=un!==0;return un=0,e}function Gr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Nt===null?pt.memoizedState=Nt=e:Nt=Nt.next=e,Nt}function Rr(){if(Dt===null){var e=pt.alternate;e=e!==null?e.memoizedState:null}else e=Dt.next;var t=Nt===null?pt.memoizedState:Nt.next;if(t!==null)Nt=t,Dt=e;else{if(e===null)throw Error(n(310));Dt=e,e={memoizedState:Dt.memoizedState,baseState:Dt.baseState,baseQueue:Dt.baseQueue,queue:Dt.queue,next:null},Nt===null?pt.memoizedState=Nt=e:Nt=Nt.next=e}return Nt}function dn(e,t){return typeof t=="function"?t(e):t}function ml(e){var t=Rr(),s=t.queue;if(s===null)throw Error(n(311));s.lastRenderedReducer=e;var a=Dt,m=a.baseQueue,b=s.pending;if(b!==null){if(m!==null){var F=m.next;m.next=b.next,b.next=F}a.baseQueue=m=b,s.pending=null}if(m!==null){b=m.next,a=a.baseState;var G=F=null,Q=null,ae=b;do{var _e=ae.lane;if((qi&_e)===_e)Q!==null&&(Q=Q.next={lane:0,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),a=ae.hasEagerState?ae.eagerState:e(a,ae.action);else{var ge={lane:_e,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null};Q===null?(G=Q=ge,F=a):Q=Q.next=ge,pt.lanes|=_e,Gi|=_e}ae=ae.next}while(ae!==null&&ae!==b);Q===null?F=a:Q.next=G,Nr(a,t.memoizedState)||(ur=!0),t.memoizedState=a,t.baseState=F,t.baseQueue=Q,s.lastRenderedState=a}if(e=s.interleaved,e!==null){m=e;do b=m.lane,pt.lanes|=b,Gi|=b,m=m.next;while(m!==e)}else m===null&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function yl(e){var t=Rr(),s=t.queue;if(s===null)throw Error(n(311));s.lastRenderedReducer=e;var a=s.dispatch,m=s.pending,b=t.memoizedState;if(m!==null){s.pending=null;var F=m=m.next;do b=e(b,F.action),F=F.next;while(F!==m);Nr(b,t.memoizedState)||(ur=!0),t.memoizedState=b,t.baseQueue===null&&(t.baseState=b),s.lastRenderedState=b}return[b,a]}function ou(){}function au(e,t){var s=pt,a=Rr(),m=t(),b=!Nr(a.memoizedState,m);if(b&&(a.memoizedState=m,ur=!0),a=a.queue,wl(hu.bind(null,s,a,e),[e]),a.getSnapshot!==t||b||Nt!==null&&Nt.memoizedState.tag&1){if(s.flags|=2048,fn(9,cu.bind(null,s,a,m,t),void 0,null),It===null)throw Error(n(349));(qi&30)!==0||lu(s,t,m)}return m}function lu(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=pt.updateQueue,t===null?(t={lastEffect:null,stores:null},pt.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function cu(e,t,s,a){t.value=s,t.getSnapshot=a,uu(t)&&du(e)}function hu(e,t,s){return s(function(){uu(t)&&du(e)})}function uu(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Nr(e,s)}catch{return!0}}function du(e){var t=si(e,1);t!==null&&$r(t,e,1,-1)}function fu(e){var t=Gr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:dn,lastRenderedState:e},t.queue=e,e=e.dispatch=iv.bind(null,pt,e),[t.memoizedState,e]}function fn(e,t,s,a){return e={tag:e,create:t,destroy:s,deps:a,next:null},t=pt.updateQueue,t===null?(t={lastEffect:null,stores:null},pt.updateQueue=t,t.lastEffect=e.next=e):(s=t.lastEffect,s===null?t.lastEffect=e.next=e:(a=s.next,s.next=e,e.next=a,t.lastEffect=e)),e}function pu(){return Rr().memoizedState}function So(e,t,s,a){var m=Gr();pt.flags|=e,m.memoizedState=fn(1|t,s,void 0,a===void 0?null:a)}function Co(e,t,s,a){var m=Rr();a=a===void 0?null:a;var b=void 0;if(Dt!==null){var F=Dt.memoizedState;if(b=F.destroy,a!==null&&_l(a,F.deps)){m.memoizedState=fn(t,s,b,a);return}}pt.flags|=e,m.memoizedState=fn(1|t,s,b,a)}function _u(e,t){return So(8390656,8,e,t)}function wl(e,t){return Co(2048,8,e,t)}function vu(e,t){return Co(4,2,e,t)}function gu(e,t){return Co(4,4,e,t)}function mu(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 yu(e,t,s){return s=s!=null?s.concat([e]):null,Co(4,4,mu.bind(null,t,e),s)}function Sl(){}function wu(e,t){var s=Rr();t=t===void 0?null:t;var a=s.memoizedState;return a!==null&&t!==null&&_l(t,a[1])?a[0]:(s.memoizedState=[e,t],e)}function Su(e,t){var s=Rr();t=t===void 0?null:t;var a=s.memoizedState;return a!==null&&t!==null&&_l(t,a[1])?a[0]:(e=e(),s.memoizedState=[e,t],e)}function Cu(e,t,s){return(qi&21)===0?(e.baseState&&(e.baseState=!1,ur=!0),e.memoizedState=s):(Nr(s,t)||(s=We(),pt.lanes|=s,Gi|=s,e.baseState=!0),t)}function tv(e,t){var s=qe;qe=s!==0&&4>s?s:4,e(!0);var a=pl.transition;pl.transition={};try{e(!1),t()}finally{qe=s,pl.transition=a}}function xu(){return Rr().memoizedState}function rv(e,t,s){var a=Mi(e);if(s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},bu(e))Eu(t,s);else if(s=tu(e,t,s,a),s!==null){var m=or();$r(s,e,a,m),ku(s,t,a)}}function iv(e,t,s){var a=Mi(e),m={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(bu(e))Eu(t,m);else{var b=e.alternate;if(e.lanes===0&&(b===null||b.lanes===0)&&(b=t.lastRenderedReducer,b!==null))try{var F=t.lastRenderedState,G=b(F,s);if(m.hasEagerState=!0,m.eagerState=G,Nr(G,F)){var Q=t.interleaved;Q===null?(m.next=m,ll(t)):(m.next=Q.next,Q.next=m),t.interleaved=m;return}}catch{}finally{}s=tu(e,t,m,a),s!==null&&(m=or(),$r(s,e,a,m),ku(s,t,a))}}function bu(e){var t=e.alternate;return e===pt||t!==null&&t===pt}function Eu(e,t){hn=wo=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function ku(e,t,s){if((s&4194240)!==0){var a=t.lanes;a&=e.pendingLanes,s|=a,t.lanes=s,Vr(e,s)}}var xo={readContext:Lr,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useInsertionEffect:er,useLayoutEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useMutableSource:er,useSyncExternalStore:er,useId:er,unstable_isNewReconciler:!1},sv={readContext:Lr,useCallback:function(e,t){return Gr().memoizedState=[e,t===void 0?null:t],e},useContext:Lr,useEffect:_u,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,So(4194308,4,mu.bind(null,t,e),s)},useLayoutEffect:function(e,t){return So(4194308,4,e,t)},useInsertionEffect:function(e,t){return So(4,2,e,t)},useMemo:function(e,t){var s=Gr();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var a=Gr();return t=s!==void 0?s(t):t,a.memoizedState=a.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},a.queue=e,e=e.dispatch=rv.bind(null,pt,e),[a.memoizedState,e]},useRef:function(e){var t=Gr();return e={current:e},t.memoizedState=e},useState:fu,useDebugValue:Sl,useDeferredValue:function(e){return Gr().memoizedState=e},useTransition:function(){var e=fu(!1),t=e[0];return e=tv.bind(null,e[1]),Gr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var a=pt,m=Gr();if(ct){if(s===void 0)throw Error(n(407));s=s()}else{if(s=t(),It===null)throw Error(n(349));(qi&30)!==0||lu(a,t,s)}m.memoizedState=s;var b={value:s,getSnapshot:t};return m.queue=b,_u(hu.bind(null,a,b,e),[e]),a.flags|=2048,fn(9,cu.bind(null,a,b,s,t),void 0,null),s},useId:function(){var e=Gr(),t=It.identifierPrefix;if(ct){var s=ii,a=ri;s=(a&~(1<<32-vr(a)-1)).toString(32)+s,t=":"+t+"R"+s,s=un++,0<s&&(t+="H"+s.toString(32)),t+=":"}else s=ev++,t=":"+t+"r"+s.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},nv={readContext:Lr,useCallback:wu,useContext:Lr,useEffect:wl,useImperativeHandle:yu,useInsertionEffect:vu,useLayoutEffect:gu,useMemo:Su,useReducer:ml,useRef:pu,useState:function(){return ml(dn)},useDebugValue:Sl,useDeferredValue:function(e){var t=Rr();return Cu(t,Dt.memoizedState,e)},useTransition:function(){var e=ml(dn)[0],t=Rr().memoizedState;return[e,t]},useMutableSource:ou,useSyncExternalStore:au,useId:xu,unstable_isNewReconciler:!1},ov={readContext:Lr,useCallback:wu,useContext:Lr,useEffect:wl,useImperativeHandle:yu,useInsertionEffect:vu,useLayoutEffect:gu,useMemo:Su,useReducer:yl,useRef:pu,useState:function(){return yl(dn)},useDebugValue:Sl,useDeferredValue:function(e){var t=Rr();return Dt===null?t.memoizedState=e:Cu(t,Dt.memoizedState,e)},useTransition:function(){var e=yl(dn)[0],t=Rr().memoizedState;return[e,t]},useMutableSource:ou,useSyncExternalStore:au,useId:xu,unstable_isNewReconciler:!1};function jr(e,t){if(e&&e.defaultProps){t=I({},t),e=e.defaultProps;for(var s in e)t[s]===void 0&&(t[s]=e[s]);return t}return t}function Cl(e,t,s,a){t=e.memoizedState,s=s(a,t),s=s==null?t:I({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var bo={isMounted:function(e){return(e=e._reactInternals)?Zr(e)===e:!1},enqueueSetState:function(e,t,s){e=e._reactInternals;var a=or(),m=Mi(e),b=ni(a,m);b.payload=t,s!=null&&(b.callback=s),t=ki(e,b,m),t!==null&&($r(t,e,m,a),vo(t,e,m))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var a=or(),m=Mi(e),b=ni(a,m);b.tag=1,b.payload=t,s!=null&&(b.callback=s),t=ki(e,b,m),t!==null&&($r(t,e,m,a),vo(t,e,m))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=or(),a=Mi(e),m=ni(s,a);m.tag=2,t!=null&&(m.callback=t),t=ki(e,m,a),t!==null&&($r(t,e,a,s),vo(t,e,a))}};function Lu(e,t,s,a,m,b,F){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,b,F):t.prototype&&t.prototype.isPureReactComponent?!Qs(s,a)||!Qs(m,b):!0}function Ru(e,t,s){var a=!1,m=xi,b=t.contextType;return typeof b=="object"&&b!==null?b=Lr(b):(m=hr(t)?zi:Zt.current,a=t.contextTypes,b=(a=a!=null)?gs(e,m):xi),t=new t(s,b),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=bo,e.stateNode=t,t._reactInternals=e,a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=m,e.__reactInternalMemoizedMaskedChildContext=b),t}function Tu(e,t,s,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,a),t.state!==e&&bo.enqueueReplaceState(t,t.state,null)}function xl(e,t,s,a){var m=e.stateNode;m.props=s,m.state=e.memoizedState,m.refs={},cl(e);var b=t.contextType;typeof b=="object"&&b!==null?m.context=Lr(b):(b=hr(t)?zi:Zt.current,m.context=gs(e,b)),m.state=e.memoizedState,b=t.getDerivedStateFromProps,typeof b=="function"&&(Cl(e,t,b,s),m.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(t=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),t!==m.state&&bo.enqueueReplaceState(m,m.state,null),go(e,s,m,a),m.state=e.memoizedState),typeof m.componentDidMount=="function"&&(e.flags|=4194308)}function Es(e,t){try{var s="",a=t;do s+=le(a),a=a.return;while(a);var m=s}catch(b){m=`
39
+ Error generating stack: `+b.message+`
40
+ `+b.stack}return{value:e,source:t,stack:m,digest:null}}function bl(e,t,s){return{value:e,source:null,stack:s??null,digest:t??null}}function El(e,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var av=typeof WeakMap=="function"?WeakMap:Map;function Mu(e,t,s){s=ni(-1,s),s.tag=3,s.payload={element:null};var a=t.value;return s.callback=function(){Do||(Do=!0,Hl=a),El(e,t)},s}function Du(e,t,s){s=ni(-1,s),s.tag=3;var a=e.type.getDerivedStateFromError;if(typeof a=="function"){var m=t.value;s.payload=function(){return a(m)},s.callback=function(){El(e,t)}}var b=e.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(s.callback=function(){El(e,t),typeof a!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var F=t.stack;this.componentDidCatch(t.value,{componentStack:F!==null?F:""})}),s}function Au(e,t,s){var a=e.pingCache;if(a===null){a=e.pingCache=new av;var m=new Set;a.set(t,m)}else m=a.get(t),m===void 0&&(m=new Set,a.set(t,m));m.has(s)||(m.add(s),e=Sv.bind(null,e,t,s),t.then(e,e))}function Bu(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 Pu(e,t,s,a,m){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(t=ni(-1,1),t.tag=2,ki(s,t,1))),s.lanes|=1),e):(e.flags|=65536,e.lanes=m,e)}var lv=g.ReactCurrentOwner,ur=!1;function nr(e,t,s,a){t.child=e===null?eu(t,null,s,a):Ss(t,e.child,s,a)}function Ou(e,t,s,a,m){s=s.render;var b=t.ref;return xs(t,m),a=vl(e,t,s,a,b,m),s=gl(),e!==null&&!ur?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~m,oi(e,t,m)):(ct&&s&&Za(t),t.flags|=1,nr(e,t,a,m),t.child)}function Nu(e,t,s,a,m){if(e===null){var b=s.type;return typeof b=="function"&&!ql(b)&&b.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=b,Iu(e,t,b,a,m)):(e=Io(s.type,null,a,t,t.mode,m),e.ref=t.ref,e.return=t,t.child=e)}if(b=e.child,(e.lanes&m)===0){var F=b.memoizedProps;if(s=s.compare,s=s!==null?s:Qs,s(F,a)&&e.ref===t.ref)return oi(e,t,m)}return t.flags|=1,e=Ai(b,a),e.ref=t.ref,e.return=t,t.child=e}function Iu(e,t,s,a,m){if(e!==null){var b=e.memoizedProps;if(Qs(b,a)&&e.ref===t.ref)if(ur=!1,t.pendingProps=a=b,(e.lanes&m)!==0)(e.flags&131072)!==0&&(ur=!0);else return t.lanes=e.lanes,oi(e,t,m)}return kl(e,t,s,a,m)}function ju(e,t,s){var a=t.pendingProps,m=a.children,b=e!==null?e.memoizedState:null;if(a.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(Ls,wr),wr|=s;else{if((s&1073741824)===0)return e=b!==null?b.baseLanes|s:s,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,tt(Ls,wr),wr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},a=b!==null?b.baseLanes:s,tt(Ls,wr),wr|=a}else b!==null?(a=b.baseLanes|s,t.memoizedState=null):a=s,tt(Ls,wr),wr|=a;return nr(e,t,m,s),t.child}function Fu(e,t){var s=t.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function kl(e,t,s,a,m){var b=hr(s)?zi:Zt.current;return b=gs(t,b),xs(t,m),s=vl(e,t,s,a,b,m),a=gl(),e!==null&&!ur?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~m,oi(e,t,m)):(ct&&a&&Za(t),t.flags|=1,nr(e,t,s,m),t.child)}function Hu(e,t,s,a,m){if(hr(s)){var b=!0;ao(t)}else b=!1;if(xs(t,m),t.stateNode===null)ko(e,t),Ru(t,s,a),xl(t,s,a,m),a=!0;else if(e===null){var F=t.stateNode,G=t.memoizedProps;F.props=G;var Q=F.context,ae=s.contextType;typeof ae=="object"&&ae!==null?ae=Lr(ae):(ae=hr(s)?zi:Zt.current,ae=gs(t,ae));var _e=s.getDerivedStateFromProps,ge=typeof _e=="function"||typeof F.getSnapshotBeforeUpdate=="function";ge||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(G!==a||Q!==ae)&&Tu(t,F,a,ae),Ei=!1;var fe=t.memoizedState;F.state=fe,go(t,a,F,m),Q=t.memoizedState,G!==a||fe!==Q||cr.current||Ei?(typeof _e=="function"&&(Cl(t,s,_e,a),Q=t.memoizedState),(G=Ei||Lu(t,s,G,a,fe,Q,ae))?(ge||typeof F.UNSAFE_componentWillMount!="function"&&typeof F.componentWillMount!="function"||(typeof F.componentWillMount=="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount=="function"&&F.UNSAFE_componentWillMount()),typeof F.componentDidMount=="function"&&(t.flags|=4194308)):(typeof F.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=Q),F.props=a,F.state=Q,F.context=ae,a=G):(typeof F.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{F=t.stateNode,ru(e,t),G=t.memoizedProps,ae=t.type===t.elementType?G:jr(t.type,G),F.props=ae,ge=t.pendingProps,fe=F.context,Q=s.contextType,typeof Q=="object"&&Q!==null?Q=Lr(Q):(Q=hr(s)?zi:Zt.current,Q=gs(t,Q));var Se=s.getDerivedStateFromProps;(_e=typeof Se=="function"||typeof F.getSnapshotBeforeUpdate=="function")||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(G!==ge||fe!==Q)&&Tu(t,F,a,Q),Ei=!1,fe=t.memoizedState,F.state=fe,go(t,a,F,m);var Ee=t.memoizedState;G!==ge||fe!==Ee||cr.current||Ei?(typeof Se=="function"&&(Cl(t,s,Se,a),Ee=t.memoizedState),(ae=Ei||Lu(t,s,ae,a,fe,Ee,Q)||!1)?(_e||typeof F.UNSAFE_componentWillUpdate!="function"&&typeof F.componentWillUpdate!="function"||(typeof F.componentWillUpdate=="function"&&F.componentWillUpdate(a,Ee,Q),typeof F.UNSAFE_componentWillUpdate=="function"&&F.UNSAFE_componentWillUpdate(a,Ee,Q)),typeof F.componentDidUpdate=="function"&&(t.flags|=4),typeof F.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof F.componentDidUpdate!="function"||G===e.memoizedProps&&fe===e.memoizedState||(t.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||G===e.memoizedProps&&fe===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=Ee),F.props=a,F.state=Ee,F.context=Q,a=ae):(typeof F.componentDidUpdate!="function"||G===e.memoizedProps&&fe===e.memoizedState||(t.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||G===e.memoizedProps&&fe===e.memoizedState||(t.flags|=1024),a=!1)}return Ll(e,t,s,a,b,m)}function Ll(e,t,s,a,m,b){Fu(e,t);var F=(t.flags&128)!==0;if(!a&&!F)return m&&Vh(t,s,!1),oi(e,t,b);a=t.stateNode,lv.current=t;var G=F&&typeof s.getDerivedStateFromError!="function"?null:a.render();return t.flags|=1,e!==null&&F?(t.child=Ss(t,e.child,null,b),t.child=Ss(t,null,G,b)):nr(e,t,G,b),t.memoizedState=a.state,m&&Vh(t,s,!0),t.child}function $u(e){var t=e.stateNode;t.pendingContext?Uh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Uh(e,t.context,!1),hl(e,t.containerInfo)}function zu(e,t,s,a,m){return ws(),il(m),t.flags|=256,nr(e,t,s,a),t.child}var Rl={dehydrated:null,treeContext:null,retryLane:0};function Tl(e){return{baseLanes:e,cachePool:null,transitions:null}}function Uu(e,t,s){var a=t.pendingProps,m=ft.current,b=!1,F=(t.flags&128)!==0,G;if((G=F)||(G=e!==null&&e.memoizedState===null?!1:(m&2)!==0),G?(b=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(m|=1),tt(ft,m&1),e===null)return rl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(F=a.children,e=a.fallback,b?(a=t.mode,b=t.child,F={mode:"hidden",children:F},(a&1)===0&&b!==null?(b.childLanes=0,b.pendingProps=F):b=jo(F,a,0,null),e=Qi(e,a,s,null),b.return=t,e.return=t,b.sibling=e,t.child=b,t.child.memoizedState=Tl(s),t.memoizedState=Rl,e):Ml(t,F));if(m=e.memoizedState,m!==null&&(G=m.dehydrated,G!==null))return cv(e,t,F,a,G,m,s);if(b){b=a.fallback,F=t.mode,m=e.child,G=m.sibling;var Q={mode:"hidden",children:a.children};return(F&1)===0&&t.child!==m?(a=t.child,a.childLanes=0,a.pendingProps=Q,t.deletions=null):(a=Ai(m,Q),a.subtreeFlags=m.subtreeFlags&14680064),G!==null?b=Ai(G,b):(b=Qi(b,F,s,null),b.flags|=2),b.return=t,a.return=t,a.sibling=b,t.child=a,a=b,b=t.child,F=e.child.memoizedState,F=F===null?Tl(s):{baseLanes:F.baseLanes|s,cachePool:null,transitions:F.transitions},b.memoizedState=F,b.childLanes=e.childLanes&~s,t.memoizedState=Rl,a}return b=e.child,e=b.sibling,a=Ai(b,{mode:"visible",children:a.children}),(t.mode&1)===0&&(a.lanes=s),a.return=t,a.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=a,t.memoizedState=null,a}function Ml(e,t){return t=jo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Eo(e,t,s,a){return a!==null&&il(a),Ss(t,e.child,null,s),e=Ml(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cv(e,t,s,a,m,b,F){if(s)return t.flags&256?(t.flags&=-257,a=bl(Error(n(422))),Eo(e,t,F,a)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(b=a.fallback,m=t.mode,a=jo({mode:"visible",children:a.children},m,0,null),b=Qi(b,m,F,null),b.flags|=2,a.return=t,b.return=t,a.sibling=b,t.child=a,(t.mode&1)!==0&&Ss(t,e.child,null,F),t.child.memoizedState=Tl(F),t.memoizedState=Rl,b);if((t.mode&1)===0)return Eo(e,t,F,null);if(m.data==="$!"){if(a=m.nextSibling&&m.nextSibling.dataset,a)var G=a.dgst;return a=G,b=Error(n(419)),a=bl(b,a,void 0),Eo(e,t,F,a)}if(G=(F&e.childLanes)!==0,ur||G){if(a=It,a!==null){switch(F&-F){case 4:m=2;break;case 16:m=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:m=32;break;case 536870912:m=268435456;break;default:m=0}m=(m&(a.suspendedLanes|F))!==0?0:m,m!==0&&m!==b.retryLane&&(b.retryLane=m,si(e,m),$r(a,e,m,-1))}return Kl(),a=bl(Error(n(421))),Eo(e,t,F,a)}return m.data==="$?"?(t.flags|=128,t.child=e.child,t=Cv.bind(null,e),m._reactRetry=t,null):(e=b.treeContext,yr=Si(m.nextSibling),mr=t,ct=!0,Ir=null,e!==null&&(Er[kr++]=ri,Er[kr++]=ii,Er[kr++]=Ui,ri=e.id,ii=e.overflow,Ui=t),t=Ml(t,a.children),t.flags|=4096,t)}function Wu(e,t,s){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),al(e.return,t,s)}function Dl(e,t,s,a,m){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:s,tailMode:m}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=a,b.tail=s,b.tailMode=m)}function Vu(e,t,s){var a=t.pendingProps,m=a.revealOrder,b=a.tail;if(nr(e,t,a.children,s),a=ft.current,(a&2)!==0)a=a&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Wu(e,s,t);else if(e.tag===19)Wu(e,s,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}a&=1}if(tt(ft,a),(t.mode&1)===0)t.memoizedState=null;else switch(m){case"forwards":for(s=t.child,m=null;s!==null;)e=s.alternate,e!==null&&mo(e)===null&&(m=s),s=s.sibling;s=m,s===null?(m=t.child,t.child=null):(m=s.sibling,s.sibling=null),Dl(t,!1,m,s,b);break;case"backwards":for(s=null,m=t.child,t.child=null;m!==null;){if(e=m.alternate,e!==null&&mo(e)===null){t.child=m;break}e=m.sibling,m.sibling=s,s=m,m=e}Dl(t,!0,s,null,b);break;case"together":Dl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ko(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function oi(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),Gi|=t.lanes,(s&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(n(153));if(t.child!==null){for(e=t.child,s=Ai(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Ai(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function hv(e,t,s){switch(t.tag){case 3:$u(t),ws();break;case 5:nu(t);break;case 1:hr(t.type)&&ao(t);break;case 4:hl(t,t.stateNode.containerInfo);break;case 10:var a=t.type._context,m=t.memoizedProps.value;tt(po,a._currentValue),a._currentValue=m;break;case 13:if(a=t.memoizedState,a!==null)return a.dehydrated!==null?(tt(ft,ft.current&1),t.flags|=128,null):(s&t.child.childLanes)!==0?Uu(e,t,s):(tt(ft,ft.current&1),e=oi(e,t,s),e!==null?e.sibling:null);tt(ft,ft.current&1);break;case 19:if(a=(s&t.childLanes)!==0,(e.flags&128)!==0){if(a)return Vu(e,t,s);t.flags|=128}if(m=t.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),tt(ft,ft.current),a)break;return null;case 22:case 23:return t.lanes=0,ju(e,t,s)}return oi(e,t,s)}var Ku,Al,qu,Gu;Ku=function(e,t){for(var s=t.child;s!==null;){if(s.tag===5||s.tag===6)e.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},Al=function(){},qu=function(e,t,s,a){var m=e.memoizedProps;if(m!==a){e=t.stateNode,Ki(qr.current);var b=null;switch(s){case"input":m=pe(e,m),a=pe(e,a),b=[];break;case"select":m=I({},m,{value:void 0}),a=I({},a,{value:void 0}),b=[];break;case"textarea":m=Ze(e,m),a=Ze(e,a),b=[];break;default:typeof m.onClick!="function"&&typeof a.onClick=="function"&&(e.onclick=so)}Ve(s,a);var F;s=null;for(ae in m)if(!a.hasOwnProperty(ae)&&m.hasOwnProperty(ae)&&m[ae]!=null)if(ae==="style"){var G=m[ae];for(F in G)G.hasOwnProperty(F)&&(s||(s={}),s[F]="")}else ae!=="dangerouslySetInnerHTML"&&ae!=="children"&&ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&ae!=="autoFocus"&&(p.hasOwnProperty(ae)?b||(b=[]):(b=b||[]).push(ae,null));for(ae in a){var Q=a[ae];if(G=m!=null?m[ae]:void 0,a.hasOwnProperty(ae)&&Q!==G&&(Q!=null||G!=null))if(ae==="style")if(G){for(F in G)!G.hasOwnProperty(F)||Q&&Q.hasOwnProperty(F)||(s||(s={}),s[F]="");for(F in Q)Q.hasOwnProperty(F)&&G[F]!==Q[F]&&(s||(s={}),s[F]=Q[F])}else s||(b||(b=[]),b.push(ae,s)),s=Q;else ae==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,G=G?G.__html:void 0,Q!=null&&G!==Q&&(b=b||[]).push(ae,Q)):ae==="children"?typeof Q!="string"&&typeof Q!="number"||(b=b||[]).push(ae,""+Q):ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&(p.hasOwnProperty(ae)?(Q!=null&&ae==="onScroll"&&it("scroll",e),b||G===Q||(b=[])):(b=b||[]).push(ae,Q))}s&&(b=b||[]).push("style",s);var ae=b;(t.updateQueue=ae)&&(t.flags|=4)}},Gu=function(e,t,s,a){s!==a&&(t.flags|=4)};function pn(e,t){if(!ct)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function tr(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,a=0;if(t)for(var m=e.child;m!==null;)s|=m.lanes|m.childLanes,a|=m.subtreeFlags&14680064,a|=m.flags&14680064,m.return=e,m=m.sibling;else for(m=e.child;m!==null;)s|=m.lanes|m.childLanes,a|=m.subtreeFlags,a|=m.flags,m.return=e,m=m.sibling;return e.subtreeFlags|=a,e.childLanes=s,t}function uv(e,t,s){var a=t.pendingProps;switch(el(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tr(t),null;case 1:return hr(t.type)&&oo(),tr(t),null;case 3:return a=t.stateNode,bs(),st(cr),st(Zt),fl(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(uo(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ir!==null&&(Ul(Ir),Ir=null))),Al(e,t),tr(t),null;case 5:ul(t);var m=Ki(cn.current);if(s=t.type,e!==null&&t.stateNode!=null)qu(e,t,s,a,m),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!a){if(t.stateNode===null)throw Error(n(166));return tr(t),null}if(e=Ki(qr.current),uo(t)){a=t.stateNode,s=t.type;var b=t.memoizedProps;switch(a[Kr]=t,a[sn]=b,e=(t.mode&1)!==0,s){case"dialog":it("cancel",a),it("close",a);break;case"iframe":case"object":case"embed":it("load",a);break;case"video":case"audio":for(m=0;m<en.length;m++)it(en[m],a);break;case"source":it("error",a);break;case"img":case"image":case"link":it("error",a),it("load",a);break;case"details":it("toggle",a);break;case"input":Re(a,b),it("invalid",a);break;case"select":a._wrapperState={wasMultiple:!!b.multiple},it("invalid",a);break;case"textarea":et(a,b),it("invalid",a)}Ve(s,b),m=null;for(var F in b)if(b.hasOwnProperty(F)){var G=b[F];F==="children"?typeof G=="string"?a.textContent!==G&&(b.suppressHydrationWarning!==!0&&io(a.textContent,G,e),m=["children",G]):typeof G=="number"&&a.textContent!==""+G&&(b.suppressHydrationWarning!==!0&&io(a.textContent,G,e),m=["children",""+G]):p.hasOwnProperty(F)&&G!=null&&F==="onScroll"&&it("scroll",a)}switch(s){case"input":ce(a),Je(a,b,!0);break;case"textarea":ce(a),xt(a);break;case"select":case"option":break;default:typeof b.onClick=="function"&&(a.onclick=so)}a=m,t.updateQueue=a,a!==null&&(t.flags|=4)}else{F=m.nodeType===9?m:m.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=at(s)),e==="http://www.w3.org/1999/xhtml"?s==="script"?(e=F.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=F.createElement(s,{is:a.is}):(e=F.createElement(s),s==="select"&&(F=e,a.multiple?F.multiple=!0:a.size&&(F.size=a.size))):e=F.createElementNS(e,s),e[Kr]=t,e[sn]=a,Ku(e,t,!1,!1),t.stateNode=e;e:{switch(F=Ge(s,a),s){case"dialog":it("cancel",e),it("close",e),m=a;break;case"iframe":case"object":case"embed":it("load",e),m=a;break;case"video":case"audio":for(m=0;m<en.length;m++)it(en[m],e);m=a;break;case"source":it("error",e),m=a;break;case"img":case"image":case"link":it("error",e),it("load",e),m=a;break;case"details":it("toggle",e),m=a;break;case"input":Re(e,a),m=pe(e,a),it("invalid",e);break;case"option":m=a;break;case"select":e._wrapperState={wasMultiple:!!a.multiple},m=I({},a,{value:void 0}),it("invalid",e);break;case"textarea":et(e,a),m=Ze(e,a),it("invalid",e);break;default:m=a}Ve(s,m),G=m;for(b in G)if(G.hasOwnProperty(b)){var Q=G[b];b==="style"?xe(e,Q):b==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&sr(e,Q)):b==="children"?typeof Q=="string"?(s!=="textarea"||Q!=="")&&_t(e,Q):typeof Q=="number"&&_t(e,""+Q):b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&b!=="autoFocus"&&(p.hasOwnProperty(b)?Q!=null&&b==="onScroll"&&it("scroll",e):Q!=null&&u(e,b,Q,F))}switch(s){case"input":ce(e),Je(e,a,!1);break;case"textarea":ce(e),xt(e);break;case"option":a.value!=null&&e.setAttribute("value",""+j(a.value));break;case"select":e.multiple=!!a.multiple,b=a.value,b!=null?Qe(e,!!a.multiple,b,!1):a.defaultValue!=null&&Qe(e,!!a.multiple,a.defaultValue,!0);break;default:typeof m.onClick=="function"&&(e.onclick=so)}switch(s){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}}a&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return tr(t),null;case 6:if(e&&t.stateNode!=null)Gu(e,t,e.memoizedProps,a);else{if(typeof a!="string"&&t.stateNode===null)throw Error(n(166));if(s=Ki(cn.current),Ki(qr.current),uo(t)){if(a=t.stateNode,s=t.memoizedProps,a[Kr]=t,(b=a.nodeValue!==s)&&(e=mr,e!==null))switch(e.tag){case 3:io(a.nodeValue,s,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&io(a.nodeValue,s,(e.mode&1)!==0)}b&&(t.flags|=4)}else a=(s.nodeType===9?s:s.ownerDocument).createTextNode(a),a[Kr]=t,t.stateNode=a}return tr(t),null;case 13:if(st(ft),a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ct&&yr!==null&&(t.mode&1)!==0&&(t.flags&128)===0)Jh(),ws(),t.flags|=98560,b=!1;else if(b=uo(t),a!==null&&a.dehydrated!==null){if(e===null){if(!b)throw Error(n(318));if(b=t.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(n(317));b[Kr]=t}else ws(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;tr(t),b=!1}else Ir!==null&&(Ul(Ir),Ir=null),b=!0;if(!b)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=s,t):(a=a!==null,a!==(e!==null&&e.memoizedState!==null)&&a&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(ft.current&1)!==0?At===0&&(At=3):Kl())),t.updateQueue!==null&&(t.flags|=4),tr(t),null);case 4:return bs(),Al(e,t),e===null&&tn(t.stateNode.containerInfo),tr(t),null;case 10:return ol(t.type._context),tr(t),null;case 17:return hr(t.type)&&oo(),tr(t),null;case 19:if(st(ft),b=t.memoizedState,b===null)return tr(t),null;if(a=(t.flags&128)!==0,F=b.rendering,F===null)if(a)pn(b,!1);else{if(At!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(F=mo(e),F!==null){for(t.flags|=128,pn(b,!1),a=F.updateQueue,a!==null&&(t.updateQueue=a,t.flags|=4),t.subtreeFlags=0,a=s,s=t.child;s!==null;)b=s,e=a,b.flags&=14680066,F=b.alternate,F===null?(b.childLanes=0,b.lanes=e,b.child=null,b.subtreeFlags=0,b.memoizedProps=null,b.memoizedState=null,b.updateQueue=null,b.dependencies=null,b.stateNode=null):(b.childLanes=F.childLanes,b.lanes=F.lanes,b.child=F.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=F.memoizedProps,b.memoizedState=F.memoizedState,b.updateQueue=F.updateQueue,b.type=F.type,e=F.dependencies,b.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),s=s.sibling;return tt(ft,ft.current&1|2),t.child}e=e.sibling}b.tail!==null&&lt()>Rs&&(t.flags|=128,a=!0,pn(b,!1),t.lanes=4194304)}else{if(!a)if(e=mo(F),e!==null){if(t.flags|=128,a=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),pn(b,!0),b.tail===null&&b.tailMode==="hidden"&&!F.alternate&&!ct)return tr(t),null}else 2*lt()-b.renderingStartTime>Rs&&s!==1073741824&&(t.flags|=128,a=!0,pn(b,!1),t.lanes=4194304);b.isBackwards?(F.sibling=t.child,t.child=F):(s=b.last,s!==null?s.sibling=F:t.child=F,b.last=F)}return b.tail!==null?(t=b.tail,b.rendering=t,b.tail=t.sibling,b.renderingStartTime=lt(),t.sibling=null,s=ft.current,tt(ft,a?s&1|2:s&1),t):(tr(t),null);case 22:case 23:return Vl(),a=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(t.flags|=8192),a&&(t.mode&1)!==0?(wr&1073741824)!==0&&(tr(t),t.subtreeFlags&6&&(t.flags|=8192)):tr(t),null;case 24:return null;case 25:return null}throw Error(n(156,t.tag))}function dv(e,t){switch(el(t),t.tag){case 1:return hr(t.type)&&oo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bs(),st(cr),st(Zt),fl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return ul(t),null;case 13:if(st(ft),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(n(340));ws()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return st(ft),null;case 4:return bs(),null;case 10:return ol(t.type._context),null;case 22:case 23:return Vl(),null;case 24:return null;default:return null}}var Lo=!1,rr=!1,fv=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function ks(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){mt(e,t,a)}else s.current=null}function Bl(e,t,s){try{s()}catch(a){mt(e,t,a)}}var Yu=!1;function pv(e,t){if(Va=Kn,e=Lh(),Ia(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var m=a.anchorOffset,b=a.focusNode;a=a.focusOffset;try{s.nodeType,b.nodeType}catch{s=null;break e}var F=0,G=-1,Q=-1,ae=0,_e=0,ge=e,fe=null;t:for(;;){for(var Se;ge!==s||m!==0&&ge.nodeType!==3||(G=F+m),ge!==b||a!==0&&ge.nodeType!==3||(Q=F+a),ge.nodeType===3&&(F+=ge.nodeValue.length),(Se=ge.firstChild)!==null;)fe=ge,ge=Se;for(;;){if(ge===e)break t;if(fe===s&&++ae===m&&(G=F),fe===b&&++_e===a&&(Q=F),(Se=ge.nextSibling)!==null)break;ge=fe,fe=ge.parentNode}ge=Se}s=G===-1||Q===-1?null:{start:G,end:Q}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ka={focusedElem:e,selectionRange:s},Kn=!1,Ce=t;Ce!==null;)if(t=Ce,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ce=e;else for(;Ce!==null;){t=Ce;try{var Ee=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Ee!==null){var ke=Ee.memoizedProps,Et=Ee.memoizedState,te=t.stateNode,Z=te.getSnapshotBeforeUpdate(t.elementType===t.type?ke:jr(t.type,ke),Et);te.__reactInternalSnapshotBeforeUpdate=Z}break;case 3:var re=t.stateNode.containerInfo;re.nodeType===1?re.textContent="":re.nodeType===9&&re.documentElement&&re.removeChild(re.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(me){mt(t,t.return,me)}if(e=t.sibling,e!==null){e.return=t.return,Ce=e;break}Ce=t.return}return Ee=Yu,Yu=!1,Ee}function _n(e,t,s){var a=t.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var m=a=a.next;do{if((m.tag&e)===e){var b=m.destroy;m.destroy=void 0,b!==void 0&&Bl(t,s,b)}m=m.next}while(m!==a)}}function Ro(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var a=s.create;s.destroy=a()}s=s.next}while(s!==t)}}function Pl(e){var t=e.ref;if(t!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof t=="function"?t(e):t.current=e}}function Xu(e){var t=e.alternate;t!==null&&(e.alternate=null,Xu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Kr],delete t[sn],delete t[Xa],delete t[X_],delete t[J_])),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 Ju(e){return e.tag===5||e.tag===3||e.tag===4}function Qu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ju(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 Ol(e,t,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=so));else if(a!==4&&(e=e.child,e!==null))for(Ol(e,t,s),e=e.sibling;e!==null;)Ol(e,t,s),e=e.sibling}function Nl(e,t,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Nl(e,t,s),e=e.sibling;e!==null;)Nl(e,t,s),e=e.sibling}var Kt=null,Fr=!1;function Li(e,t,s){for(s=s.child;s!==null;)Zu(e,t,s),s=s.sibling}function Zu(e,t,s){if(Cr&&typeof Cr.onCommitFiberUnmount=="function")try{Cr.onCommitFiberUnmount(ss,s)}catch{}switch(s.tag){case 5:rr||ks(s,t);case 6:var a=Kt,m=Fr;Kt=null,Li(e,t,s),Kt=a,Fr=m,Kt!==null&&(Fr?(e=Kt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):Kt.removeChild(s.stateNode));break;case 18:Kt!==null&&(Fr?(e=Kt,s=s.stateNode,e.nodeType===8?Ya(e.parentNode,s):e.nodeType===1&&Ya(e,s),Ks(e)):Ya(Kt,s.stateNode));break;case 4:a=Kt,m=Fr,Kt=s.stateNode.containerInfo,Fr=!0,Li(e,t,s),Kt=a,Fr=m;break;case 0:case 11:case 14:case 15:if(!rr&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){m=a=a.next;do{var b=m,F=b.destroy;b=b.tag,F!==void 0&&((b&2)!==0||(b&4)!==0)&&Bl(s,t,F),m=m.next}while(m!==a)}Li(e,t,s);break;case 1:if(!rr&&(ks(s,t),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(G){mt(s,t,G)}Li(e,t,s);break;case 21:Li(e,t,s);break;case 22:s.mode&1?(rr=(a=rr)||s.memoizedState!==null,Li(e,t,s),rr=a):Li(e,t,s);break;default:Li(e,t,s)}}function ed(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new fv),t.forEach(function(a){var m=xv.bind(null,e,a);s.has(a)||(s.add(a),a.then(m,m))})}}function Hr(e,t){var s=t.deletions;if(s!==null)for(var a=0;a<s.length;a++){var m=s[a];try{var b=e,F=t,G=F;e:for(;G!==null;){switch(G.tag){case 5:Kt=G.stateNode,Fr=!1;break e;case 3:Kt=G.stateNode.containerInfo,Fr=!0;break e;case 4:Kt=G.stateNode.containerInfo,Fr=!0;break e}G=G.return}if(Kt===null)throw Error(n(160));Zu(b,F,m),Kt=null,Fr=!1;var Q=m.alternate;Q!==null&&(Q.return=null),m.return=null}catch(ae){mt(m,t,ae)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)td(t,e),t=t.sibling}function td(e,t){var s=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Hr(t,e),Yr(e),a&4){try{_n(3,e,e.return),Ro(3,e)}catch(ke){mt(e,e.return,ke)}try{_n(5,e,e.return)}catch(ke){mt(e,e.return,ke)}}break;case 1:Hr(t,e),Yr(e),a&512&&s!==null&&ks(s,s.return);break;case 5:if(Hr(t,e),Yr(e),a&512&&s!==null&&ks(s,s.return),e.flags&32){var m=e.stateNode;try{_t(m,"")}catch(ke){mt(e,e.return,ke)}}if(a&4&&(m=e.stateNode,m!=null)){var b=e.memoizedProps,F=s!==null?s.memoizedProps:b,G=e.type,Q=e.updateQueue;if(e.updateQueue=null,Q!==null)try{G==="input"&&b.type==="radio"&&b.name!=null&&Te(m,b),Ge(G,F);var ae=Ge(G,b);for(F=0;F<Q.length;F+=2){var _e=Q[F],ge=Q[F+1];_e==="style"?xe(m,ge):_e==="dangerouslySetInnerHTML"?sr(m,ge):_e==="children"?_t(m,ge):u(m,_e,ge,ae)}switch(G){case"input":ye(m,b);break;case"textarea":Vt(m,b);break;case"select":var fe=m._wrapperState.wasMultiple;m._wrapperState.wasMultiple=!!b.multiple;var Se=b.value;Se!=null?Qe(m,!!b.multiple,Se,!1):fe!==!!b.multiple&&(b.defaultValue!=null?Qe(m,!!b.multiple,b.defaultValue,!0):Qe(m,!!b.multiple,b.multiple?[]:"",!1))}m[sn]=b}catch(ke){mt(e,e.return,ke)}}break;case 6:if(Hr(t,e),Yr(e),a&4){if(e.stateNode===null)throw Error(n(162));m=e.stateNode,b=e.memoizedProps;try{m.nodeValue=b}catch(ke){mt(e,e.return,ke)}}break;case 3:if(Hr(t,e),Yr(e),a&4&&s!==null&&s.memoizedState.isDehydrated)try{Ks(t.containerInfo)}catch(ke){mt(e,e.return,ke)}break;case 4:Hr(t,e),Yr(e);break;case 13:Hr(t,e),Yr(e),m=e.child,m.flags&8192&&(b=m.memoizedState!==null,m.stateNode.isHidden=b,!b||m.alternate!==null&&m.alternate.memoizedState!==null||(Fl=lt())),a&4&&ed(e);break;case 22:if(_e=s!==null&&s.memoizedState!==null,e.mode&1?(rr=(ae=rr)||_e,Hr(t,e),rr=ae):Hr(t,e),Yr(e),a&8192){if(ae=e.memoizedState!==null,(e.stateNode.isHidden=ae)&&!_e&&(e.mode&1)!==0)for(Ce=e,_e=e.child;_e!==null;){for(ge=Ce=_e;Ce!==null;){switch(fe=Ce,Se=fe.child,fe.tag){case 0:case 11:case 14:case 15:_n(4,fe,fe.return);break;case 1:ks(fe,fe.return);var Ee=fe.stateNode;if(typeof Ee.componentWillUnmount=="function"){a=fe,s=fe.return;try{t=a,Ee.props=t.memoizedProps,Ee.state=t.memoizedState,Ee.componentWillUnmount()}catch(ke){mt(a,s,ke)}}break;case 5:ks(fe,fe.return);break;case 22:if(fe.memoizedState!==null){sd(ge);continue}}Se!==null?(Se.return=fe,Ce=Se):sd(ge)}_e=_e.sibling}e:for(_e=null,ge=e;;){if(ge.tag===5){if(_e===null){_e=ge;try{m=ge.stateNode,ae?(b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none"):(G=ge.stateNode,Q=ge.memoizedProps.style,F=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,G.style.display=Pr("display",F))}catch(ke){mt(e,e.return,ke)}}}else if(ge.tag===6){if(_e===null)try{ge.stateNode.nodeValue=ae?"":ge.memoizedProps}catch(ke){mt(e,e.return,ke)}}else if((ge.tag!==22&&ge.tag!==23||ge.memoizedState===null||ge===e)&&ge.child!==null){ge.child.return=ge,ge=ge.child;continue}if(ge===e)break e;for(;ge.sibling===null;){if(ge.return===null||ge.return===e)break e;_e===ge&&(_e=null),ge=ge.return}_e===ge&&(_e=null),ge.sibling.return=ge.return,ge=ge.sibling}}break;case 19:Hr(t,e),Yr(e),a&4&&ed(e);break;case 21:break;default:Hr(t,e),Yr(e)}}function Yr(e){var t=e.flags;if(t&2){try{e:{for(var s=e.return;s!==null;){if(Ju(s)){var a=s;break e}s=s.return}throw Error(n(160))}switch(a.tag){case 5:var m=a.stateNode;a.flags&32&&(_t(m,""),a.flags&=-33);var b=Qu(e);Nl(e,b,m);break;case 3:case 4:var F=a.stateNode.containerInfo,G=Qu(e);Ol(e,G,F);break;default:throw Error(n(161))}}catch(Q){mt(e,e.return,Q)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _v(e,t,s){Ce=e,rd(e)}function rd(e,t,s){for(var a=(e.mode&1)!==0;Ce!==null;){var m=Ce,b=m.child;if(m.tag===22&&a){var F=m.memoizedState!==null||Lo;if(!F){var G=m.alternate,Q=G!==null&&G.memoizedState!==null||rr;G=Lo;var ae=rr;if(Lo=F,(rr=Q)&&!ae)for(Ce=m;Ce!==null;)F=Ce,Q=F.child,F.tag===22&&F.memoizedState!==null?nd(m):Q!==null?(Q.return=F,Ce=Q):nd(m);for(;b!==null;)Ce=b,rd(b),b=b.sibling;Ce=m,Lo=G,rr=ae}id(e)}else(m.subtreeFlags&8772)!==0&&b!==null?(b.return=m,Ce=b):id(e)}}function id(e){for(;Ce!==null;){var t=Ce;if((t.flags&8772)!==0){var s=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:rr||Ro(5,t);break;case 1:var a=t.stateNode;if(t.flags&4&&!rr)if(s===null)a.componentDidMount();else{var m=t.elementType===t.type?s.memoizedProps:jr(t.type,s.memoizedProps);a.componentDidUpdate(m,s.memoizedState,a.__reactInternalSnapshotBeforeUpdate)}var b=t.updateQueue;b!==null&&su(t,b,a);break;case 3:var F=t.updateQueue;if(F!==null){if(s=null,t.child!==null)switch(t.child.tag){case 5:s=t.child.stateNode;break;case 1:s=t.child.stateNode}su(t,F,s)}break;case 5:var G=t.stateNode;if(s===null&&t.flags&4){s=G;var Q=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&s.focus();break;case"img":Q.src&&(s.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var ae=t.alternate;if(ae!==null){var _e=ae.memoizedState;if(_e!==null){var ge=_e.dehydrated;ge!==null&&Ks(ge)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}rr||t.flags&512&&Pl(t)}catch(fe){mt(t,t.return,fe)}}if(t===e){Ce=null;break}if(s=t.sibling,s!==null){s.return=t.return,Ce=s;break}Ce=t.return}}function sd(e){for(;Ce!==null;){var t=Ce;if(t===e){Ce=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Ce=s;break}Ce=t.return}}function nd(e){for(;Ce!==null;){var t=Ce;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{Ro(4,t)}catch(Q){mt(t,s,Q)}break;case 1:var a=t.stateNode;if(typeof a.componentDidMount=="function"){var m=t.return;try{a.componentDidMount()}catch(Q){mt(t,m,Q)}}var b=t.return;try{Pl(t)}catch(Q){mt(t,b,Q)}break;case 5:var F=t.return;try{Pl(t)}catch(Q){mt(t,F,Q)}}}catch(Q){mt(t,t.return,Q)}if(t===e){Ce=null;break}var G=t.sibling;if(G!==null){G.return=t.return,Ce=G;break}Ce=t.return}}var vv=Math.ceil,To=g.ReactCurrentDispatcher,Il=g.ReactCurrentOwner,Tr=g.ReactCurrentBatchConfig,$e=0,It=null,Lt=null,qt=0,wr=0,Ls=Ci(0),At=0,vn=null,Gi=0,Mo=0,jl=0,gn=null,dr=null,Fl=0,Rs=1/0,ai=null,Do=!1,Hl=null,Ri=null,Ao=!1,Ti=null,Bo=0,mn=0,$l=null,Po=-1,Oo=0;function or(){return($e&6)!==0?lt():Po!==-1?Po:Po=lt()}function Mi(e){return(e.mode&1)===0?1:($e&2)!==0&&qt!==0?qt&-qt:Z_.transition!==null?(Oo===0&&(Oo=We()),Oo):(e=qe,e!==0||(e=window.event,e=e===void 0?16:ah(e.type)),e)}function $r(e,t,s,a){if(50<mn)throw mn=0,$l=null,Error(n(185));br(e,s,a),(($e&2)===0||e!==It)&&(e===It&&(($e&2)===0&&(Mo|=s),At===4&&Di(e,qt)),fr(e,a),s===1&&$e===0&&(t.mode&1)===0&&(Rs=lt()+500,lo&&bi()))}function fr(e,t){var s=e.callbackNode;we(e,t);var a=as(e,e===It?qt:0);if(a===0)s!==null&&$n(s),e.callbackNode=null,e.callbackPriority=0;else if(t=a&-a,e.callbackPriority!==t){if(s!=null&&$n(s),t===1)e.tag===0?Q_(ad.bind(null,e)):Kh(ad.bind(null,e)),G_(function(){($e&6)===0&&bi()}),s=null;else{switch(Zc(a)){case 1:s=Hs;break;case 4:s=zn;break;case 16:s=Fi;break;case 536870912:s=Un;break;default:s=Fi}s=_d(s,od.bind(null,e))}e.callbackPriority=t,e.callbackNode=s}}function od(e,t){if(Po=-1,Oo=0,($e&6)!==0)throw Error(n(327));var s=e.callbackNode;if(Ts()&&e.callbackNode!==s)return null;var a=as(e,e===It?qt:0);if(a===0)return null;if((a&30)!==0||(a&e.expiredLanes)!==0||t)t=No(e,a);else{t=a;var m=$e;$e|=2;var b=cd();(It!==e||qt!==t)&&(ai=null,Rs=lt()+500,Xi(e,t));do try{yv();break}catch(G){ld(e,G)}while(!0);nl(),To.current=b,$e=m,Lt!==null?t=0:(It=null,qt=0,t=At)}if(t!==0){if(t===2&&(m=je(e),m!==0&&(a=m,t=zl(e,m))),t===1)throw s=vn,Xi(e,0),Di(e,a),fr(e,lt()),s;if(t===6)Di(e,a);else{if(m=e.current.alternate,(a&30)===0&&!gv(m)&&(t=No(e,a),t===2&&(b=je(e),b!==0&&(a=b,t=zl(e,b))),t===1))throw s=vn,Xi(e,0),Di(e,a),fr(e,lt()),s;switch(e.finishedWork=m,e.finishedLanes=a,t){case 0:case 1:throw Error(n(345));case 2:Ji(e,dr,ai);break;case 3:if(Di(e,a),(a&130023424)===a&&(t=Fl+500-lt(),10<t)){if(as(e,0)!==0)break;if(m=e.suspendedLanes,(m&a)!==a){or(),e.pingedLanes|=e.suspendedLanes&m;break}e.timeoutHandle=Ga(Ji.bind(null,e,dr,ai),t);break}Ji(e,dr,ai);break;case 4:if(Di(e,a),(a&4194240)===a)break;for(t=e.eventTimes,m=-1;0<a;){var F=31-vr(a);b=1<<F,F=t[F],F>m&&(m=F),a&=~b}if(a=m,a=lt()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*vv(a/1960))-a,10<a){e.timeoutHandle=Ga(Ji.bind(null,e,dr,ai),a);break}Ji(e,dr,ai);break;case 5:Ji(e,dr,ai);break;default:throw Error(n(329))}}}return fr(e,lt()),e.callbackNode===s?od.bind(null,e):null}function zl(e,t){var s=gn;return e.current.memoizedState.isDehydrated&&(Xi(e,t).flags|=256),e=No(e,t),e!==2&&(t=dr,dr=s,t!==null&&Ul(t)),e}function Ul(e){dr===null?dr=e:dr.push.apply(dr,e)}function gv(e){for(var t=e;;){if(t.flags&16384){var s=t.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var a=0;a<s.length;a++){var m=s[a],b=m.getSnapshot;m=m.value;try{if(!Nr(b(),m))return!1}catch{return!1}}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;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 Di(e,t){for(t&=~jl,t&=~Mo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var s=31-vr(t),a=1<<s;e[s]=-1,t&=~a}}function ad(e){if(($e&6)!==0)throw Error(n(327));Ts();var t=as(e,0);if((t&1)===0)return fr(e,lt()),null;var s=No(e,t);if(e.tag!==0&&s===2){var a=je(e);a!==0&&(t=a,s=zl(e,a))}if(s===1)throw s=vn,Xi(e,0),Di(e,t),fr(e,lt()),s;if(s===6)throw Error(n(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ji(e,dr,ai),fr(e,lt()),null}function Wl(e,t){var s=$e;$e|=1;try{return e(t)}finally{$e=s,$e===0&&(Rs=lt()+500,lo&&bi())}}function Yi(e){Ti!==null&&Ti.tag===0&&($e&6)===0&&Ts();var t=$e;$e|=1;var s=Tr.transition,a=qe;try{if(Tr.transition=null,qe=1,e)return e()}finally{qe=a,Tr.transition=s,$e=t,($e&6)===0&&bi()}}function Vl(){wr=Ls.current,st(Ls)}function Xi(e,t){e.finishedWork=null,e.finishedLanes=0;var s=e.timeoutHandle;if(s!==-1&&(e.timeoutHandle=-1,q_(s)),Lt!==null)for(s=Lt.return;s!==null;){var a=s;switch(el(a),a.tag){case 1:a=a.type.childContextTypes,a!=null&&oo();break;case 3:bs(),st(cr),st(Zt),fl();break;case 5:ul(a);break;case 4:bs();break;case 13:st(ft);break;case 19:st(ft);break;case 10:ol(a.type._context);break;case 22:case 23:Vl()}s=s.return}if(It=e,Lt=e=Ai(e.current,null),qt=wr=t,At=0,vn=null,jl=Mo=Gi=0,dr=gn=null,Vi!==null){for(t=0;t<Vi.length;t++)if(s=Vi[t],a=s.interleaved,a!==null){s.interleaved=null;var m=a.next,b=s.pending;if(b!==null){var F=b.next;b.next=m,a.next=F}s.pending=a}Vi=null}return e}function ld(e,t){do{var s=Lt;try{if(nl(),yo.current=xo,wo){for(var a=pt.memoizedState;a!==null;){var m=a.queue;m!==null&&(m.pending=null),a=a.next}wo=!1}if(qi=0,Nt=Dt=pt=null,hn=!1,un=0,Il.current=null,s===null||s.return===null){At=1,vn=t,Lt=null;break}e:{var b=e,F=s.return,G=s,Q=t;if(t=qt,G.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ae=Q,_e=G,ge=_e.tag;if((_e.mode&1)===0&&(ge===0||ge===11||ge===15)){var fe=_e.alternate;fe?(_e.updateQueue=fe.updateQueue,_e.memoizedState=fe.memoizedState,_e.lanes=fe.lanes):(_e.updateQueue=null,_e.memoizedState=null)}var Se=Bu(F);if(Se!==null){Se.flags&=-257,Pu(Se,F,G,b,t),Se.mode&1&&Au(b,ae,t),t=Se,Q=ae;var Ee=t.updateQueue;if(Ee===null){var ke=new Set;ke.add(Q),t.updateQueue=ke}else Ee.add(Q);break e}else{if((t&1)===0){Au(b,ae,t),Kl();break e}Q=Error(n(426))}}else if(ct&&G.mode&1){var Et=Bu(F);if(Et!==null){(Et.flags&65536)===0&&(Et.flags|=256),Pu(Et,F,G,b,t),il(Es(Q,G));break e}}b=Q=Es(Q,G),At!==4&&(At=2),gn===null?gn=[b]:gn.push(b),b=F;do{switch(b.tag){case 3:b.flags|=65536,t&=-t,b.lanes|=t;var te=Mu(b,Q,t);iu(b,te);break e;case 1:G=Q;var Z=b.type,re=b.stateNode;if((b.flags&128)===0&&(typeof Z.getDerivedStateFromError=="function"||re!==null&&typeof re.componentDidCatch=="function"&&(Ri===null||!Ri.has(re)))){b.flags|=65536,t&=-t,b.lanes|=t;var me=Du(b,G,t);iu(b,me);break e}}b=b.return}while(b!==null)}ud(s)}catch(Le){t=Le,Lt===s&&s!==null&&(Lt=s=s.return);continue}break}while(!0)}function cd(){var e=To.current;return To.current=xo,e===null?xo:e}function Kl(){(At===0||At===3||At===2)&&(At=4),It===null||(Gi&268435455)===0&&(Mo&268435455)===0||Di(It,qt)}function No(e,t){var s=$e;$e|=2;var a=cd();(It!==e||qt!==t)&&(ai=null,Xi(e,t));do try{mv();break}catch(m){ld(e,m)}while(!0);if(nl(),$e=s,To.current=a,Lt!==null)throw Error(n(261));return It=null,qt=0,At}function mv(){for(;Lt!==null;)hd(Lt)}function yv(){for(;Lt!==null&&!va();)hd(Lt)}function hd(e){var t=pd(e.alternate,e,wr);e.memoizedProps=e.pendingProps,t===null?ud(e):Lt=t,Il.current=null}function ud(e){var t=e;do{var s=t.alternate;if(e=t.return,(t.flags&32768)===0){if(s=uv(s,t,wr),s!==null){Lt=s;return}}else{if(s=dv(s,t),s!==null){s.flags&=32767,Lt=s;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{At=6,Lt=null;return}}if(t=t.sibling,t!==null){Lt=t;return}Lt=t=e}while(t!==null);At===0&&(At=5)}function Ji(e,t,s){var a=qe,m=Tr.transition;try{Tr.transition=null,qe=1,wv(e,t,s,a)}finally{Tr.transition=m,qe=a}return null}function wv(e,t,s,a){do Ts();while(Ti!==null);if(($e&6)!==0)throw Error(n(327));s=e.finishedWork;var m=e.finishedLanes;if(s===null)return null;if(e.finishedWork=null,e.finishedLanes=0,s===e.current)throw Error(n(177));e.callbackNode=null,e.callbackPriority=0;var b=s.lanes|s.childLanes;if($s(e,b),e===It&&(Lt=It=null,qt=0),(s.subtreeFlags&2064)===0&&(s.flags&2064)===0||Ao||(Ao=!0,_d(Fi,function(){return Ts(),null})),b=(s.flags&15990)!==0,(s.subtreeFlags&15990)!==0||b){b=Tr.transition,Tr.transition=null;var F=qe;qe=1;var G=$e;$e|=4,Il.current=null,pv(e,s),td(s,e),H_(Ka),Kn=!!Va,Ka=Va=null,e.current=s,_v(s),ga(),$e=G,qe=F,Tr.transition=b}else e.current=s;if(Ao&&(Ao=!1,Ti=e,Bo=m),b=e.pendingLanes,b===0&&(Ri=null),wa(s.stateNode),fr(e,lt()),t!==null)for(a=e.onRecoverableError,s=0;s<t.length;s++)m=t[s],a(m.value,{componentStack:m.stack,digest:m.digest});if(Do)throw Do=!1,e=Hl,Hl=null,e;return(Bo&1)!==0&&e.tag!==0&&Ts(),b=e.pendingLanes,(b&1)!==0?e===$l?mn++:(mn=0,$l=e):mn=0,bi(),null}function Ts(){if(Ti!==null){var e=Zc(Bo),t=Tr.transition,s=qe;try{if(Tr.transition=null,qe=16>e?16:e,Ti===null)var a=!1;else{if(e=Ti,Ti=null,Bo=0,($e&6)!==0)throw Error(n(331));var m=$e;for($e|=4,Ce=e.current;Ce!==null;){var b=Ce,F=b.child;if((Ce.flags&16)!==0){var G=b.deletions;if(G!==null){for(var Q=0;Q<G.length;Q++){var ae=G[Q];for(Ce=ae;Ce!==null;){var _e=Ce;switch(_e.tag){case 0:case 11:case 15:_n(8,_e,b)}var ge=_e.child;if(ge!==null)ge.return=_e,Ce=ge;else for(;Ce!==null;){_e=Ce;var fe=_e.sibling,Se=_e.return;if(Xu(_e),_e===ae){Ce=null;break}if(fe!==null){fe.return=Se,Ce=fe;break}Ce=Se}}}var Ee=b.alternate;if(Ee!==null){var ke=Ee.child;if(ke!==null){Ee.child=null;do{var Et=ke.sibling;ke.sibling=null,ke=Et}while(ke!==null)}}Ce=b}}if((b.subtreeFlags&2064)!==0&&F!==null)F.return=b,Ce=F;else e:for(;Ce!==null;){if(b=Ce,(b.flags&2048)!==0)switch(b.tag){case 0:case 11:case 15:_n(9,b,b.return)}var te=b.sibling;if(te!==null){te.return=b.return,Ce=te;break e}Ce=b.return}}var Z=e.current;for(Ce=Z;Ce!==null;){F=Ce;var re=F.child;if((F.subtreeFlags&2064)!==0&&re!==null)re.return=F,Ce=re;else e:for(F=Z;Ce!==null;){if(G=Ce,(G.flags&2048)!==0)try{switch(G.tag){case 0:case 11:case 15:Ro(9,G)}}catch(Le){mt(G,G.return,Le)}if(G===F){Ce=null;break e}var me=G.sibling;if(me!==null){me.return=G.return,Ce=me;break e}Ce=G.return}}if($e=m,bi(),Cr&&typeof Cr.onPostCommitFiberRoot=="function")try{Cr.onPostCommitFiberRoot(ss,e)}catch{}a=!0}return a}finally{qe=s,Tr.transition=t}}return!1}function dd(e,t,s){t=Es(s,t),t=Mu(e,t,1),e=ki(e,t,1),t=or(),e!==null&&(br(e,1,t),fr(e,t))}function mt(e,t,s){if(e.tag===3)dd(e,e,s);else for(;t!==null;){if(t.tag===3){dd(t,e,s);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ri===null||!Ri.has(a))){e=Es(s,e),e=Du(t,e,1),t=ki(t,e,1),e=or(),t!==null&&(br(t,1,e),fr(t,e));break}}t=t.return}}function Sv(e,t,s){var a=e.pingCache;a!==null&&a.delete(t),t=or(),e.pingedLanes|=e.suspendedLanes&s,It===e&&(qt&s)===s&&(At===4||At===3&&(qt&130023424)===qt&&500>lt()-Fl?Xi(e,0):jl|=s),fr(e,t)}function fd(e,t){t===0&&((e.mode&1)===0?t=1:(t=os,os<<=1,(os&130023424)===0&&(os=4194304)));var s=or();e=si(e,t),e!==null&&(br(e,t,s),fr(e,s))}function Cv(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),fd(e,s)}function xv(e,t){var s=0;switch(e.tag){case 13:var a=e.stateNode,m=e.memoizedState;m!==null&&(s=m.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(n(314))}a!==null&&a.delete(t),fd(e,s)}var pd;pd=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||cr.current)ur=!0;else{if((e.lanes&s)===0&&(t.flags&128)===0)return ur=!1,hv(e,t,s);ur=(e.flags&131072)!==0}else ur=!1,ct&&(t.flags&1048576)!==0&&qh(t,ho,t.index);switch(t.lanes=0,t.tag){case 2:var a=t.type;ko(e,t),e=t.pendingProps;var m=gs(t,Zt.current);xs(t,s),m=vl(null,t,a,e,m,s);var b=gl();return t.flags|=1,typeof m=="object"&&m!==null&&typeof m.render=="function"&&m.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,hr(a)?(b=!0,ao(t)):b=!1,t.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,cl(t),m.updater=bo,t.stateNode=m,m._reactInternals=t,xl(t,a,e,s),t=Ll(null,t,a,!0,b,s)):(t.tag=0,ct&&b&&Za(t),nr(null,t,m,s),t=t.child),t;case 16:a=t.elementType;e:{switch(ko(e,t),e=t.pendingProps,m=a._init,a=m(a._payload),t.type=a,m=t.tag=Ev(a),e=jr(a,e),m){case 0:t=kl(null,t,a,e,s);break e;case 1:t=Hu(null,t,a,e,s);break e;case 11:t=Ou(null,t,a,e,s);break e;case 14:t=Nu(null,t,a,jr(a.type,e),s);break e}throw Error(n(306,a,""))}return t;case 0:return a=t.type,m=t.pendingProps,m=t.elementType===a?m:jr(a,m),kl(e,t,a,m,s);case 1:return a=t.type,m=t.pendingProps,m=t.elementType===a?m:jr(a,m),Hu(e,t,a,m,s);case 3:e:{if($u(t),e===null)throw Error(n(387));a=t.pendingProps,b=t.memoizedState,m=b.element,ru(e,t),go(t,a,null,s);var F=t.memoizedState;if(a=F.element,b.isDehydrated)if(b={element:a,isDehydrated:!1,cache:F.cache,pendingSuspenseBoundaries:F.pendingSuspenseBoundaries,transitions:F.transitions},t.updateQueue.baseState=b,t.memoizedState=b,t.flags&256){m=Es(Error(n(423)),t),t=zu(e,t,a,s,m);break e}else if(a!==m){m=Es(Error(n(424)),t),t=zu(e,t,a,s,m);break e}else for(yr=Si(t.stateNode.containerInfo.firstChild),mr=t,ct=!0,Ir=null,s=eu(t,null,a,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ws(),a===m){t=oi(e,t,s);break e}nr(e,t,a,s)}t=t.child}return t;case 5:return nu(t),e===null&&rl(t),a=t.type,m=t.pendingProps,b=e!==null?e.memoizedProps:null,F=m.children,qa(a,m)?F=null:b!==null&&qa(a,b)&&(t.flags|=32),Fu(e,t),nr(e,t,F,s),t.child;case 6:return e===null&&rl(t),null;case 13:return Uu(e,t,s);case 4:return hl(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Ss(t,null,a,s):nr(e,t,a,s),t.child;case 11:return a=t.type,m=t.pendingProps,m=t.elementType===a?m:jr(a,m),Ou(e,t,a,m,s);case 7:return nr(e,t,t.pendingProps,s),t.child;case 8:return nr(e,t,t.pendingProps.children,s),t.child;case 12:return nr(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(a=t.type._context,m=t.pendingProps,b=t.memoizedProps,F=m.value,tt(po,a._currentValue),a._currentValue=F,b!==null)if(Nr(b.value,F)){if(b.children===m.children&&!cr.current){t=oi(e,t,s);break e}}else for(b=t.child,b!==null&&(b.return=t);b!==null;){var G=b.dependencies;if(G!==null){F=b.child;for(var Q=G.firstContext;Q!==null;){if(Q.context===a){if(b.tag===1){Q=ni(-1,s&-s),Q.tag=2;var ae=b.updateQueue;if(ae!==null){ae=ae.shared;var _e=ae.pending;_e===null?Q.next=Q:(Q.next=_e.next,_e.next=Q),ae.pending=Q}}b.lanes|=s,Q=b.alternate,Q!==null&&(Q.lanes|=s),al(b.return,s,t),G.lanes|=s;break}Q=Q.next}}else if(b.tag===10)F=b.type===t.type?null:b.child;else if(b.tag===18){if(F=b.return,F===null)throw Error(n(341));F.lanes|=s,G=F.alternate,G!==null&&(G.lanes|=s),al(F,s,t),F=b.sibling}else F=b.child;if(F!==null)F.return=b;else for(F=b;F!==null;){if(F===t){F=null;break}if(b=F.sibling,b!==null){b.return=F.return,F=b;break}F=F.return}b=F}nr(e,t,m.children,s),t=t.child}return t;case 9:return m=t.type,a=t.pendingProps.children,xs(t,s),m=Lr(m),a=a(m),t.flags|=1,nr(e,t,a,s),t.child;case 14:return a=t.type,m=jr(a,t.pendingProps),m=jr(a.type,m),Nu(e,t,a,m,s);case 15:return Iu(e,t,t.type,t.pendingProps,s);case 17:return a=t.type,m=t.pendingProps,m=t.elementType===a?m:jr(a,m),ko(e,t),t.tag=1,hr(a)?(e=!0,ao(t)):e=!1,xs(t,s),Ru(t,a,m),xl(t,a,m,s),Ll(null,t,a,!0,e,s);case 19:return Vu(e,t,s);case 22:return ju(e,t,s)}throw Error(n(156,t.tag))};function _d(e,t){return Hn(e,t)}function bv(e,t,s,a){this.tag=e,this.key=s,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=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mr(e,t,s,a){return new bv(e,t,s,a)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ev(e){if(typeof e=="function")return ql(e)?1:0;if(e!=null){if(e=e.$$typeof,e===O)return 11;if(e===z)return 14}return 2}function Ai(e,t){var s=e.alternate;return s===null?(s=Mr(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Io(e,t,s,a,m,b){var F=2;if(a=e,typeof e=="function")ql(e)&&(F=1);else if(typeof e=="string")F=5;else e:switch(e){case D:return Qi(s.children,m,b,t);case E:F=8,m|=8;break;case N:return e=Mr(12,s,t,m|2),e.elementType=N,e.lanes=b,e;case A:return e=Mr(13,s,t,m),e.elementType=A,e.lanes=b,e;case U:return e=Mr(19,s,t,m),e.elementType=U,e.lanes=b,e;case Y:return jo(s,m,b,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case V:F=10;break e;case q:F=9;break e;case O:F=11;break e;case z:F=14;break e;case K:F=16,a=null;break e}throw Error(n(130,e==null?e:typeof e,""))}return t=Mr(F,s,t,m),t.elementType=e,t.type=a,t.lanes=b,t}function Qi(e,t,s,a){return e=Mr(7,e,a,t),e.lanes=s,e}function jo(e,t,s,a){return e=Mr(22,e,a,t),e.elementType=Y,e.lanes=s,e.stateNode={isHidden:!1},e}function Gl(e,t,s){return e=Mr(6,e,null,t),e.lanes=s,e}function Yl(e,t,s){return t=Mr(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function kv(e,t,s,a,m){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=xr(0),this.expirationTimes=xr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xr(0),this.identifierPrefix=a,this.onRecoverableError=m,this.mutableSourceEagerHydrationData=null}function Xl(e,t,s,a,m,b,F,G,Q){return e=new kv(e,t,s,G,Q),t===1?(t=1,b===!0&&(t|=8)):t=0,b=Mr(3,null,null,t),e.current=b,b.stateNode=e,b.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},cl(b),e}function Lv(e,t,s){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:k,key:a==null?null:""+a,children:e,containerInfo:t,implementation:s}}function vd(e){if(!e)return xi;e=e._reactInternals;e:{if(Zr(e)!==e||e.tag!==1)throw Error(n(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(hr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(n(171))}if(e.tag===1){var s=e.type;if(hr(s))return Wh(e,s,t)}return t}function gd(e,t,s,a,m,b,F,G,Q){return e=Xl(s,a,!0,e,m,b,F,G,Q),e.context=vd(null),s=e.current,a=or(),m=Mi(s),b=ni(a,m),b.callback=t??null,ki(s,b,m),e.current.lanes=m,br(e,m,a),fr(e,a),e}function Fo(e,t,s,a){var m=t.current,b=or(),F=Mi(m);return s=vd(s),t.context===null?t.context=s:t.pendingContext=s,t=ni(b,F),t.payload={element:e},a=a===void 0?null:a,a!==null&&(t.callback=a),e=ki(m,t,F),e!==null&&($r(e,m,F,b),vo(e,m,F)),F}function Ho(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function md(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function Jl(e,t){md(e,t),(e=e.alternate)&&md(e,t)}function Rv(){return null}var yd=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ql(e){this._internalRoot=e}$o.prototype.render=Ql.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(n(409));Fo(e,t,null,null)},$o.prototype.unmount=Ql.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Yi(function(){Fo(null,e,null,null)}),t[ei]=null}};function $o(e){this._internalRoot=e}$o.prototype.unstable_scheduleHydration=function(e){if(e){var t=rh();e={blockedOn:null,target:e,priority:t};for(var s=0;s<mi.length&&t!==0&&t<mi[s].priority;s++);mi.splice(s,0,e),s===0&&nh(e)}};function Zl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function zo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function wd(){}function Tv(e,t,s,a,m){if(m){if(typeof a=="function"){var b=a;a=function(){var ae=Ho(F);b.call(ae)}}var F=gd(t,a,e,0,null,!1,!1,"",wd);return e._reactRootContainer=F,e[ei]=F.current,tn(e.nodeType===8?e.parentNode:e),Yi(),F}for(;m=e.lastChild;)e.removeChild(m);if(typeof a=="function"){var G=a;a=function(){var ae=Ho(Q);G.call(ae)}}var Q=Xl(e,0,!1,null,null,!1,!1,"",wd);return e._reactRootContainer=Q,e[ei]=Q.current,tn(e.nodeType===8?e.parentNode:e),Yi(function(){Fo(t,Q,s,a)}),Q}function Uo(e,t,s,a,m){var b=s._reactRootContainer;if(b){var F=b;if(typeof m=="function"){var G=m;m=function(){var Q=Ho(F);G.call(Q)}}Fo(t,F,e,m)}else F=Tv(s,t,e,m,a);return Ho(F)}eh=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var s=Hi(t.pendingLanes);s!==0&&(Vr(t,s|1),fr(t,lt()),($e&6)===0&&(Rs=lt()+500,bi()))}break;case 13:Yi(function(){var a=si(e,1);if(a!==null){var m=or();$r(a,e,1,m)}}),Jl(e,1)}},ba=function(e){if(e.tag===13){var t=si(e,134217728);if(t!==null){var s=or();$r(t,e,134217728,s)}Jl(e,134217728)}},th=function(e){if(e.tag===13){var t=Mi(e),s=si(e,t);if(s!==null){var a=or();$r(s,e,t,a)}Jl(e,t)}},rh=function(){return qe},ih=function(e,t){var s=qe;try{return qe=e,t()}finally{qe=s}},vt=function(e,t,s){switch(t){case"input":if(ye(e,s),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<s.length;t++){var a=s[t];if(a!==e&&a.form===e.form){var m=no(a);if(!m)throw Error(n(90));ve(a),ye(a,m)}}}break;case"textarea":Vt(e,s);break;case"select":t=s.value,t!=null&&Qe(e,!!s.multiple,t,!1)}},Ke=Wl,Fe=Yi;var Mv={usingClientEntryPoint:!1,Events:[nn,_s,no,be,Oe,Wl]},yn={findFiberByHostInstance:$i,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Dv={bundleType:yn.bundleType,version:yn.version,rendererPackageName:yn.rendererPackageName,rendererConfig:yn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:g.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=jn(e),e===null?null:e.stateNode},findFiberByHostInstance:yn.findFiberByHostInstance||Rv,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 Wo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wo.isDisabled&&Wo.supportsFiber)try{ss=Wo.inject(Dv),Cr=Wo}catch{}}return pr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Mv,pr.createPortal=function(e,t){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Zl(t))throw Error(n(200));return Lv(e,t,null,s)},pr.createRoot=function(e,t){if(!Zl(e))throw Error(n(299));var s=!1,a="",m=yd;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onRecoverableError!==void 0&&(m=t.onRecoverableError)),t=Xl(e,1,!1,null,null,s,!1,a,m),e[ei]=t.current,tn(e.nodeType===8?e.parentNode:e),new Ql(t)},pr.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(n(188)):(e=Object.keys(e).join(","),Error(n(268,e)));return e=jn(t),e=e===null?null:e.stateNode,e},pr.flushSync=function(e){return Yi(e)},pr.hydrate=function(e,t,s){if(!zo(t))throw Error(n(200));return Uo(null,e,t,!0,s)},pr.hydrateRoot=function(e,t,s){if(!Zl(e))throw Error(n(405));var a=s!=null&&s.hydratedSources||null,m=!1,b="",F=yd;if(s!=null&&(s.unstable_strictMode===!0&&(m=!0),s.identifierPrefix!==void 0&&(b=s.identifierPrefix),s.onRecoverableError!==void 0&&(F=s.onRecoverableError)),t=gd(t,null,e,1,s??null,m,!1,b,F),e[ei]=t.current,tn(e),a)for(e=0;e<a.length;e++)s=a[e],m=s._getVersion,m=m(s._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[s,m]:t.mutableSourceEagerHydrationData.push(s,m);return new $o(t)},pr.render=function(e,t,s){if(!zo(t))throw Error(n(200));return Uo(null,e,t,!1,s)},pr.unmountComponentAtNode=function(e){if(!zo(e))throw Error(n(40));return e._reactRootContainer?(Yi(function(){Uo(null,null,e,!1,function(){e._reactRootContainer=null,e[ei]=null})}),!0):!1},pr.unstable_batchedUpdates=Wl,pr.unstable_renderSubtreeIntoContainer=function(e,t,s,a){if(!zo(s))throw Error(n(200));if(e==null||e._reactInternals===void 0)throw Error(n(38));return Uo(e,t,s,!1,a)},pr.version="18.3.1-next-f1338f8080-20240426",pr}var Rd;function Fv(){if(Rd)return rc.exports;Rd=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(i){console.error(i)}}return r(),rc.exports=jv(),rc.exports}var Td;function Hv(){if(Td)return Vo;Td=1;var r=Fv();return Vo.createRoot=r.createRoot,Vo.hydrateRoot=r.hydrateRoot,Vo}var $v=Hv();const zv=Nf($v);function If(r){var i,n,_="";if(typeof r=="string"||typeof r=="number")_+=r;else if(typeof r=="object")if(Array.isArray(r)){var p=r.length;for(i=0;i<p;i++)r[i]&&(n=If(r[i]))&&(_&&(_+=" "),_+=n)}else for(n in r)r[n]&&(_&&(_+=" "),_+=n);return _}function St(){for(var r,i,n=0,_="",p=arguments.length;n<p;n++)(r=arguments[n])&&(i=If(r))&&(_&&(_+=" "),_+=i);return _}function jf(r,i){const n=$.useRef(null);return $.useEffect(()=>{if(!r)return;const _=n.current;if(!_)return;const p=()=>Array.from(_.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])"));requestAnimationFrame(()=>{const R=p(),o=R.find(d=>d.tagName!=="BUTTON")??R[0];o==null||o.focus()});const L=R=>{if(R.key==="Escape"){R.preventDefault(),i();return}if(R.key!=="Tab")return;const o=p();if(o.length===0)return;const d=o[0],v=o[o.length-1];R.shiftKey?document.activeElement===d&&(R.preventDefault(),v.focus()):document.activeElement===v&&(R.preventDefault(),d.focus())};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[r,i]),n}const Uv=({isOpen:r,workspaces:i,onSubmit:n,onClose:_})=>{var S;const[p,L]=$.useState(((S=i[0])==null?void 0:S.id)||""),[R,o]=$.useState(""),[d,v]=$.useState(!1),y=jf(r,_);$.useEffect(()=>{r&&i.length>0&&!p&&L(i[0].id)},[r,i,p]);const f=async x=>{if(x.preventDefault(),!d){v(!0);try{await n(R.trim(),p),o("")}finally{v(!1)}}};return r?M.jsx("div",{className:"fixed inset-0 bg-black/50 grid place-items-center z-[500]",role:"dialog","aria-modal":"true","aria-labelledby":"deck-modal-title",children:M.jsxs("form",{className:"modal",ref:y,onSubmit:f,children:[M.jsx("div",{className:"text-[14px] font-semibold mb-3",id:"deck-modal-title",children:"デッキ作成"}),M.jsxs("label",{className:"grid gap-1 text-xs",children:[M.jsx("span",{children:"デッキ名 (任意)"}),M.jsx("input",{type:"text",className:"bg-panel border border-border rounded-[2px] px-2 py-1.5 text-[13px] font-mono text-ink focus:outline-none focus:border-focus",value:R,placeholder:"空白のままでもOK",maxLength:100,onChange:x=>o(x.target.value)})]}),M.jsxs("label",{className:"grid gap-1 text-xs mt-3",children:[M.jsx("span",{children:"ワークスペース"}),M.jsx("select",{className:"bg-panel border border-border rounded-[2px] px-2 py-1.5 text-[13px] font-mono text-ink focus:outline-none focus:border-focus",value:p,onChange:x=>L(x.target.value),children:i.map(x=>M.jsx("option",{value:x.id,children:x.path},x.id))})]}),M.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[M.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:_,disabled:d,children:"キャンセル"}),M.jsx("button",{type:"submit",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",disabled:d,children:d?"作成中...":"作成"})]})]})}):null};function Wv({activeView:r,onSelect:i,theme:n,onToggleTheme:_,onOpenSettings:p}){return M.jsxs("nav",{className:"activity-bar",children:[M.jsxs("div",{className:"activity-bar-top",children:[M.jsx("button",{type:"button",className:St("activity-bar-item",r==="workspace"&&"active"),onClick:()=>i("workspace"),"aria-label":"Explorer",title:"Explorer (Ctrl+Shift+E)",children:M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M17.5 0h-9L7 1.5V6H2.5L1 7.5v15.07L2.5 24h12.07L16 22.57V18h4.7l1.3-1.43V4.5L17.5 0zm0 2.12l2.38 2.38H17.5V2.12zm-3 20.38h-12v-15H7v9.07L8.5 18h6v4.5zm6-6h-12v-15H16V6h4.5v10.5z",fill:"currentColor"})})}),M.jsx("button",{type:"button",className:St("activity-bar-item",r==="terminal"&&"active"),onClick:()=>i("terminal"),"aria-label":"Terminal",title:"Terminal (Ctrl+`)",children:M.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[M.jsx("path",{d:"M21 4H3a1 1 0 00-1 1v14a1 1 0 001 1h18a1 1 0 001-1V5a1 1 0 00-1-1zM4 18V6h16v12H4z",fill:"currentColor"}),M.jsx("path",{d:"M6.5 15.5L10 12 6.5 8.5 8 7l5 5-5 5-1.5-1.5z",fill:"currentColor"}),M.jsx("path",{d:"M13 14h5v2h-5z",fill:"currentColor"})]})}),M.jsx("button",{type:"button",className:St("activity-bar-item",r==="browser"&&"active"),onClick:()=>i("browser"),"aria-label":"Browser",title:"Browser",children:M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M12 2a10 10 0 100 20 10 10 0 000-20zm6.93 9h-3.02a15.7 15.7 0 00-1.12-5.03A8.03 8.03 0 0118.93 11zM12 4c.64 0 1.58 1.19 2.03 3.5.2 1.02.33 2.2.37 3.5H9.6c.04-1.3.17-2.48.37-3.5C10.42 5.19 11.36 4 12 4zM4.07 13h3.02c.11 1.9.5 3.64 1.12 5.03A8.03 8.03 0 014.07 13zm3.02-2H4.07a8.03 8.03 0 014.14-5.03A15.7 15.7 0 007.09 11zM12 20c-.64 0-1.58-1.19-2.03-3.5A18.4 18.4 0 019.6 13h4.8a18.4 18.4 0 01-.37 3.5C13.58 18.81 12.64 20 12 20zm3.79-1.97c.62-1.39 1.01-3.13 1.12-5.03h3.02a8.03 8.03 0 01-4.14 5.03z",fill:"currentColor"})})})]}),M.jsxs("div",{className:"activity-bar-bottom",children:[M.jsx("button",{type:"button",className:"activity-bar-item",onClick:_,"aria-label":"Toggle Theme",title:n==="dark"?"Switch to Light Theme":"Switch to Dark Theme",children:n==="dark"?M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58a.996.996 0 00-1.41 0 .996.996 0 000 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37a.996.996 0 00-1.41 0 .996.996 0 000 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 000-1.41l-1.06-1.06zm1.06-10.96a.996.996 0 000-1.41.996.996 0 00-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36a.996.996 0 000-1.41.996.996 0 00-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z",fill:"currentColor"})}):M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M12 3a9 9 0 109 9c0-.46-.04-.92-.1-1.36a5.389 5.389 0 01-4.4 2.26 5.403 5.403 0 01-3.14-9.8c-.44-.06-.9-.1-1.36-.1z",fill:"currentColor"})})}),M.jsx("button",{type:"button",className:"activity-bar-item",onClick:p,"aria-label":"Settings",title:"Settings",children:M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z",fill:"currentColor"})})})]})]})}const Ff=({message:r})=>r?M.jsx("div",{className:"status-float",role:"status",children:r}):null,Hf="",Vv="",$f="保存しました。",Kv="デッキを作成する前にワークスペースを追加してください。",qv="ワークスペースを選択してください。",Gv=2e3,zf='"JetBrains Mono", monospace',Uf=14,Yv='"Cascadia Code", "JetBrains Mono", "Consolas", "Menlo", "Noto Sans Mono CJK JP", "Source Han Mono", "MS Gothic", monospace',Xv=13,Bc="#000000",Wf="#ffffff",Pt=["#1e1e1e","#f44747","#23d18b","#e5c07b","#4aa5f0","#c586c0","#29b8db","#d4d4d4","#666666","#ff6e6e","#5ff967","#f5f543","#6ab7ff","#d670d6","#62e8f5","#ffffff"],Jv="#ffffff",Qv="#264f78",Vf="deck-theme",Zv=204;async function Ne(r,i={}){const n=await fetch(`${Hf}${r}`,{...i,credentials:"include"});if(!n.ok){const _=await n.text();throw new Error(_||`Request failed (${n.status})`)}return n.status===Zv?null:n.json()}const Wt="application/json",Ot="POST",Kf="PUT",Pn="DELETE";function eg(){return window.location.origin.replace(/^http/,"ws")}function Zo(){return Ne("/api/ws-token")}function qf(){return Ne("/api/workspaces")}function tg(){return Ne("/api/config")}function rg(r){return Ne("/api/workspaces",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({path:r})})}function ig(r){return Ne(`/api/workspaces/${r}`,{method:Pn})}function sg(){return Ne("/api/decks")}function ng(r,i){return Ne("/api/decks",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({name:r,workspaceId:i})})}function og(r){return Ne(`/api/decks/${r}`,{method:Pn})}function ag(r){return Ne("/api/decks/order",{method:Kf,headers:{"Content-Type":Wt},body:JSON.stringify({deckIds:r})})}function Pc(r,i=""){const n=new URLSearchParams({workspaceId:r,path:i});return Ne(`/api/files?${n.toString()}`)}function Md(r,i=""){const n=new URLSearchParams({path:r,subpath:i});return Ne(`/api/preview?${n.toString()}`)}function lg(r,i){const n=new URLSearchParams({workspaceId:r,path:i});return Ne(`/api/file?${n.toString()}`)}function cg(r,i,n){return Ne("/api/file",{method:Kf,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,path:i,contents:n})})}function hg(r,i,n=""){return Ne("/api/file",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,path:i,contents:n})})}function Gf(r,i){const n=new URLSearchParams({workspaceId:r,path:i});return Ne(`/api/file?${n.toString()}`,{method:Pn})}function Yf(r,i){return Ne("/api/dir",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,path:i})})}function Xf(r,i){const n=new URLSearchParams({workspaceId:r,path:i});return Ne(`/api/dir?${n.toString()}`,{method:Pn})}function ug(r,i,n,_=!1){return Ne("/api/move",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,from:i,to:n,overwrite:_})})}async function dg(r,i,n){const _=new FormData;_.append("workspaceId",r),_.append("path",i);for(const L of n)_.append("file",L);const p=await fetch(`${Hf}/api/upload`,{method:Ot,body:_,credentials:"include"});if(!p.ok){const L=await p.text();throw new Error(L||`Upload failed (${p.status})`)}return p.json()}function fg(r,i,n){return Ne("/api/terminals",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({deckId:r,title:i,command:n})})}function pg(r){const i=new URLSearchParams({deckId:r});return Ne(`/api/terminals?${i.toString()}`)}function _g(r){return Ne(`/api/terminals/${r}`,{method:Pn})}function vg(){return Ne("/api/browser/status")}function gg(){return Ne("/api/browser/start",{method:Ot})}function mg(){return Ne("/api/browser/stop",{method:Ot})}function yg(r){return Ne("/api/browser/navigate",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({url:r})})}function Jf(r,i){const n={workspaceId:r};i!==void 0&&(n.repoPath=i);const _=new URLSearchParams(n);return Ne(`/api/git/status?${_.toString()}`)}function wg(r){const i=new URLSearchParams({workspaceId:r});return Ne(`/api/git/repos?${i.toString()}`)}function Qf(r,i,n){return Ne("/api/git/stage",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,paths:i,repoPath:n})})}function Zf(r,i,n){return Ne("/api/git/unstage",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,paths:i,repoPath:n})})}function Sg(r,i,n){return Ne("/api/git/commit",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,message:i,repoPath:n})})}function Cg(r,i,n){return Ne("/api/git/discard",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,paths:i,repoPath:n})})}function xg(r,i,n,_){const p={workspaceId:r,path:i,staged:n.toString()};_!==void 0&&(p.repoPath=_);const L=new URLSearchParams(p);return Ne(`/api/git/diff?${L.toString()}`)}function bg(r,i){return Ne("/api/git/push",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,repoPath:i})})}function Eg(r,i){return Ne("/api/git/pull",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,repoPath:i})})}function kg(r,i){return Ne("/api/git/fetch",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,repoPath:i})})}function ep(r,i){const n={workspaceId:r};i!==void 0&&(n.repoPath=i);const _=new URLSearchParams(n);return Ne(`/api/git/branch-status?${_.toString()}`)}function tp(r,i){const n={workspaceId:r};i!==void 0&&(n.repoPath=i);const _=new URLSearchParams(n);return Ne(`/api/git/remotes?${_.toString()}`)}function Lg(r,i){const n={workspaceId:r};i!==void 0&&(n.repoPath=i);const _=new URLSearchParams(n);return Ne(`/api/git/branches?${_.toString()}`)}function Rg(r,i,n){return Ne("/api/git/checkout",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,branchName:i,repoPath:n})})}function Tg(r,i,n=!0,_){return Ne("/api/git/create-branch",{method:Ot,headers:{"Content-Type":Wt},body:JSON.stringify({workspaceId:r,branchName:i,checkout:n,repoPath:_})})}function Mg(r,i=50,n){const _={workspaceId:r,limit:String(i)};n!==void 0&&(_.repoPath=n);const p=new URLSearchParams(_);return Ne(`/api/git/log?${p.toString()}`)}const Dg='audio/webm; codecs="opus"',Ag=64;function Dd(r){let i=0;return r.altKey&&(i|=1),r.ctrlKey&&(i|=2),r.metaKey&&(i|=4),r.shiftKey&&(i|=8),i}function Sn(r){let i=0;return r.altKey&&(i|=1),r.ctrlKey&&(i|=2),r.metaKey&&(i|=4),r.shiftKey&&(i|=8),i}function Bg(r){return r===0?"left":r===1?"middle":r===2?"right":"none"}function Ad(r){return r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement||r instanceof HTMLElement&&r.isContentEditable}function Gc(r){return!r||r==="about:blank"}function Ms(r){return Gc(r)?null:r}function Bd(r){if(r.title.trim())return r.title.trim();if(r.url&&!Gc(r.url))try{return new URL(r.url).hostname||r.url}catch{return r.url}return"新しいタブ"}function Pg(r,i=2e3){return r.iceGatheringState==="complete"?Promise.resolve():new Promise(n=>{const _=()=>{r.removeEventListener("icegatheringstatechange",p),n()},p=()=>{r.iceGatheringState==="complete"&&_()};r.addEventListener("icegatheringstatechange",p),setTimeout(_,i)})}const Og=(()=>{try{return typeof window<"u"&&new URLSearchParams(window.location.search).get("webrtc")==="1"}catch{return!1}})();function Ng(){return Og}function rp({wsBase:r}){const i=$.useRef(null),n=$.useRef(null),_=$.useRef(null),p=$.useRef(null),L=$.useRef(null),R=$.useRef(null),o=$.useRef(null),d=$.useRef(null),v=$.useRef({width:0,height:0}),y=$.useRef(!1),f=$.useRef(null),S=$.useRef(!1),x=$.useRef(null),T=$.useRef(null),w=$.useRef(null),c=$.useRef(null),h=$.useRef([]),l=$.useRef({width:0,height:0}),u=$.useRef(!1),g=$.useRef("none"),C=$.useRef(null),k=$.useRef(0),D=$.useRef(null),E=$.useRef(null),[N,V]=$.useState(null),[q,O]=$.useState(""),[A,U]=$.useState(!1),[z,K]=$.useState(!1),[Y,W]=$.useState(!1),[B,I]=$.useState(!1),[P,H]=$.useState(!1),[J,se]=$.useState(null),[le,de]=$.useState(!1),[X,j]=$.useState(null),[ne,ee]=$.useState(null),ce=$.useCallback(oe=>{const ue=i.current;!ue||ue.readyState!==WebSocket.OPEN||ue.send(JSON.stringify(oe))},[]),ve=$.useCallback(()=>{const{width:oe,height:ue}=l.current;oe>0&&ue>0&&ce({type:"resize",width:oe,height:ue})},[ce]),ie=$.useCallback(()=>{S.current=!1,v.current={width:0,height:0},f.current=null,U(!1);const oe=o.current;oe&&d.current&&d.current.clearRect(0,0,oe.width,oe.height)},[]),pe=$.useCallback(oe=>{if(f.current=oe,y.current)return;const ue=()=>{const be=f.current;be!==null&&(f.current=null,y.current=!0,createImageBitmap(new Blob([be],{type:"image/jpeg"})).then(Oe=>{const Ke=o.current;if(!Ke){Oe.close();return}d.current||(d.current=Ke.getContext("2d"));const Fe=d.current;if(!Fe){Oe.close();return}(Ke.width!==Oe.width||Ke.height!==Oe.height)&&(Ke.width=Oe.width,Ke.height=Oe.height),v.current={width:Oe.width,height:Oe.height},Fe.drawImage(Oe,0,0),Oe.close(),S.current||(S.current=!0,U(!0)),E.current&&(clearTimeout(E.current),E.current=null),K(!1)}).catch(()=>{}).finally(()=>{y.current=!1,f.current!==null&&ue()}))};ue()},[]);$.useEffect(()=>{let oe=!0;return vg().then(ue=>{if(!oe)return;V(ue),se(ue.audio),D.current=ue.activeTabId;const be=Ms(ue.pageUrl);be&&O(be),ue.error&&j(ue.error)}).catch(ue=>{oe&&j(ue instanceof Error?ue.message:"Browser status failed")}),()=>{oe=!1}},[]),$.useEffect(()=>{const oe=R.current;if(!oe)return;const ue=new ResizeObserver(([be])=>{const Oe=Math.floor(be.contentRect.width),Ke=Math.floor(be.contentRect.height);Oe<=0||Ke<=0||l.current.width===Oe&&l.current.height===Ke||(l.current={width:Oe,height:Ke},ce({type:"resize",width:Oe,height:Ke}))});return ue.observe(oe),()=>ue.disconnect()},[ce]),$.useEffect(()=>{let oe=!1;const ue=()=>{C.current&&(clearTimeout(C.current),C.current=null)},be=async()=>{if(!oe){ue();try{const{token:Oe,authEnabled:Ke}=await Zo();if(oe)return;const Fe=`${r}/api/browser/ws`,Jt=Ke?`${Fe}?token=${encodeURIComponent(Oe)}`:Fe,ut=new WebSocket(Jt);ut.binaryType="arraybuffer",i.current=ut,ut.addEventListener("open",()=>{k.current=0,W(!0),j(null),ve()}),ut.addEventListener("message",gt=>{if(gt.data instanceof ArrayBuffer){pe(gt.data);return}if(typeof gt.data!="string")return;let Xe;try{Xe=JSON.parse(gt.data)}catch{return}if(Xe.type==="clear"){ie(),K(!0),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{E.current=null,K(!1)},2500);return}if(Xe.type==="status"){const Pe=Xe.status;if(V(Pe),se(Pe.audio),Pe.activeTabId!==D.current){D.current=Pe.activeTabId;const dt=Pe.tabs.find(rt=>rt.id===Pe.activeTabId);O(Ms(dt==null?void 0:dt.url)??"")}else{const dt=Ms(Pe.pageUrl);dt&&O(dt)}Pe.error&&j(Pe.error);return}Xe.type==="error"&&j(Xe.error)}),ut.addEventListener("close",()=>{if(i.current===ut&&(i.current=null),W(!1),oe)return;const gt=Math.min(k.current+1,6);k.current=gt,C.current=setTimeout(be,500*Math.pow(2,gt-1))}),ut.addEventListener("error",()=>{W(!1)})}catch(Oe){if(oe)return;j(Oe instanceof Error?Oe.message:"Browser connection failed");const Ke=Math.min(k.current+1,6);k.current=Ke,C.current=setTimeout(be,500*Math.pow(2,Ke-1))}}};return be(),()=>{oe=!0,ue(),i.current&&(i.current.close(),i.current=null)}},[ie,pe,ve,r]),$.useEffect(()=>()=>{E.current&&(clearTimeout(E.current),E.current=null)},[]),$.useEffect(()=>{if(!Ng())return;let oe=!1,ue=null,be=null;const Oe=()=>{if(ue){try{ue.close()}catch{}ue=null}if(be){try{be.close()}catch{}be=null}p.current=null,_.current=null,I(!1)};return(async()=>{try{const{token:Fe,authEnabled:Jt}=await Zo();if(oe)return;const ut=`${r}/api/browser/webrtc/ws`,gt=Jt?`${ut}?token=${encodeURIComponent(Fe)}`:ut;be=new WebSocket(gt),_.current=be,be.addEventListener("open",async()=>{var Xe;if(!(oe||!be)){ue=new RTCPeerConnection({iceServers:[]}),p.current=ue,ue.addTransceiver("video",{direction:"recvonly"}),ue.ontrack=Pe=>{const[dt]=Pe.streams,rt=L.current;rt&&dt&&(rt.srcObject=dt,rt.play().catch(()=>{}),I(!0))},ue.onconnectionstatechange=()=>{const Pe=ue==null?void 0:ue.connectionState;(Pe==="failed"||Pe==="disconnected"||Pe==="closed")&&I(!1)};try{const Pe=await ue.createOffer();if(await ue.setLocalDescription(Pe),await Pg(ue),oe||!be||be.readyState!==WebSocket.OPEN)return;be.send(JSON.stringify({type:"webrtc-offer",sdp:(Xe=ue.localDescription)==null?void 0:Xe.sdp}))}catch(Pe){oe||j(Pe instanceof Error?Pe.message:"WebRTC negotiation failed")}}}),be.addEventListener("message",async Xe=>{if(typeof Xe.data!="string")return;let Pe;try{Pe=JSON.parse(Xe.data)}catch{return}Pe.type==="webrtc-answer"&&Pe.sdp&&ue?await ue.setRemoteDescription({type:"answer",sdp:Pe.sdp}).catch(dt=>{oe||j(dt instanceof Error?dt.message:"setRemoteDescription failed")}):Pe.type==="webrtc-error"&&Pe.error&&j(Pe.error)}),be.addEventListener("close",()=>{I(!1)})}catch(Fe){oe||j(Fe instanceof Error?Fe.message:"WebRTC connection failed")}})(),()=>{oe=!0,Oe()}},[r]);const Re=$.useCallback(()=>{const oe=w.current;if(!oe||oe.updating)return;const ue=h.current.shift();if(ue)try{oe.appendBuffer(ue)}catch(be){h.current.unshift(ue),ee(be instanceof Error?be.message:"Browser audio append failed")}},[]),Te=$.useCallback(oe=>{const ue=oe.slice(0),be=w.current;if(!be||be.updating||h.current.length>0){h.current.length<Ag&&h.current.push(ue);return}try{be.appendBuffer(ue)}catch(Oe){ee(Oe instanceof Error?Oe.message:"Browser audio append failed")}},[]),ye=$.useCallback(()=>{const oe=n.current;n.current=null,oe&&oe.readyState!==WebSocket.CLOSED&&oe.readyState!==WebSocket.CLOSING&&oe.close(),h.current=[],w.current=null;const ue=T.current;if(T.current=null,(ue==null?void 0:ue.readyState)==="open")try{ue.endOfStream()}catch{}const be=x.current;be&&(be.pause(),be.removeAttribute("src"),be.load()),c.current&&(URL.revokeObjectURL(c.current),c.current=null),H(!1)},[]),Je=$.useCallback(async()=>{var Ke;if(((Ke=n.current)==null?void 0:Ke.readyState)===WebSocket.OPEN)return;const oe=(J==null?void 0:J.mimeType)||Dg;if(typeof MediaSource>"u"||!MediaSource.isTypeSupported(oe)){ee(`This browser cannot play ${oe}`),H(!1);return}ye(),ee(null),H(!0);const ue=new MediaSource;T.current=ue;const be=URL.createObjectURL(ue);c.current=be;const Oe=x.current;Oe&&(Oe.src=be,Oe.autoplay=!0,Oe.play().catch(()=>{})),ue.addEventListener("sourceopen",()=>{if(T.current===ue)try{const Fe=ue.addSourceBuffer(oe);Fe.mode="sequence",w.current=Fe,Fe.addEventListener("updateend",Re),Re()}catch(Fe){ee(Fe instanceof Error?Fe.message:"Browser audio setup failed"),H(!1)}},{once:!0});try{const{token:Fe,authEnabled:Jt}=await Zo(),ut=`${r}/api/browser/audio/ws`,gt=Jt?`${ut}?token=${encodeURIComponent(Fe)}`:ut,Xe=new WebSocket(gt);Xe.binaryType="arraybuffer",n.current=Xe,Xe.addEventListener("message",Pe=>{var dt;if(typeof Pe.data=="string"){let rt;try{rt=JSON.parse(Pe.data)}catch{return}if(rt.type==="audio-status"){se(rt.status),rt.status.error?ee(rt.status.error):rt.status.available&&ee(null);return}rt.type==="audio-error"&&(ee(rt.error),H(!1));return}Pe.data instanceof ArrayBuffer&&(Te(Pe.data),(dt=x.current)==null||dt.play().catch(()=>{}))}),Xe.addEventListener("close",()=>{n.current===Xe&&(n.current=null),H(!1)}),Xe.addEventListener("error",()=>{ee("Browser audio connection failed"),H(!1)})}catch(Fe){ye(),ee(Fe instanceof Error?Fe.message:"Browser audio failed")}},[Te,J,Re,ye,r]);$.useEffect(()=>()=>ye(),[ye]);const kt=$.useCallback(()=>{if(P||n.current){ye();return}Je()},[P,Je,ye]),Ct=$.useCallback(async()=>{de(!0),j(null);try{const oe=await gg();V(oe),se(oe.audio);const ue=Ms(oe.pageUrl);ue&&O(ue)}catch(oe){j(oe instanceof Error?oe.message:"Browser start failed")}finally{de(!1)}},[]),Qe=$.useCallback(async()=>{de(!0),j(null);try{const oe=await mg();V(oe),se(oe.audio),ie(),ye()}catch(oe){j(oe instanceof Error?oe.message:"Browser stop failed")}finally{de(!1)}},[ie,ye]),Ze=$.useCallback(async()=>{const oe=q.trim();if(oe){de(!0),j(null);try{const ue=await yg(oe);V(ue),se(ue.audio);const be=Ms(ue.pageUrl);be&&O(be)}catch(ue){j(ue instanceof Error?ue.message:"Navigate failed")}finally{de(!1)}}},[q]),et=$.useCallback(()=>{ce({type:"new-tab"})},[ce]),Vt=$.useCallback(oe=>{oe!==D.current&&ce({type:"activate-tab",targetId:oe})},[ce]),xt=$.useCallback(oe=>{ce({type:"close-tab",targetId:oe})},[ce]),at=$.useCallback((oe,ue)=>{var Or,pi;const be=L.current,Oe=!!(be&&be.videoWidth>0),Ke=Oe?be:o.current;if(!Ke)return null;const Fe=Ke.getBoundingClientRect();if(Fe.width<=0||Fe.height<=0)return null;const Jt=Oe?be.videoWidth||v.current.width||l.current.width||1280:v.current.width||((Or=o.current)==null?void 0:Or.width)||l.current.width||1280,ut=Oe?be.videoHeight||v.current.height||l.current.height||720:v.current.height||((pi=o.current)==null?void 0:pi.height)||l.current.height||720,gt=Math.min(Fe.width/Jt,Fe.height/ut),Xe=Jt*gt,Pe=ut*gt,dt=Fe.left+(Fe.width-Xe)/2,rt=Fe.top+(Fe.height-Pe)/2,Wr=Math.max(0,Math.min(Jt,(oe-dt)/Xe*Jt)),Qt=Math.max(0,Math.min(ut,(ue-rt)/Pe*ut));return{x:Wr,y:Qt}},[]),bt=$.useCallback(oe=>at(oe.clientX,oe.clientY),[at]),ht=$.useCallback(oe=>{const ue=bt(oe);ue&&ce({type:"mouse",eventType:"mouseMoved",x:ue.x,y:ue.y,button:u.current?g.current:"none",modifiers:Sn(oe)})},[bt,ce]),sr=$.useCallback(oe=>{var be;const ue=bt(oe);ue&&(oe.preventDefault(),(be=R.current)==null||be.focus({preventScroll:!0}),u.current=!0,g.current=Bg(oe.button),ce({type:"mouse",eventType:"mousePressed",x:ue.x,y:ue.y,button:g.current,clickCount:oe.detail||1,modifiers:Sn(oe)}))},[bt,ce]),_t=$.useCallback(oe=>{const ue=bt(oe);if(!ue)return;oe.preventDefault();const be=g.current;u.current=!1,g.current="none",ce({type:"mouse",eventType:"mouseReleased",x:ue.x,y:ue.y,button:be,clickCount:oe.detail||1,modifiers:Sn(oe)})},[bt,ce]);$.useEffect(()=>{const oe=ue=>{if(!u.current)return;const be=at(ue.clientX,ue.clientY),Oe=g.current;u.current=!1,g.current="none",be&&ce({type:"mouse",eventType:"mouseReleased",x:be.x,y:be.y,button:Oe,clickCount:1,modifiers:Sn(ue)})};return window.addEventListener("mouseup",oe),()=>window.removeEventListener("mouseup",oe)},[at,ce]);const Tt=$.useCallback(oe=>{const ue=bt(oe);ue&&(oe.preventDefault(),ce({type:"mouse",eventType:"mouseWheel",x:ue.x,y:ue.y,button:"none",deltaX:oe.deltaX,deltaY:oe.deltaY,modifiers:Sn(oe)}))},[bt,ce]),ze=$.useCallback(oe=>{if(Ad(oe.target))return;oe.preventDefault();const ue=!oe.ctrlKey&&!oe.metaKey&&!oe.altKey&&oe.key.length===1?oe.key:void 0;ce({type:"key",eventType:"keyDown",key:oe.key,code:oe.code,text:ue,modifiers:Dd(oe)})},[ce]),Pr=$.useCallback(oe=>{Ad(oe.target)||(oe.preventDefault(),ce({type:"key",eventType:"keyUp",key:oe.key,code:oe.code,modifiers:Dd(oe)}))},[ce]),xe=(J==null?void 0:J.reason)||ne||(P?"Stop audio":"Start audio"),Me=(N==null?void 0:N.running)??!1,Ve=(N==null?void 0:N.launching)??!1,Ge=(N==null?void 0:N.tabs)??[],Mt=(N==null?void 0:N.activeTabId)??null,He=A&&!Gc(N==null?void 0:N.pageUrl),vt=B||He?"page":!Me&&!Ve?"stopped":Ve?"launching":Y?z?"switching":"ready":"connecting",Ye=Y?Ve?"launching":P?"connected · audio":"connected":"offline";return M.jsxs("section",{className:"browser-layout",children:[M.jsxs("div",{className:"browser-toolbar",children:[M.jsxs("div",{className:"browser-address-group",children:[M.jsx("button",{type:"button",className:"browser-toolbar-button",onClick:Ct,disabled:le||(N==null?void 0:N.running),title:"Start","aria-label":"Start browser",children:"▶"}),M.jsx("button",{type:"button",className:"browser-toolbar-button",onClick:Qe,disabled:le||!(N!=null&&N.running),title:"Stop","aria-label":"Stop browser",children:"■"}),M.jsx("button",{type:"button",className:P?"browser-toolbar-button browser-toolbar-button-active":"browser-toolbar-button",onClick:kt,disabled:le||!(N!=null&&N.running),title:xe,"aria-label":"Browser audio",children:M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M4 9v6h4l5 4V5L8 9H4zm11.5-1.5v9a5 5 0 000-9zm2.5-2.5v14a8 8 0 000-14z",fill:"currentColor"})})}),M.jsx("button",{type:"button",className:"browser-toolbar-button",onClick:()=>ce({type:"back"}),disabled:!(N!=null&&N.running),title:"戻る","aria-label":"Back",children:"←"}),M.jsx("button",{type:"button",className:"browser-toolbar-button",onClick:()=>ce({type:"forward"}),disabled:!(N!=null&&N.running),title:"進む","aria-label":"Forward",children:"→"}),M.jsx("button",{type:"button",className:"browser-toolbar-button",onClick:()=>ce({type:"reload"}),disabled:!(N!=null&&N.running),title:"再読み込み","aria-label":"Reload",children:"⟳"}),M.jsxs("form",{className:"browser-address-form",onSubmit:oe=>{oe.preventDefault(),Ze()},children:[M.jsx("input",{className:"browser-address-input",value:q,onChange:oe=>O(oe.target.value),placeholder:"URLを入力 (例: example.com)",spellCheck:!1,autoCapitalize:"off",autoComplete:"off","aria-label":"URL"}),M.jsx("button",{type:"submit",className:"browser-go-button",disabled:le,title:"Go","aria-label":"Go",children:"→"})]})]}),M.jsxs("div",{className:"browser-status-line",title:(N==null?void 0:N.profileDir)||"",children:[M.jsx("span",{className:Me?"browser-dot browser-dot-running":"browser-dot"}),M.jsx("span",{children:Ye})]})]}),Me&&Ge.length>0&&M.jsxs("div",{className:"browser-tabs",role:"tablist",children:[Ge.map(oe=>M.jsxs("div",{role:"tab","aria-selected":oe.id===Mt,className:oe.id===Mt?"browser-tab browser-tab-active":"browser-tab",onClick:()=>Vt(oe.id),onAuxClick:ue=>{ue.button===1&&(ue.preventDefault(),xt(oe.id))},title:Ms(oe.url)??Bd(oe),children:[M.jsx("span",{className:"browser-tab-title",children:Bd(oe)}),M.jsx("button",{type:"button",className:"browser-tab-close",onClick:ue=>{ue.stopPropagation(),xt(oe.id)},title:"タブを閉じる","aria-label":"タブを閉じる",children:"×"})]},oe.id)),M.jsx("button",{type:"button",className:"browser-tab-new",onClick:et,title:"新しいタブ","aria-label":"新しいタブ",children:"+"})]}),(X||ne)&&M.jsx("div",{className:"browser-error",children:X||ne}),M.jsx("audio",{ref:x,className:"browser-audio"}),M.jsxs("div",{ref:R,className:"browser-viewport",tabIndex:0,onKeyDown:ze,onKeyUp:Pr,children:[M.jsx("canvas",{ref:o,className:"browser-frame",style:{display:!B&&vt==="page"?"block":"none"},onMouseMove:ht,onMouseDown:sr,onMouseUp:_t,onWheel:Tt,onContextMenu:oe=>oe.preventDefault()}),M.jsx("video",{ref:L,className:"browser-frame",style:{display:B?"block":"none"},autoPlay:!0,playsInline:!0,muted:!0,onMouseMove:ht,onMouseDown:sr,onMouseUp:_t,onWheel:Tt,onContextMenu:oe=>oe.preventDefault()}),vt==="stopped"&&M.jsxs("div",{className:"browser-state",children:[M.jsx("div",{className:"browser-state-title",children:"ブラウザは停止中です"}),M.jsx("button",{type:"button",className:"browser-state-action",onClick:Ct,disabled:le,children:"▶ 起動する"})]}),vt==="launching"&&M.jsxs("div",{className:"browser-state",children:[M.jsx("div",{className:"browser-spinner","aria-hidden":"true"}),M.jsx("div",{className:"browser-state-title",children:"ブラウザを起動中…"})]}),vt==="connecting"&&M.jsxs("div",{className:"browser-state",children:[M.jsx("div",{className:"browser-spinner","aria-hidden":"true"}),M.jsx("div",{className:"browser-state-title",children:"接続中…"})]}),vt==="switching"&&M.jsxs("div",{className:"browser-state",children:[M.jsx("div",{className:"browser-spinner","aria-hidden":"true"}),M.jsx("div",{className:"browser-state-title",children:"読み込み中…"})]}),vt==="ready"&&M.jsxs("div",{className:"browser-state",children:[M.jsx("div",{className:"browser-state-title",children:"準備完了"}),M.jsx("div",{className:"browser-state-hint",children:"上のバーにURLを入力してEnterでアクセスできます"})]})]})]})}const Ig="ワークスペースがありません。";function jg({workspaces:r,selectedWorkspaceId:i,onSelect:n,onDelete:_}){return M.jsx("div",{className:"w-full grid gap-2",children:r.length===0?M.jsx("div",{className:"flex items-center justify-center text-muted text-[13px] p-8",children:Ig}):r.map(p=>M.jsxs("div",{className:St("flex items-center gap-2 p-4 border border-border rounded bg-panel transition-colors hover:bg-list-hover",p.id===i&&"bg-list-active border-accent"),children:[M.jsxs("button",{type:"button",className:"flex-1 min-w-0 text-left bg-transparent border-0 p-0 cursor-pointer",onClick:()=>n(p.id),children:[M.jsx("div",{className:"font-semibold text-[15px] mb-1",children:p.name}),M.jsx("div",{className:"text-[12px] text-muted font-mono truncate",children:p.path})]}),M.jsx("button",{type:"button",className:"flex-shrink-0 w-7 h-7 flex items-center justify-center rounded bg-transparent border-0 text-muted cursor-pointer hover:bg-[rgba(0,0,0,0.08)] hover:text-ink transition-colors dark:hover:bg-[rgba(255,255,255,0.08)]",title:"\\u524a\\u9664",onClick:L=>{L.stopPropagation(),confirm(`「${p.name}」を削除しますか?`)&&_(p.id)},children:M.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[M.jsx("polyline",{points:"3 6 5 6 21 6"}),M.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]},p.id))})}function Fg({contextMenu:r,onNewFile:i,onNewFolder:n,onDelete:_}){var p;return M.jsxs("div",{className:"fixed z-[1000] min-w-[160px] py-1 bg-panel border border-border rounded-[6px] shadow-[0_4px_12px_rgba(0,0,0,0.15)]",style:{left:r.x,top:r.y},onClick:L=>L.stopPropagation(),children:[(r.isRoot||((p=r.node)==null?void 0:p.type)==="dir")&&M.jsxs(M.Fragment,{children:[M.jsx("button",{type:"button",className:"block w-full px-3 py-1.5 text-[13px] text-left bg-transparent border-0 text-ink cursor-pointer hover:bg-list-hover",onClick:()=>{var L;return i(((L=r.node)==null?void 0:L.path)||"",r.node?1:0)},children:"新規ファイル"}),M.jsx("button",{type:"button",className:"block w-full px-3 py-1.5 text-[13px] text-left bg-transparent border-0 text-ink cursor-pointer hover:bg-list-hover",onClick:()=>{var L;return n(((L=r.node)==null?void 0:L.path)||"",r.node?1:0)},children:"新規フォルダ"})]}),r.node&&!r.isRoot&&M.jsxs(M.Fragment,{children:[r.node.type==="dir"&&M.jsx("div",{className:"h-px my-1 bg-border"}),M.jsx("button",{type:"button",className:"block w-full px-3 py-1.5 text-[13px] text-left bg-transparent border-0 text-[#f14c4c] cursor-pointer hover:bg-[rgba(241,76,76,0.1)]",onClick:()=>_(r.node),children:"削除"})]})]})}const Pd="読み込み中...",Hg="ファイル",$g="更新",zg="ファイルが見つかりません。",Ug="戻る";function Wg(r,i){if(!i)return"";const n=i.find(_=>_.path===r||r.endsWith(_.path));return n?`git-tree-${n.status}`:""}const Vg=()=>M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:"tree-chevron-icon",children:M.jsx("path",{d:"M9 6l6 6-6 6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}),Od=()=>M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:"tree-svg",children:M.jsx("path",{d:"M3.5 7.5h6l2 2h9a1 1 0 0 1 1 1V18a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V7.5z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})}),Nd=()=>M.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:"tree-svg",children:[M.jsx("path",{d:"M6 3.5h8l4 4V20a1.5 1.5 0 0 1-1.5 1.5H6A1.5 1.5 0 0 1 4.5 20V5A1.5 1.5 0 0 1 6 3.5z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),M.jsx("path",{d:"M14 3.5V8h4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})]});function ip({root:r,entries:i=[],loading:n,error:_,mode:p="tree",canBack:L,onBack:R,onToggleDir:o,onOpenFile:d,onRefresh:v,onCreateFile:y,onCreateDirectory:f,onDeleteFile:S,onDeleteDirectory:x,gitFiles:T}){const[w,c]=$.useState(null),[h,l]=$.useState(null),[u,g]=$.useState(""),C=$.useRef(null),k=$.useRef(null),D=i??[];$.useEffect(()=>{const K=()=>c(null);if(w)return document.addEventListener("click",K),()=>document.removeEventListener("click",K)},[w]),$.useEffect(()=>{h&&C.current&&C.current.focus()},[h]);const E=$.useCallback((K,Y,W=!1)=>{K.preventDefault(),K.stopPropagation();const B=180,I=150,P=Math.min(K.clientX,window.innerWidth-B-4),H=Math.min(K.clientY,window.innerHeight-I-4);c({x:P,y:H,node:Y,isRoot:W})},[]),N=$.useCallback((K,Y)=>{c(null),l({parentPath:K,type:"file",depth:Y}),g("")},[]),V=$.useCallback((K,Y)=>{c(null),l({parentPath:K,type:"dir",depth:Y}),g("")},[]),q=$.useCallback(K=>{c(null),K.type==="dir"?window.confirm(`フォルダ "${K.name}" を削除しますか?
41
+ 中のファイルも全て削除されます。`)&&(x==null||x(K.path)):window.confirm(`ファイル "${K.name}" を削除しますか?`)&&(S==null||S(K.path))},[S,x]),O=$.useCallback(()=>{if(!h||!u.trim()){l(null);return}const K=u.trim();h.type==="file"?y==null||y(h.parentPath,K):f==null||f(h.parentPath,K),l(null),g("")},[h,u,y,f]),A=$.useCallback(K=>{K.key==="Enter"?O():K.key==="Escape"&&l(null)},[O]),U=K=>!h||h.depth!==K?null:M.jsxs("div",{className:"tree-row tree-input-row",style:{paddingLeft:12+K*16},children:[M.jsx("span",{className:"tree-icon","aria-hidden":"true",children:h.type==="dir"?M.jsx(Od,{}):M.jsx(Nd,{})}),M.jsx("input",{ref:C,type:"text",className:"tree-input",value:u,onChange:Y=>g(Y.target.value),onKeyDown:A,onBlur:O,placeholder:h.type==="dir"?"フォルダ名":"ファイル名"})]}),z=(K,Y)=>K.map(W=>{const B=W.type==="file"?Wg(W.path,T):"";return M.jsxs("div",{children:[M.jsxs("button",{type:"button",className:St("tree-row",W.type==="dir"&&"is-dir",p==="tree"&&W.expanded&&"is-open",B),style:{paddingLeft:12+Y*16},onClick:()=>W.type==="dir"?o(W):d(W),onContextMenu:I=>E(I,W),"aria-expanded":W.type==="dir"&&p==="tree"?W.expanded:void 0,title:W.path,children:[M.jsx("span",{className:"tree-chevron","aria-hidden":"true",children:W.type==="dir"?M.jsx(Vg,{}):null}),M.jsx("span",{className:`tree-icon ${W.type}`,"aria-hidden":"true",children:W.type==="dir"?M.jsx(Od,{}):M.jsx(Nd,{})}),M.jsx("span",{className:"tree-label",children:W.name}),W.loading?M.jsx("span",{className:"tree-meta",children:Pd}):null]}),p==="tree"&&W.expanded&&W.type==="dir"&&M.jsxs(M.Fragment,{children:[(h==null?void 0:h.parentPath)===W.path&&U(Y+1),W.children&&W.children.length>0&&z(W.children,Y+1)]})]},W.path)});return M.jsxs("section",{className:"panel file-tree",ref:k,children:[M.jsxs("div",{className:"panel-header",children:[M.jsxs("div",{children:[M.jsx("div",{className:"panel-title",children:Hg}),M.jsx("div",{className:"panel-subtitle",children:r})]}),M.jsxs("div",{className:"tree-actions",children:[R?M.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:R,disabled:L===!1,children:Ug}):null,M.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:v,children:$g})]})]}),M.jsxs("div",{className:"panel-body tree-body",onContextMenu:K=>E(K,null,!0),children:[n?M.jsx("div",{className:"tree-state",children:Pd}):null,_?M.jsx("div",{className:"tree-state text-[#f14c4c]",children:_}):null,D.length===0&&!n?M.jsx("div",{className:"tree-state",children:zg}):null,(h==null?void 0:h.parentPath)===""&&U(0),z(D,0)]}),w&&M.jsx(Fg,{contextMenu:w,onNewFile:N,onNewFolder:V,onDelete:q})]})}function na(){return{files:[],activeFileId:null,tree:[],treeLoading:!1,treeError:null}}function Dn(){return{terminals:[],activeTerminalId:null}}function sp(r,i){var n;return i&&r.some(_=>_.id===i)?i:((n=r[0])==null?void 0:n.id)??null}function Kg(r){const i=r.lastIndexOf(".");return i===-1||i===0?"":r.slice(i+1).toLowerCase()}function qg(r){const i=Kg(r);return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",json:"json",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",md:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",h:"c",hpp:"cpp",sh:"shell",bash:"shell",zsh:"shell",fish:"shell",xml:"xml",yaml:"yaml",yml:"yaml",toml:"toml",sql:"sql",graphql:"graphql",vue:"vue",svelte:"svelte",php:"php",r:"r",swift:"swift",kt:"kotlin",dart:"dart",lua:"lua",dockerfile:"dockerfile"}[i]||"plaintext"}function Ht(r){return r instanceof Error?r.message:String(r)}function oa(r){return r.map(i=>({...i,expanded:!1,loading:!1,children:i.type==="dir"?[]:void 0}))}function np(r){return qg(r)}function Oc(r,i,n){return i?r.map(_=>{if(_.path===i&&_.type==="dir"){const L=[..._.children||[],n].sort((R,o)=>R.type!==o.type?R.type==="dir"?-1:1:R.name.localeCompare(o.name));return{..._,children:L,expanded:!0}}return _.children?{..._,children:Oc(_.children,i,n)}:_}):[...r,n].sort((p,L)=>p.type!==L.type?p.type==="dir"?-1:1:p.name.localeCompare(L.name))}function Nc(r,i){return r.filter(n=>n.path===i?!1:(n.children&&(n.children=Nc(n.children,i)),!0))}function Bs(r,i,n){return r.map(_=>_.path===i?n(_):_.children?{..._,children:Bs(_.children,i,n)}:_)}function Id(r){return r.trim().replace(/[\\/]+$/,"").replace(/\\/g,"/").toLowerCase()}function Gg(r){return r.includes("\\")?"\\":"/"}function Yg(r,i){const n=Gg(r),_=r.replace(/[\\/]+$/,"");return _?`${_}${n}${i}`:i}function jd(r){const i=r.replace(/[\\/]+$/,"");if(!i)return r;if(/^[A-Za-z]:$/.test(i))return`${i}\\`;if(i==="/")return"/";const n=Math.max(i.lastIndexOf("/"),i.lastIndexOf("\\"));if(i.startsWith("/")&&n===0)return"/";if(n<=0)return i;const _=i.slice(0,n);return/^[A-Za-z]:$/.test(_)?`${_}\\`:_}function op(){if(typeof window>"u")return{view:"terminal",workspaceId:null,deckIds:[],workspaceMode:"list"};const r=new URLSearchParams(window.location.search),i=r.get("view"),n=r.get("mode"),_=r.get("decks")||r.get("deck"),p=_?_.split(",").filter(Boolean):[];return{view:i==="workspace"||i==="browser"?i:"terminal",workspaceId:r.get("workspace"),deckIds:p,workspaceMode:n==="editor"?"editor":"list"}}function Xg(){if(typeof window>"u")return"light";const r=window.localStorage.getItem(Vf);return r==="light"||r==="dark"?r:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Xt(r,i=1e4){return Promise.race([r,new Promise((n,_)=>setTimeout(()=>_(new Error("Request timeout")),i))])}const Jg=({isOpen:r,defaultRoot:i,onSubmit:n,onClose:_})=>{const[p,L]=$.useState(""),[R,o]=$.useState([]),[d,v]=$.useState(!1),[y,f]=$.useState(null),[S,x]=$.useState(!1),T=jf(r,_),w=p.trim()||i,c=$.useMemo(()=>w?jd(w)!==w:!1,[w]);$.useEffect(()=>{if(!r){o([]),v(!1),f(null);return}let C=!0;return v(!0),f(null),Md(w,"").then(k=>{C&&(o(oa(k)),v(!1))}).catch(k=>{C&&(f(Ht(k)),v(!1))}),()=>{C=!1}},[r,w]),$.useEffect(()=>{r&&(p.trim()||i&&L(i))},[i,r,p]);const h=()=>{r&&(v(!0),f(null),Md(w,"").then(C=>{o(oa(C)),v(!1)}).catch(C=>{f(Ht(C)),v(!1)}))},l=C=>{if(C.type!=="dir")return;const k=Yg(w,C.name);L(k)},u=()=>{if(!w)return;const C=jd(w);C&&C!==w&&L(C)},g=async C=>{if(C.preventDefault(),!S){x(!0);try{await n(p),L("")}finally{x(!1)}}};return r?M.jsx("div",{className:"fixed inset-0 bg-black/50 grid place-items-center z-[500]",role:"dialog","aria-modal":"true","aria-labelledby":"workspace-modal-title",children:M.jsxs("form",{className:"modal flex flex-col !overflow-hidden",ref:T,onSubmit:g,children:[M.jsx("div",{className:"text-[14px] font-semibold mb-3 shrink-0",id:"workspace-modal-title",children:"ワークスペース追加"}),M.jsxs("label",{className:"grid gap-1 text-xs shrink-0",children:[M.jsx("span",{children:"パス"}),M.jsx("input",{type:"text",className:"bg-panel border border-border rounded-[2px] px-2 py-1.5 text-[13px] font-mono text-ink focus:outline-none focus:border-focus",value:p,placeholder:i||"",required:!0,maxLength:500,onChange:C=>L(C.target.value)})]}),M.jsx("div",{className:"flex-1 min-h-0 mt-3",children:M.jsx(ip,{root:w,entries:R,loading:d,error:y,mode:"navigator",canBack:c,onBack:u,onToggleDir:l,onOpenFile:()=>{},onRefresh:h})}),M.jsxs("div",{className:"flex justify-end gap-2 mt-4 shrink-0",children:[M.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:_,disabled:S,children:"キャンセル"}),M.jsx("button",{type:"submit",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",disabled:S,children:S?"追加中...":"追加"})]})]})}):null},Qg="ステージ",Zg="アンステージ",em="変更を破棄",tm="差分を表示",rm={modified:"M",staged:"A",untracked:"U",deleted:"D",renamed:"R",conflicted:"C"};function Fd({file:r,onStage:i,onUnstage:n,onDiscard:_,onShowDiff:p}){const L=`git-${r.status}`,R=rm[r.status];return M.jsxs("div",{className:"git-file-row",children:[M.jsxs("button",{type:"button",className:"git-file-main",onClick:()=>p(r),title:tm,children:[M.jsx("span",{className:`git-status-badge ${L}`,children:R}),M.jsx("span",{className:"git-file-path",children:r.path})]}),M.jsx("div",{className:"git-file-actions",children:r.staged?M.jsx("button",{type:"button",className:"git-action-btn",onClick:()=>n(r.path),title:Zg,children:M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M19 13H5v-2h14v2z"})})}):M.jsxs(M.Fragment,{children:[M.jsx("button",{type:"button",className:"git-action-btn",onClick:()=>_(r.path),title:em,children:M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})}),M.jsx("button",{type:"button",className:"git-action-btn",onClick:()=>i(r.path),title:Qg,children:M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})})})]})})]})}const im="ステージ済みの変更",sm="変更",nm="コミット",om="コミットメッセージを入力...",am="変更はありません",lm="すべてステージ",cm="すべてアンステージ",Hd="Push",$d="Pull",hm="Pushing...",um="Pulling...";function dm({status:r,branchStatus:i,hasRemote:n,pushing:_,pulling:p,commitMessage:L,onCommitMessageChange:R,onCommit:o,onStageFile:d,onUnstageFile:v,onStageAll:y,onUnstageAll:f,onDiscardFile:S,onShowDiff:x,onPush:T,onPull:w}){const c=r.files.filter(C=>C.staged),h=r.files.filter(C=>!C.staged),l=r.files.length>0,u=c.length>0,g=$.useCallback(C=>{C.key==="Enter"&&(C.ctrlKey||C.metaKey)&&(C.preventDefault(),o())},[o]);return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex flex-col gap-2 px-3",children:[M.jsx("textarea",{className:"border border-border rounded-[2px] p-2 text-[13px] font-[inherit] bg-panel text-ink resize-y min-h-[50px] focus:outline-none focus:border-focus",placeholder:om,value:L,onChange:C=>R(C.target.value),onKeyDown:g,rows:3}),M.jsx("button",{type:"button",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",onClick:o,disabled:!u||!L.trim(),children:nm})]}),n&&M.jsxs("div",{className:"flex gap-2 px-3 py-2 border-b border-border",children:[M.jsxs("button",{type:"button",className:"flex-1 flex items-center justify-center gap-1.5 px-2.5 py-1.5 bg-transparent border border-border rounded-[2px] text-ink text-xs cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:w,disabled:p||_,title:i!=null&&i.behind?`${i.behind} commits behind`:$d,children:[M.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M12 4v12m0 0l-4-4m4 4l4-4M4 20h16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),p?um:$d,i!=null&&i.behind?` (${i.behind})`:""]}),M.jsxs("button",{type:"button",className:"flex-1 flex items-center justify-center gap-1.5 px-2.5 py-1.5 bg-transparent border border-border rounded-[2px] text-ink text-xs cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:T,disabled:_||p,title:i!=null&&i.ahead?`${i.ahead} commits ahead`:Hd,children:[M.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M12 20V8m0 0l4 4m-4-4l-4 4M4 4h16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),_?hm:Hd,i!=null&&i.ahead?` (${i.ahead})`:""]})]}),l?M.jsxs(M.Fragment,{children:[c.length>0&&M.jsxs("div",{className:"flex flex-col",children:[M.jsxs("div",{className:"flex items-center justify-between px-3 py-1",children:[M.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted",children:[im," (",c.length,")"]}),M.jsx("button",{type:"button",className:"w-[22px] h-[22px] p-0 border-0 rounded-[3px] bg-transparent text-ink-muted cursor-pointer flex items-center justify-center hover:bg-list-hover hover:text-ink",onClick:f,title:cm,children:M.jsx("svg",{className:"w-3.5 h-3.5 fill-current",viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M19 13H5v-2h14v2z"})})})]}),M.jsx("div",{className:"flex flex-col",children:c.map(C=>M.jsx(Fd,{file:C,onStage:d,onUnstage:v,onDiscard:S,onShowDiff:x},C.path))})]}),h.length>0&&M.jsxs("div",{className:"flex flex-col",children:[M.jsxs("div",{className:"flex items-center justify-between px-3 py-1",children:[M.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted",children:[sm," (",h.length,")"]}),M.jsx("button",{type:"button",className:"w-[22px] h-[22px] p-0 border-0 rounded-[3px] bg-transparent text-ink-muted cursor-pointer flex items-center justify-center hover:bg-list-hover hover:text-ink",onClick:y,title:lm,children:M.jsx("svg",{className:"w-3.5 h-3.5 fill-current",viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})})})]}),M.jsx("div",{className:"flex flex-col",children:h.map(C=>M.jsx(Fd,{file:C,onStage:d,onUnstage:v,onDiscard:S,onShowDiff:x},C.path))})]})]}):M.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:am})]})}const fm="読み込み中...",pm="新規ブランチ",_m="作成",vm="キャンセル";function gm({branches:r,branchesLoading:i,onCheckoutBranch:n,onCreateBranch:_}){const[p,L]=$.useState(!1),[R,o]=$.useState(""),d=$.useCallback(()=>{R.trim()&&(_(R.trim()),o(""),L(!1))},[R,_]),v=$.useCallback(y=>{y.key==="Enter"?(y.preventDefault(),d()):y.key==="Escape"&&(L(!1),o(""))},[d]);return M.jsxs("div",{className:"flex flex-col gap-2",children:[M.jsx("div",{className:"px-3 py-2 border-b border-border",children:p?M.jsxs("div",{className:"flex gap-1.5 items-center",children:[M.jsx("input",{type:"text",className:"flex-1 px-2 py-1 text-xs border border-border rounded-[2px] bg-panel text-ink font-mono focus:outline-none focus:border-focus",placeholder:"ブランチ名...",value:R,onChange:y=>o(y.target.value),onKeyDown:v,autoFocus:!0}),M.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:d,disabled:!R.trim(),children:_m}),M.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>{L(!1),o("")},children:vm})]}):M.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>L(!0),children:pm})}),i?M.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:fm}):M.jsx("div",{className:"flex flex-col",children:r.map(y=>M.jsxs("button",{type:"button",className:St("flex items-center gap-2 px-3 py-1.5 bg-transparent border-0 text-ink text-[13px] cursor-pointer text-left transition-colors hover:bg-list-hover disabled:cursor-default",y.current&&"bg-list-active cursor-default"),onClick:()=>!y.current&&n(y.name),disabled:y.current,children:[M.jsxs("svg",{className:"w-4 h-4 flex-shrink-0 text-ink-muted",viewBox:"0 0 24 24","aria-hidden":"true",children:[M.jsx("path",{d:"M6 3v12M18 9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zM6 21a3 3 0 1 1 0-6 3 3 0 0 1 0 6z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),M.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),M.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono",children:y.name}),y.current&&M.jsx("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 bg-accent text-white rounded-[3px]",children:"現在"})]},y.name))})]})}const mm="読み込み中...";function ym({logs:r,logsLoading:i}){return M.jsx("div",{className:"flex flex-col",children:i?M.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:mm}):r.length===0?M.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:"コミット履歴がありません"}):M.jsx("div",{className:"flex flex-col",children:r.map(n=>M.jsxs("div",{className:"flex flex-col gap-0.5 px-3 py-2 border-b border-border hover:bg-list-hover transition-colors",children:[M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsx("span",{className:"font-mono text-xs text-accent font-semibold",children:n.hashShort}),M.jsx("span",{className:"text-xs text-ink-muted",children:n.author})]}),M.jsx("div",{className:"text-[13px] text-ink overflow-hidden text-ellipsis whitespace-nowrap",children:n.message}),M.jsx("div",{className:"text-[11px] text-muted",children:new Date(n.date).toLocaleString()})]},n.hash))})})}const Cn="ソースコントロール",wm="Gitリポジトリではありません",Sm="ワークスペースを選択してください",Cm="読み込み中...",nc="更新",xm="変更",bm="ブランチ",Em="履歴",oc="border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",ac="flex items-center justify-center h-full text-muted text-[13px] p-5";function km({status:r,loading:i,error:n,workspaceId:_,branchStatus:p,hasRemote:L,pushing:R,pulling:o,branches:d,branchesLoading:v,logs:y,logsLoading:f,repos:S,selectedRepoPath:x,onSelectRepo:T,onRefresh:w,onStageFile:c,onUnstageFile:h,onStageAll:l,onUnstageAll:u,onCommit:g,onDiscardFile:C,onShowDiff:k,onPush:D,onPull:E,onLoadBranches:N,onCheckoutBranch:V,onCreateBranch:q,onLoadLogs:O}){const[A,U]=$.useState(""),[z,K]=$.useState("changes"),Y=$.useCallback(()=>{A.trim()&&(g(A.trim()),U(""))},[A,g]),W=$.useCallback(P=>{K(P),P==="branches"?N():P==="history"&&O()},[N,O]);if(!_)return M.jsxs("section",{className:"panel",children:[M.jsx("div",{className:"panel-header",children:M.jsx("div",{className:"panel-title",children:Cn})}),M.jsx("div",{className:"panel-body",children:M.jsx("div",{className:ac,children:Sm})})]});if(i)return M.jsxs("section",{className:"panel",children:[M.jsx("div",{className:"panel-header",children:M.jsx("div",{className:"panel-title",children:Cn})}),M.jsx("div",{className:"panel-body",children:M.jsx("div",{className:ac,children:Cm})})]});if(n)return M.jsxs("section",{className:"panel",children:[M.jsxs("div",{className:"panel-header",children:[M.jsx("div",{className:"panel-title",children:Cn}),M.jsx("button",{type:"button",className:oc,onClick:w,children:nc})]}),M.jsx("div",{className:"panel-body",children:M.jsx("div",{className:"flex items-center justify-center h-full text-[#f14c4c] text-[13px] p-5",children:n})})]});if(!(r!=null&&r.isGitRepo))return M.jsxs("section",{className:"panel",children:[M.jsxs("div",{className:"panel-header",children:[M.jsx("div",{className:"panel-title",children:Cn}),M.jsx("button",{type:"button",className:oc,onClick:w,children:nc})]}),M.jsx("div",{className:"panel-body",children:M.jsx("div",{className:ac,children:wm})})]});const B=r.files.length>0,I=S.length>1;return M.jsxs("section",{className:"panel",children:[M.jsxs("div",{className:"panel-header",children:[M.jsxs("div",{children:[M.jsx("div",{className:"panel-title",children:Cn}),M.jsxs("div",{className:"panel-subtitle flex items-center gap-1.5",children:[M.jsxs("svg",{viewBox:"0 0 24 24",className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":"true",children:[M.jsx("path",{d:"M6 3v12M18 9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zM6 21a3 3 0 1 1 0-6 3 3 0 0 1 0 6z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),M.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),r.branch]})]}),M.jsx("button",{type:"button",className:oc,onClick:w,children:nc})]}),I&&M.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-sidebar text-xs",children:[M.jsx("svg",{className:"w-3.5 h-3.5 text-muted flex-shrink-0",viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-6l-2-2H5a2 2 0 0 0-2 2z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),M.jsx("select",{className:"flex-1 min-w-0 bg-panel border border-border rounded-[2px] px-2 py-1 text-[12px] font-mono text-ink focus:outline-none focus:border-focus",value:x||"",onChange:P=>T(P.target.value),children:S.map(P=>M.jsxs("option",{value:P.path,children:[P.name," (",P.branch,") ",P.fileCount>0?`• ${P.fileCount}`:""]},P.path))}),M.jsxs("span",{className:"text-[11px] text-muted font-mono flex-shrink-0",children:[S.length," repos"]})]}),M.jsxs("div",{className:"git-tabs",children:[M.jsxs("button",{type:"button",className:St("git-tab",z==="changes"&&"active"),onClick:()=>W("changes"),children:[xm,B&&M.jsx("span",{className:"text-[10px] font-semibold bg-accent/20 text-accent rounded-full px-1.5 py-0.5 leading-none",children:r.files.length})]}),M.jsx("button",{type:"button",className:St("git-tab",z==="branches"&&"active"),onClick:()=>W("branches"),children:bm}),M.jsx("button",{type:"button",className:St("git-tab",z==="history"&&"active"),onClick:()=>W("history"),children:Em})]}),M.jsxs("div",{className:"panel-body",children:[z==="changes"&&M.jsx(dm,{status:r,branchStatus:p,hasRemote:L,pushing:R,pulling:o,commitMessage:A,onCommitMessageChange:U,onCommit:Y,onStageFile:c,onUnstageFile:h,onStageAll:l,onUnstageAll:u,onDiscardFile:C,onShowDiff:k,onPush:D,onPull:E}),z==="branches"&&M.jsx(gm,{branches:d,branchesLoading:v,onCheckoutBranch:V,onCreateBranch:q}),z==="history"&&M.jsx(ym,{logs:y,logsLoading:f})]})]})}function zd(r,i){(i==null||i>r.length)&&(i=r.length);for(var n=0,_=Array(i);n<i;n++)_[n]=r[n];return _}function Lm(r){if(Array.isArray(r))return r}function Rm(r,i,n){return(i=Om(i))in r?Object.defineProperty(r,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[i]=n,r}function Tm(r,i){var n=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(n!=null){var _,p,L,R,o=[],d=!0,v=!1;try{if(L=(n=n.call(r)).next,i!==0)for(;!(d=(_=L.call(n)).done)&&(o.push(_.value),o.length!==i);d=!0);}catch(y){v=!0,p=y}finally{try{if(!d&&n.return!=null&&(R=n.return(),Object(R)!==R))return}finally{if(v)throw p}}return o}}function Mm(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
42
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ud(r,i){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(r);i&&(_=_.filter(function(p){return Object.getOwnPropertyDescriptor(r,p).enumerable})),n.push.apply(n,_)}return n}function Wd(r){for(var i=1;i<arguments.length;i++){var n=arguments[i]!=null?arguments[i]:{};i%2?Ud(Object(n),!0).forEach(function(_){Rm(r,_,n[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Ud(Object(n)).forEach(function(_){Object.defineProperty(r,_,Object.getOwnPropertyDescriptor(n,_))})}return r}function Dm(r,i){if(r==null)return{};var n,_,p=Am(r,i);if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(r);for(_=0;_<L.length;_++)n=L[_],i.indexOf(n)===-1&&{}.propertyIsEnumerable.call(r,n)&&(p[n]=r[n])}return p}function Am(r,i){if(r==null)return{};var n={};for(var _ in r)if({}.hasOwnProperty.call(r,_)){if(i.indexOf(_)!==-1)continue;n[_]=r[_]}return n}function Bm(r,i){return Lm(r)||Tm(r,i)||Nm(r,i)||Mm()}function Pm(r,i){if(typeof r!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var _=n.call(r,i);if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}function Om(r){var i=Pm(r,"string");return typeof i=="symbol"?i:i+""}function Nm(r,i){if(r){if(typeof r=="string")return zd(r,i);var n={}.toString.call(r).slice(8,-1);return n==="Object"&&r.constructor&&(n=r.constructor.name),n==="Map"||n==="Set"?Array.from(r):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zd(r,i):void 0}}function Im(r,i,n){return i in r?Object.defineProperty(r,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[i]=n,r}function Vd(r,i){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(r);i&&(_=_.filter(function(p){return Object.getOwnPropertyDescriptor(r,p).enumerable})),n.push.apply(n,_)}return n}function Kd(r){for(var i=1;i<arguments.length;i++){var n=arguments[i]!=null?arguments[i]:{};i%2?Vd(Object(n),!0).forEach(function(_){Im(r,_,n[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Vd(Object(n)).forEach(function(_){Object.defineProperty(r,_,Object.getOwnPropertyDescriptor(n,_))})}return r}function jm(){for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];return function(_){return i.reduceRight(function(p,L){return L(p)},_)}}function Ln(r){return function i(){for(var n=this,_=arguments.length,p=new Array(_),L=0;L<_;L++)p[L]=arguments[L];return p.length>=r.length?r.apply(this,p):function(){for(var R=arguments.length,o=new Array(R),d=0;d<R;d++)o[d]=arguments[d];return i.apply(n,[].concat(p,o))}}}function aa(r){return{}.toString.call(r).includes("Object")}function Fm(r){return!Object.keys(r).length}function An(r){return typeof r=="function"}function Hm(r,i){return Object.prototype.hasOwnProperty.call(r,i)}function $m(r,i){return aa(i)||ji("changeType"),Object.keys(i).some(function(n){return!Hm(r,n)})&&ji("changeField"),i}function zm(r){An(r)||ji("selectorType")}function Um(r){An(r)||aa(r)||ji("handlerType"),aa(r)&&Object.values(r).some(function(i){return!An(i)})&&ji("handlersType")}function Wm(r){r||ji("initialIsRequired"),aa(r)||ji("initialType"),Fm(r)&&ji("initialContent")}function Vm(r,i){throw new Error(r[i]||r.default)}var Km={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},ji=Ln(Vm)(Km),Ko={changes:$m,selector:zm,handler:Um,initial:Wm};function qm(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ko.initial(r),Ko.handler(i);var n={current:r},_=Ln(Xm)(n,i),p=Ln(Ym)(n),L=Ln(Ko.changes)(r),R=Ln(Gm)(n);function o(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(y){return y};return Ko.selector(v),v(n.current)}function d(v){jm(_,p,L,R)(v)}return[o,d]}function Gm(r,i){return An(i)?i(r.current):i}function Ym(r,i){return r.current=Kd(Kd({},r.current),i),i}function Xm(r,i,n){return An(i)?i(r.current):Object.keys(n).forEach(function(_){var p;return(p=i[_])===null||p===void 0?void 0:p.call(i,r.current[_])}),n}var Jm={create:qm},Qm={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Zm(r){return function i(){for(var n=this,_=arguments.length,p=new Array(_),L=0;L<_;L++)p[L]=arguments[L];return p.length>=r.length?r.apply(this,p):function(){for(var R=arguments.length,o=new Array(R),d=0;d<R;d++)o[d]=arguments[d];return i.apply(n,[].concat(p,o))}}}function e0(r){return{}.toString.call(r).includes("Object")}function t0(r){return r||qd("configIsRequired"),e0(r)||qd("configType"),r.urls?(r0(),{paths:{vs:r.urls.monacoBase}}):r}function r0(){console.warn(ap.deprecation)}function i0(r,i){throw new Error(r[i]||r.default)}var ap={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
43
+ You are using deprecated way of configuration.
44
+
45
+ Instead of using
46
+ monaco.config({ urls: { monacoBase: '...' } })
47
+ use
48
+ monaco.config({ paths: { vs: '...' } })
49
+
50
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
51
+ `},qd=Zm(i0)(ap),s0={config:t0},n0=function(){for(var i=arguments.length,n=new Array(i),_=0;_<i;_++)n[_]=arguments[_];return function(p){return n.reduceRight(function(L,R){return R(L)},p)}};function lp(r,i){return Object.keys(i).forEach(function(n){i[n]instanceof Object&&r[n]&&Object.assign(i[n],lp(r[n],i[n]))}),Wd(Wd({},r),i)}var o0={type:"cancelation",msg:"operation is manually canceled"};function lc(r){var i=!1,n=new Promise(function(_,p){r.then(function(L){return i?p(o0):_(L)}),r.catch(p)});return n.cancel=function(){return i=!0},n}var a0=["monaco"],l0=Jm.create({config:Qm,isInitialized:!1,resolve:null,reject:null,monaco:null}),cp=Bm(l0,2),On=cp[0],ua=cp[1];function c0(r){var i=s0.config(r),n=i.monaco,_=Dm(i,a0);ua(function(p){return{config:lp(p.config,_),monaco:n}})}function h0(){var r=On(function(i){var n=i.monaco,_=i.isInitialized,p=i.resolve;return{monaco:n,isInitialized:_,resolve:p}});if(!r.isInitialized){if(ua({isInitialized:!0}),r.monaco)return r.resolve(r.monaco),lc(cc);if(window.monaco&&window.monaco.editor)return hp(window.monaco),r.resolve(window.monaco),lc(cc);n0(u0,f0)(p0)}return lc(cc)}function u0(r){return document.body.appendChild(r)}function d0(r){var i=document.createElement("script");return r&&(i.src=r),i}function f0(r){var i=On(function(_){var p=_.config,L=_.reject;return{config:p,reject:L}}),n=d0("".concat(i.config.paths.vs,"/loader.js"));return n.onload=function(){return r()},n.onerror=i.reject,n}function p0(){var r=On(function(n){var _=n.config,p=n.resolve,L=n.reject;return{config:_,resolve:p,reject:L}}),i=window.require;i.config(r.config),i(["vs/editor/editor.main"],function(n){var _=n.m||n;hp(_),r.resolve(_)},function(n){r.reject(n)})}function hp(r){On().monaco||ua({monaco:r})}function _0(){return On(function(r){var i=r.monaco;return i})}var cc=new Promise(function(r,i){return ua({resolve:r,reject:i})}),up={config:c0,init:h0,__getMonacoInstance:_0},v0={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},hc=v0,g0={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},m0=g0;function y0({children:r}){return ts.createElement("div",{style:m0.container},r)}var w0=y0,S0=w0;function C0({width:r,height:i,isEditorReady:n,loading:_,_ref:p,className:L,wrapperProps:R}){return ts.createElement("section",{style:{...hc.wrapper,width:r,height:i},...R},!n&&ts.createElement(S0,null,_),ts.createElement("div",{ref:p,style:{...hc.fullWidth,...!n&&hc.hide},className:L}))}var x0=C0,dp=$.memo(x0);function b0(r){$.useEffect(r,[])}var fp=b0;function E0(r,i,n=!0){let _=$.useRef(!0);$.useEffect(_.current||!n?()=>{_.current=!1}:r,i)}var Sr=E0;function Mn(){}function Os(r,i,n,_){return k0(r,_)||L0(r,i,n,_)}function k0(r,i){return r.editor.getModel(pp(r,i))}function L0(r,i,n,_){return r.editor.createModel(i,n,_?pp(r,_):void 0)}function pp(r,i){return r.Uri.parse(i)}function R0({original:r,modified:i,language:n,originalLanguage:_,modifiedLanguage:p,originalModelPath:L,modifiedModelPath:R,keepCurrentOriginalModel:o=!1,keepCurrentModifiedModel:d=!1,theme:v="light",loading:y="Loading...",options:f={},height:S="100%",width:x="100%",className:T,wrapperProps:w={},beforeMount:c=Mn,onMount:h=Mn}){let[l,u]=$.useState(!1),[g,C]=$.useState(!0),k=$.useRef(null),D=$.useRef(null),E=$.useRef(null),N=$.useRef(h),V=$.useRef(c),q=$.useRef(!1);fp(()=>{let z=up.init();return z.then(K=>(D.current=K)&&C(!1)).catch(K=>(K==null?void 0:K.type)!=="cancelation"&&console.error("Monaco initialization: error:",K)),()=>k.current?U():z.cancel()}),Sr(()=>{if(k.current&&D.current){let z=k.current.getOriginalEditor(),K=Os(D.current,r||"",_||n||"text",L||"");K!==z.getModel()&&z.setModel(K)}},[L],l),Sr(()=>{if(k.current&&D.current){let z=k.current.getModifiedEditor(),K=Os(D.current,i||"",p||n||"text",R||"");K!==z.getModel()&&z.setModel(K)}},[R],l),Sr(()=>{let z=k.current.getModifiedEditor();z.getOption(D.current.editor.EditorOption.readOnly)?z.setValue(i||""):i!==z.getValue()&&(z.executeEdits("",[{range:z.getModel().getFullModelRange(),text:i||"",forceMoveMarkers:!0}]),z.pushUndoStop())},[i],l),Sr(()=>{var z,K;(K=(z=k.current)==null?void 0:z.getModel())==null||K.original.setValue(r||"")},[r],l),Sr(()=>{let{original:z,modified:K}=k.current.getModel();D.current.editor.setModelLanguage(z,_||n||"text"),D.current.editor.setModelLanguage(K,p||n||"text")},[n,_,p],l),Sr(()=>{var z;(z=D.current)==null||z.editor.setTheme(v)},[v],l),Sr(()=>{var z;(z=k.current)==null||z.updateOptions(f)},[f],l);let O=$.useCallback(()=>{var Y;if(!D.current)return;V.current(D.current);let z=Os(D.current,r||"",_||n||"text",L||""),K=Os(D.current,i||"",p||n||"text",R||"");(Y=k.current)==null||Y.setModel({original:z,modified:K})},[n,i,p,r,_,L,R]),A=$.useCallback(()=>{var z;!q.current&&E.current&&(k.current=D.current.editor.createDiffEditor(E.current,{automaticLayout:!0,...f}),O(),(z=D.current)==null||z.editor.setTheme(v),u(!0),q.current=!0)},[f,v,O]);$.useEffect(()=>{l&&N.current(k.current,D.current)},[l]),$.useEffect(()=>{!g&&!l&&A()},[g,l,A]);function U(){var K,Y,W,B;let z=(K=k.current)==null?void 0:K.getModel();o||((Y=z==null?void 0:z.original)==null||Y.dispose()),d||((W=z==null?void 0:z.modified)==null||W.dispose()),(B=k.current)==null||B.dispose()}return ts.createElement(dp,{width:x,height:S,isEditorReady:l,loading:y,_ref:E,className:T,wrapperProps:w})}var T0=R0,M0=$.memo(T0);function D0(r){let i=$.useRef();return $.useEffect(()=>{i.current=r},[r]),i.current}var A0=D0,qo=new Map;function B0({defaultValue:r,defaultLanguage:i,defaultPath:n,value:_,language:p,path:L,theme:R="light",line:o,loading:d="Loading...",options:v={},overrideServices:y={},saveViewState:f=!0,keepCurrentModel:S=!1,width:x="100%",height:T="100%",className:w,wrapperProps:c={},beforeMount:h=Mn,onMount:l=Mn,onChange:u,onValidate:g=Mn}){let[C,k]=$.useState(!1),[D,E]=$.useState(!0),N=$.useRef(null),V=$.useRef(null),q=$.useRef(null),O=$.useRef(l),A=$.useRef(h),U=$.useRef(),z=$.useRef(_),K=A0(L),Y=$.useRef(!1),W=$.useRef(!1);fp(()=>{let P=up.init();return P.then(H=>(N.current=H)&&E(!1)).catch(H=>(H==null?void 0:H.type)!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>V.current?I():P.cancel()}),Sr(()=>{var H,J,se,le;let P=Os(N.current,r||_||"",i||p||"",L||n||"");P!==((H=V.current)==null?void 0:H.getModel())&&(f&&qo.set(K,(J=V.current)==null?void 0:J.saveViewState()),(se=V.current)==null||se.setModel(P),f&&((le=V.current)==null||le.restoreViewState(qo.get(L))))},[L],C),Sr(()=>{var P;(P=V.current)==null||P.updateOptions(v)},[v],C),Sr(()=>{!V.current||_===void 0||(V.current.getOption(N.current.editor.EditorOption.readOnly)?V.current.setValue(_):_!==V.current.getValue()&&(W.current=!0,V.current.executeEdits("",[{range:V.current.getModel().getFullModelRange(),text:_,forceMoveMarkers:!0}]),V.current.pushUndoStop(),W.current=!1))},[_],C),Sr(()=>{var H,J;let P=(H=V.current)==null?void 0:H.getModel();P&&p&&((J=N.current)==null||J.editor.setModelLanguage(P,p))},[p],C),Sr(()=>{var P;o!==void 0&&((P=V.current)==null||P.revealLine(o))},[o],C),Sr(()=>{var P;(P=N.current)==null||P.editor.setTheme(R)},[R],C);let B=$.useCallback(()=>{var P;if(!(!q.current||!N.current)&&!Y.current){A.current(N.current);let H=L||n,J=Os(N.current,_||r||"",i||p||"",H||"");V.current=(P=N.current)==null?void 0:P.editor.create(q.current,{model:J,automaticLayout:!0,...v},y),f&&V.current.restoreViewState(qo.get(H)),N.current.editor.setTheme(R),o!==void 0&&V.current.revealLine(o),k(!0),Y.current=!0}},[r,i,n,_,p,L,v,y,f,R,o]);$.useEffect(()=>{C&&O.current(V.current,N.current)},[C]),$.useEffect(()=>{!D&&!C&&B()},[D,C,B]),z.current=_,$.useEffect(()=>{var P,H;C&&u&&((P=U.current)==null||P.dispose(),U.current=(H=V.current)==null?void 0:H.onDidChangeModelContent(J=>{W.current||u(V.current.getValue(),J)}))},[C,u]),$.useEffect(()=>{if(C){let P=N.current.editor.onDidChangeMarkers(H=>{var se;let J=(se=V.current.getModel())==null?void 0:se.uri;if(J&&H.find(le=>le.path===J.path)){let le=N.current.editor.getModelMarkers({resource:J});g==null||g(le)}});return()=>{P==null||P.dispose()}}return()=>{}},[C,g]);function I(){var P,H;(P=U.current)==null||P.dispose(),S?f&&qo.set(L,V.current.saveViewState()):(H=V.current.getModel())==null||H.dispose(),V.current.dispose()}return ts.createElement(dp,{width:x,height:T,isEditorReady:C,loading:d,_ref:q,className:w,wrapperProps:c})}var P0=B0,O0=$.memo(P0),N0=O0;const Gd="ファイルを選択してください",I0="vs-dark",j0="vs";function F0(r){var _;const i=((_=r.split(".").pop())==null?void 0:_.toLowerCase())||"";return{ts:{icon:"TS",color:"#3178c6"},tsx:{icon:"TSX",color:"#3178c6"},js:{icon:"JS",color:"#f7df1e"},jsx:{icon:"JSX",color:"#61dafb"},json:{icon:"{ }",color:"#cbcb41"},html:{icon:"<>",color:"#e34c26"},css:{icon:"#",color:"#264de4"},scss:{icon:"S",color:"#cc6699"},md:{icon:"M↓",color:"#083fa1"},py:{icon:"PY",color:"#3776ab"},go:{icon:"GO",color:"#00add8"},rs:{icon:"RS",color:"#dea584"},java:{icon:"J",color:"#b07219"},sql:{icon:"SQL",color:"#e38c00"},yml:{icon:"Y",color:"#cb171e"},yaml:{icon:"Y",color:"#cb171e"},sh:{icon:"$",color:"#89e051"},bash:{icon:"$",color:"#89e051"},txt:{icon:"TXT",color:"#6a737d"}}[i]||{icon:"📄",color:"var(--ink-muted)"}}function H0(r){return{typescript:"TypeScript",typescriptreact:"TypeScript React",javascript:"JavaScript",javascriptreact:"JavaScript React",json:"JSON",html:"HTML",css:"CSS",scss:"SCSS",markdown:"Markdown",python:"Python",go:"Go",rust:"Rust",java:"Java",sql:"SQL",yaml:"YAML",shell:"Shell",plaintext:"Plain Text"}[r]||r}function $0({files:r,activeFileId:i,onSelectFile:n,onCloseFile:_,onChangeFile:p,onSaveFile:L,savingFileId:R,theme:o}){const d=r.find(w=>w.id===i),v=$.useRef(null),[y,f]=$.useState({line:1,column:1}),S=$.useCallback(w=>{v.current=w,w.onDidChangeCursorPosition(c=>{f({line:c.position.lineNumber,column:c.position.column})})},[]);$.useEffect(()=>{const w=c=>{!i||!((c.ctrlKey||c.metaKey)&&c.key.toLowerCase()==="s")||(c.preventDefault(),L==null||L(i))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[i,L]);const x=(w,c)=>{w.stopPropagation(),_(c)},T=(w,c)=>{w.button===1&&(w.preventDefault(),_(c))};return r.length===0?M.jsx("div",{className:"editor-container editor-empty",children:M.jsxs("div",{className:"editor-welcome",children:[M.jsx("div",{className:"editor-welcome-icon",children:M.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[M.jsx("path",{d:"M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),M.jsx("polyline",{points:"13 2 13 9 20 9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),M.jsx("div",{className:"editor-welcome-text",children:Gd}),M.jsx("div",{className:"editor-welcome-hint",children:"左のファイルツリーからファイルを選択"})]})}):M.jsxs("div",{className:"editor-container",children:[M.jsx("div",{className:"editor-tabs",children:M.jsx("div",{className:"editor-tabs-list",children:r.map(w=>{const{icon:c,color:h}=F0(w.name),l=w.id===i,u=R===w.id;return M.jsxs("div",{className:St("editor-tab",l&&"active",w.dirty&&"dirty"),onClick:()=>n(w.id),onMouseDown:g=>T(g,w.id),role:"tab","aria-selected":l,tabIndex:0,children:[M.jsx("span",{className:"editor-tab-icon",style:{color:h},children:c}),M.jsx("span",{className:"editor-tab-name",children:w.name}),w.dirty&&!u&&M.jsx("span",{className:"editor-tab-dirty","aria-label":"未保存",children:"●"}),u&&M.jsx("span",{className:"editor-tab-saving","aria-label":"保存中",children:M.jsx("svg",{viewBox:"0 0 24 24",className:"spin",children:M.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"30 70"})})}),M.jsx("button",{type:"button",className:"editor-tab-close",onClick:g=>x(g,w.id),"aria-label":"閉じる",children:M.jsx("svg",{viewBox:"0 0 24 24",children:M.jsx("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]},w.id)})})}),d&&M.jsx("div",{className:"editor-breadcrumb",children:M.jsx("span",{className:"editor-breadcrumb-path",children:d.path})}),M.jsx("div",{className:"editor-content",children:d?M.jsx(N0,{height:"100%",theme:o==="dark"?I0:j0,language:d.language,value:d.contents,onChange:w=>p(d.id,w??""),onMount:S,options:{fontFamily:zf,fontSize:Uf,fontLigatures:!0,minimap:{enabled:!0,scale:1,showSlider:"mouseover"},smoothScrolling:!0,cursorBlinking:"smooth",cursorSmoothCaretAnimation:"on",renderLineHighlight:"all",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:8,bottom:8},lineNumbers:"on",renderWhitespace:"selection",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0}}}):M.jsx("div",{className:"editor-no-file",children:M.jsx("span",{children:Gd})})}),d&&M.jsxs("div",{className:"editor-statusbar",children:[M.jsx("div",{className:"editor-statusbar-left",children:M.jsxs("span",{className:"editor-status-item",children:[M.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[M.jsx("path",{d:"M6 3v12M18 9a3 3 0 110 6 3 3 0 010-6zM6 21a3 3 0 110-6 3 3 0 010 6z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),M.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),"main"]})}),M.jsxs("div",{className:"editor-statusbar-right",children:[M.jsxs("span",{className:"editor-status-item",children:["Ln ",y.line,", Col ",y.column]}),M.jsx("span",{className:"editor-status-item",children:"UTF-8"}),M.jsx("span",{className:"editor-status-item",children:H0(d.language)})]})]})]})}const z0="差分ビューア",U0="読み込み中...",W0="閉じる",V0="vs-dark",K0="vs";function q0({diff:r,loading:i,theme:n,onClose:_}){const p=r?np(r.path):"plaintext";return M.jsxs("div",{className:"fixed inset-0 bg-bg z-50 grid grid-rows-[35px_minmax(0,1fr)]",children:[M.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 bg-title-bar border-b border-border",children:[M.jsxs("div",{children:[M.jsx("div",{className:"text-[13px] font-medium",children:z0}),r&&M.jsx("div",{className:"text-xs text-muted font-mono",children:r.path})]}),M.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:_,children:W0})]}),M.jsx("div",{className:"min-h-0 overflow-hidden",children:i?M.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:U0}):r?M.jsx(M0,{height:"100%",theme:n==="dark"?V0:K0,language:p,original:r.original,modified:r.modified,options:{fontFamily:zf,fontSize:Uf,readOnly:!0,renderSideBySide:!0,minimap:{enabled:!1},smoothScrolling:!0}}):null})]})}function G0({activeWorkspace:r,defaultRoot:i,activeWorkspaceState:n,editorWorkspaceId:_,gitState:p,theme:L,savingFileId:R,onCloseWorkspaceEditor:o,onToggleDir:d,onOpenFile:v,onRefreshTree:y,onCreateFile:f,onCreateDirectory:S,onDeleteFile:x,onDeleteDirectory:T,onRefreshGit:w,onSelectRepo:c,onStageFile:h,onUnstageFile:l,onStageAll:u,onUnstageAll:g,onCommit:C,onDiscardFile:k,onShowDiff:D,onCloseDiff:E,onPush:N,onPull:V,onLoadBranches:q,onCheckoutBranch:O,onCreateBranch:A,onLoadLogs:U,onSelectFile:z,onCloseFile:K,onChangeFile:Y,onSaveFile:W}){var le,de;const[B,I]=$.useState(!1),[P,H]=$.useState("files"),J=$.useCallback(X=>{v(X),I(!1)},[v]),se=((le=p.status)==null?void 0:le.files.length)??0;return M.jsxs("div",{className:St("workspace-editor-overlay",B&&"drawer-open"),children:[M.jsxs("div",{className:"workspace-editor-header",children:[M.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:o,children:"一覧に戻る"}),M.jsx("button",{type:"button",className:"sidebar-toggle-btn bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover min-h-[44px] min-w-[44px]",onClick:()=>I(X=>!X),"aria-label":"\\u30b5\\u30a4\\u30c9\\u30d0\\u30fc",children:M.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:M.jsx("path",{d:"M3 12h18M3 6h18M3 18h18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}),M.jsx("div",{className:"workspace-meta",children:r?r.path:null})]}),M.jsxs("div",{className:"workspace-editor-grid",children:[M.jsxs("div",{className:"activity-bar",children:[M.jsx("button",{type:"button",className:St("activity-bar-item",P==="files"&&"active"),onClick:()=>H("files"),title:"エクスプローラー",children:M.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:M.jsx("path",{d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),M.jsxs("button",{type:"button",className:St("activity-bar-item",P==="git"&&"active"),onClick:()=>{H("git"),w()},title:"ソースコントロール",children:[M.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[M.jsx("path",{d:"M6 3v12M18 9a3 3 0 110 6 3 3 0 010-6zM6 21a3 3 0 110-6 3 3 0 010 6z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),M.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]}),se>0&&M.jsx("span",{className:"activity-bar-badge",children:se})]})]}),M.jsx("div",{className:"sidebar-panel",children:M.jsx("div",{className:"sidebar-content",children:P==="files"?M.jsx(ip,{root:(r==null?void 0:r.path)||i||"",entries:n.tree,loading:n.treeLoading,error:n.treeError,onToggleDir:d,onOpenFile:J,onRefresh:y,onCreateFile:f,onCreateDirectory:S,onDeleteFile:x,onDeleteDirectory:T,gitFiles:(de=p.status)==null?void 0:de.files}):M.jsx(km,{status:p.status,loading:p.loading,error:p.error,workspaceId:_,branchStatus:p.branchStatus,hasRemote:p.hasRemote,pushing:p.pushing,pulling:p.pulling,branches:p.branches,branchesLoading:p.branchesLoading,logs:p.logs,logsLoading:p.logsLoading,repos:p.repos,selectedRepoPath:p.selectedRepoPath,onSelectRepo:c,onRefresh:w,onStageFile:h,onUnstageFile:l,onStageAll:u,onUnstageAll:g,onCommit:C,onDiscardFile:k,onShowDiff:D,onPush:N,onPull:V,onLoadBranches:q,onCheckoutBranch:O,onCreateBranch:A,onLoadLogs:U})})}),M.jsx($0,{files:n.files,activeFileId:n.activeFileId,onSelectFile:z,onCloseFile:K,onChangeFile:Y,onSaveFile:W,savingFileId:R,theme:L})]}),M.jsx("div",{className:"sidebar-overlay",onClick:()=>I(!1),"aria-hidden":"true"}),p.diffPath&&M.jsx(q0,{diff:p.diff,loading:p.diffLoading,theme:L,onClose:E})]})}var uc={exports:{}},Yd;function Y0(){return Yd||(Yd=1,(function(r,i){(function(n,_){r.exports=_()})(globalThis,(()=>(()=>{var n={4567:function(R,o,d){var v=this&&this.__decorate||function(l,u,g,C){var k,D=arguments.length,E=D<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(l,u,g,C);else for(var N=l.length-1;N>=0;N--)(k=l[N])&&(E=(D<3?k(E):D>3?k(u,g,E):k(u,g))||E);return D>3&&E&&Object.defineProperty(u,g,E),E},y=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const f=d(9042),S=d(9924),x=d(844),T=d(4725),w=d(2585),c=d(3656);let h=o.AccessibilityManager=class extends x.Disposable{constructor(l,u,g,C){super(),this._terminal=l,this._coreBrowserService=g,this._renderService=C,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let k=0;k<this._terminal.rows;k++)this._rowElements[k]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[k]);if(this._topBoundaryFocusListener=k=>this._handleBoundaryFocus(k,0),this._bottomBoundaryFocusListener=k=>this._handleBoundaryFocus(k,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new S.TimeBasedDebouncer(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((k=>this._handleResize(k.rows)))),this.register(this._terminal.onRender((k=>this._refreshRows(k.start,k.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((k=>this._handleChar(k)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
52
+ `)))),this.register(this._terminal.onA11yTab((k=>this._handleTab(k)))),this.register(this._terminal.onKey((k=>this._handleKey(k.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,c.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,x.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(l){for(let u=0;u<l;u++)this._handleChar(" ")}_handleChar(l){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==l&&(this._charsToAnnounce+=l):this._charsToAnnounce+=l,l===`
53
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=f.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(l){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(l)||this._charsToConsume.push(l)}_refreshRows(l,u){this._liveRegionDebouncer.refresh(l,u,this._terminal.rows)}_renderRows(l,u){const g=this._terminal.buffer,C=g.lines.length.toString();for(let k=l;k<=u;k++){const D=g.lines.get(g.ydisp+k),E=[],N=(D==null?void 0:D.translateToString(!0,void 0,void 0,E))||"",V=(g.ydisp+k+1).toString(),q=this._rowElements[k];q&&(N.length===0?(q.innerText=" ",this._rowColumns.set(q,[0,1])):(q.textContent=N,this._rowColumns.set(q,E)),q.setAttribute("aria-posinset",V),q.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(l,u){const g=l.target,C=this._rowElements[u===0?1:this._rowElements.length-2];if(g.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||l.relatedTarget!==C)return;let k,D;if(u===0?(k=g,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(k=this._rowElements.shift(),D=g,this._rowContainer.removeChild(k)),k.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),u===0){const E=this._createAccessibilityTreeNode();this._rowElements.unshift(E),this._rowContainer.insertAdjacentElement("afterbegin",E)}else{const E=this._createAccessibilityTreeNode();this._rowElements.push(E),this._rowContainer.appendChild(E)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(u===0?-1:1),this._rowElements[u===0?1:this._rowElements.length-2].focus(),l.preventDefault(),l.stopImmediatePropagation()}_handleSelectionChange(){var N;if(this._rowElements.length===0)return;const l=document.getSelection();if(!l)return;if(l.isCollapsed)return void(this._rowContainer.contains(l.anchorNode)&&this._terminal.clearSelection());if(!l.anchorNode||!l.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:l.anchorNode,offset:l.anchorOffset},g={node:l.focusNode,offset:l.focusOffset};if((u.node.compareDocumentPosition(g.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===g.node&&u.offset>g.offset)&&([u,g]=[g,u]),u.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(u={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(u.node))return;const C=this._rowElements.slice(-1)[0];if(g.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(g={node:C,offset:((N=C.textContent)==null?void 0:N.length)??0}),!this._rowContainer.contains(g.node))return;const k=({node:V,offset:q})=>{const O=V instanceof Text?V.parentNode:V;let A=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(A))return console.warn("row is invalid. Race condition?"),null;const U=this._rowColumns.get(O);if(!U)return console.warn("columns is null. Race condition?"),null;let z=q<U.length?U[q]:U.slice(-1)[0]+1;return z>=this._terminal.cols&&(++A,z=0),{row:A,column:z}},D=k(u),E=k(g);if(D&&E){if(D.row>E.row||D.row===E.row&&D.column>=E.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(E.row-D.row)*this._terminal.cols-D.column+E.column)}}_handleResize(l){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let u=this._rowContainer.children.length;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);for(;this._rowElements.length>l;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const l=this._coreBrowserService.mainDocument.createElement("div");return l.setAttribute("role","listitem"),l.tabIndex=-1,this._refreshRowDimensions(l),l}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let l=0;l<this._terminal.rows;l++)this._refreshRowDimensions(this._rowElements[l])}}_refreshRowDimensions(l){l.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=h=v([y(1,w.IInstantiationService),y(2,T.ICoreBrowserService),y(3,T.IRenderService)],h)},3614:(R,o)=>{function d(S){return S.replace(/\r?\n/g,"\r")}function v(S,x){return x?"\x1B[200~"+S+"\x1B[201~":S}function y(S,x,T,w){S=v(S=d(S),T.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),T.triggerDataEvent(S,!0),x.value=""}function f(S,x,T){const w=T.getBoundingClientRect(),c=S.clientX-w.left-10,h=S.clientY-w.top-10;x.style.width="20px",x.style.height="20px",x.style.left=`${c}px`,x.style.top=`${h}px`,x.style.zIndex="1000",x.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=d,o.bracketTextForPaste=v,o.copyHandler=function(S,x){S.clipboardData&&S.clipboardData.setData("text/plain",x.selectionText),S.preventDefault()},o.handlePasteEvent=function(S,x,T,w){S.stopPropagation(),S.clipboardData&&y(S.clipboardData.getData("text/plain"),x,T,w)},o.paste=y,o.moveTextAreaUnderMouseCursor=f,o.rightClickHandler=function(S,x,T,w,c){f(S,x,T),c&&w.rightClickSelect(S),x.value=w.selectionText,x.select()}},7239:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const v=d(1505);o.ColorContrastCache=class{constructor(){this._color=new v.TwoKeyMap,this._css=new v.TwoKeyMap}setCss(y,f,S){this._css.set(y,f,S)}getCss(y,f){return this._css.get(y,f)}setColor(y,f,S){this._color.set(y,f,S)}getColor(y,f){return this._color.get(y,f)}clear(){this._color.clear(),this._css.clear()}}},3656:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(d,v,y,f){d.addEventListener(v,y,f);let S=!1;return{dispose:()=>{S||(S=!0,d.removeEventListener(v,y,f))}}}},3551:function(R,o,d){var v=this&&this.__decorate||function(h,l,u,g){var C,k=arguments.length,D=k<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(h,l,u,g);else for(var E=h.length-1;E>=0;E--)(C=h[E])&&(D=(k<3?C(D):k>3?C(l,u,D):C(l,u))||D);return k>3&&D&&Object.defineProperty(l,u,D),D},y=this&&this.__param||function(h,l){return function(u,g){l(u,g,h)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const f=d(3656),S=d(8460),x=d(844),T=d(2585),w=d(4725);let c=o.Linkifier=class extends x.Disposable{get currentLink(){return this._currentLink}constructor(h,l,u,g,C){super(),this._element=h,this._mouseService=l,this._renderService=u,this._bufferService=g,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new S.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new S.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,x.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,x.toDisposable)((()=>{var k;this._lastMouseEvent=void 0,(k=this._activeProviderReplies)==null||k.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,f.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,f.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(h){this._lastMouseEvent=h;const l=this._positionFromMouseEvent(h,this._element,this._mouseService);if(!l)return;this._isMouseOut=!1;const u=h.composedPath();for(let g=0;g<u.length;g++){const C=u[g];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&l.x===this._lastBufferCell.x&&l.y===this._lastBufferCell.y||(this._handleHover(l),this._lastBufferCell=l)}_handleHover(h){if(this._activeLine!==h.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(h,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,h)||(this._clearCurrentLink(),this._askForLink(h,!0))}_askForLink(h,l){var g,C;this._activeProviderReplies&&l||((g=this._activeProviderReplies)==null||g.forEach((k=>{k==null||k.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=h.y);let u=!1;for(const[k,D]of this._linkProviderService.linkProviders.entries())l?(C=this._activeProviderReplies)!=null&&C.get(k)&&(u=this._checkLinkProviderResult(k,h,u)):D.provideLinks(h.y,(E=>{var V,q;if(this._isMouseOut)return;const N=E==null?void 0:E.map((O=>({link:O})));(V=this._activeProviderReplies)==null||V.set(k,N),u=this._checkLinkProviderResult(k,h,u),((q=this._activeProviderReplies)==null?void 0:q.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(h.y,this._activeProviderReplies)}))}_removeIntersectingLinks(h,l){const u=new Set;for(let g=0;g<l.size;g++){const C=l.get(g);if(C)for(let k=0;k<C.length;k++){const D=C[k],E=D.link.range.start.y<h?0:D.link.range.start.x,N=D.link.range.end.y>h?this._bufferService.cols:D.link.range.end.x;for(let V=E;V<=N;V++){if(u.has(V)){C.splice(k--,1);break}u.add(V)}}}}_checkLinkProviderResult(h,l,u){var k;if(!this._activeProviderReplies)return u;const g=this._activeProviderReplies.get(h);let C=!1;for(let D=0;D<h;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(C=!0);if(!C&&g){const D=g.find((E=>this._linkAtPosition(E.link,l)));D&&(u=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let D=0;D<this._activeProviderReplies.size;D++){const E=(k=this._activeProviderReplies.get(D))==null?void 0:k.find((N=>this._linkAtPosition(N.link,l)));if(E){u=!0,this._handleNewLink(E);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(h){if(!this._currentLink)return;const l=this._positionFromMouseEvent(h,this._element,this._mouseService);l&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,l)&&this._currentLink.link.activate(h,this._currentLink.link.text)}_clearCurrentLink(h,l){this._currentLink&&this._lastMouseEvent&&(!h||!l||this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=l)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,x.disposeArray)(this._linkCacheDisposables))}_handleNewLink(h){if(!this._lastMouseEvent)return;const l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._linkAtPosition(h.link,l)&&(this._currentLink=h,this._currentLink.state={decorations:{underline:h.link.decorations===void 0||h.link.decorations.underline,pointerCursor:h.link.decorations===void 0||h.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,h.link,this._lastMouseEvent),h.link.decorations={},Object.defineProperties(h.link.decorations,{pointerCursor:{get:()=>{var u,g;return(g=(u=this._currentLink)==null?void 0:u.state)==null?void 0:g.decorations.pointerCursor},set:u=>{var g;(g=this._currentLink)!=null&&g.state&&this._currentLink.state.decorations.pointerCursor!==u&&(this._currentLink.state.decorations.pointerCursor=u,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",u))}},underline:{get:()=>{var u,g;return(g=(u=this._currentLink)==null?void 0:u.state)==null?void 0:g.decorations.underline},set:u=>{var g,C,k;(g=this._currentLink)!=null&&g.state&&((k=(C=this._currentLink)==null?void 0:C.state)==null?void 0:k.decorations.underline)!==u&&(this._currentLink.state.decorations.underline=u,this._currentLink.state.isHovered&&this._fireUnderlineEvent(h.link,u))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((u=>{if(!this._currentLink)return;const g=u.start===0?0:u.start+1+this._bufferService.buffer.ydisp,C=this._bufferService.buffer.ydisp+1+u.end;if(this._currentLink.link.range.start.y>=g&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(g,C),this._lastMouseEvent)){const k=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);k&&this._askForLink(k,!1)}}))))}_linkHover(h,l,u){var g;(g=this._currentLink)!=null&&g.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!0),this._currentLink.state.decorations.pointerCursor&&h.classList.add("xterm-cursor-pointer")),l.hover&&l.hover(u,l.text)}_fireUnderlineEvent(h,l){const u=h.range,g=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-g-1,u.end.x,u.end.y-g-1,void 0);(l?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(h,l,u){var g;(g=this._currentLink)!=null&&g.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!1),this._currentLink.state.decorations.pointerCursor&&h.classList.remove("xterm-cursor-pointer")),l.leave&&l.leave(u,l.text)}_linkAtPosition(h,l){const u=h.range.start.y*this._bufferService.cols+h.range.start.x,g=h.range.end.y*this._bufferService.cols+h.range.end.x,C=l.y*this._bufferService.cols+l.x;return u<=C&&C<=g}_positionFromMouseEvent(h,l,u){const g=u.getCoords(h,l,this._bufferService.cols,this._bufferService.rows);if(g)return{x:g[0],y:g[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(h,l,u,g,C){return{x1:h,y1:l,x2:u,y2:g,cols:this._bufferService.cols,fg:C}}};o.Linkifier=c=v([y(1,w.IMouseService),y(2,w.IRenderService),y(3,T.IBufferService),y(4,w.ILinkProviderService)],c)},9042:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(R,o,d){var v=this&&this.__decorate||function(w,c,h,l){var u,g=arguments.length,C=g<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,h):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,c,h,l);else for(var k=w.length-1;k>=0;k--)(u=w[k])&&(C=(g<3?u(C):g>3?u(c,h,C):u(c,h))||C);return g>3&&C&&Object.defineProperty(c,h,C),C},y=this&&this.__param||function(w,c){return function(h,l){c(h,l,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const f=d(511),S=d(2585);let x=o.OscLinkProvider=class{constructor(w,c,h){this._bufferService=w,this._optionsService=c,this._oscLinkService=h}provideLinks(w,c){var N;const h=this._bufferService.buffer.lines.get(w-1);if(!h)return void c(void 0);const l=[],u=this._optionsService.rawOptions.linkHandler,g=new f.CellData,C=h.getTrimmedLength();let k=-1,D=-1,E=!1;for(let V=0;V<C;V++)if(D!==-1||h.hasContent(V)){if(h.loadCell(V,g),g.hasExtendedAttrs()&&g.extended.urlId){if(D===-1){D=V,k=g.extended.urlId;continue}E=g.extended.urlId!==k}else D!==-1&&(E=!0);if(E||D!==-1&&V===C-1){const q=(N=this._oscLinkService.getLinkData(k))==null?void 0:N.uri;if(q){const O={start:{x:D+1,y:w},end:{x:V+(E||V!==C-1?0:1),y:w}};let A=!1;if(!(u!=null&&u.allowNonHttpProtocols))try{const U=new URL(q);["http:","https:"].includes(U.protocol)||(A=!0)}catch{A=!0}A||l.push({text:q,range:O,activate:(U,z)=>u?u.activate(U,z,O):T(0,z),hover:(U,z)=>{var K;return(K=u==null?void 0:u.hover)==null?void 0:K.call(u,U,z,O)},leave:(U,z)=>{var K;return(K=u==null?void 0:u.leave)==null?void 0:K.call(u,U,z,O)}})}E=!1,g.hasExtendedAttrs()&&g.extended.urlId?(D=V,k=g.extended.urlId):(D=-1,k=-1)}}c(l)}};function T(w,c){if(confirm(`Do you want to navigate to ${c}?
54
+
55
+ WARNING: This link could potentially be dangerous`)){const h=window.open();if(h){try{h.opener=null}catch{}h.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=x=v([y(0,S.IBufferService),y(1,S.IOptionsService),y(2,S.IOscLinkService)],x)},6193:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(d,v){this._renderCallback=d,this._coreBrowserService=v,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,v,y){this._rowCount=y,d=d!==void 0?d:0,v=v!==void 0?v:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,v):v,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)return void this._runRefreshCallbacks();const d=Math.max(this._rowStart,0),v=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,v),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const v=d(3614),y=d(3656),f=d(3551),S=d(9042),x=d(3730),T=d(1680),w=d(3107),c=d(5744),h=d(2950),l=d(1296),u=d(428),g=d(4269),C=d(5114),k=d(8934),D=d(3230),E=d(9312),N=d(4725),V=d(6731),q=d(8055),O=d(8969),A=d(8460),U=d(844),z=d(6114),K=d(8437),Y=d(2584),W=d(7399),B=d(5941),I=d(9074),P=d(2585),H=d(5435),J=d(4567),se=d(779);class le extends O.CoreTerminal{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}constructor(X={}){super(X),this.browser=z,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new U.MutableDisposable),this._onCursorMove=this.register(new A.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new A.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new A.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new A.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new A.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new A.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new A.EventEmitter),this._onBlur=this.register(new A.EventEmitter),this._onA11yCharEmitter=this.register(new A.EventEmitter),this._onA11yTabEmitter=this.register(new A.EventEmitter),this._onWillOpen=this.register(new A.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(I.DecorationService),this._instantiationService.setService(P.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(se.LinkProviderService),this._instantiationService.setService(N.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(x.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((j,ne)=>this.refresh(j,ne)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((j=>this._reportWindowsOptions(j)))),this.register(this._inputHandler.onColor((j=>this._handleColorEvent(j)))),this.register((0,A.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,A.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((j=>this._afterResize(j.cols,j.rows)))),this.register((0,U.toDisposable)((()=>{var j,ne;this._customKeyEventHandler=void 0,(ne=(j=this.element)==null?void 0:j.parentNode)==null||ne.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const j of X){let ne,ee="";switch(j.index){case 256:ne="foreground",ee="10";break;case 257:ne="background",ee="11";break;case 258:ne="cursor",ee="12";break;default:ne="ansi",ee="4;"+j.index}switch(j.type){case 0:const ce=q.color.toColorRGB(ne==="ansi"?this._themeService.colors.ansi[j.index]:this._themeService.colors[ne]);this.coreService.triggerDataEvent(`${Y.C0.ESC}]${ee};${(0,B.toRgbString)(ce)}${Y.C1_ESCAPED.ST}`);break;case 1:if(ne==="ansi")this._themeService.modifyColors((ve=>ve.ansi[j.index]=q.channels.toColor(...j.color)));else{const ve=ne;this._themeService.modifyColors((ie=>ie[ve]=q.channels.toColor(...j.color)))}break;case 2:this._themeService.restoreColor(j.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(J.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,j=this.buffer.lines.get(X);if(!j)return;const ne=Math.min(this.buffer.x,this.cols-1),ee=this._renderService.dimensions.css.cell.height,ce=j.getWidth(ne),ve=this._renderService.dimensions.css.cell.width*ce,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,pe=ne*this._renderService.dimensions.css.cell.width;this.textarea.style.left=pe+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=ve+"px",this.textarea.style.height=ee+"px",this.textarea.style.lineHeight=ee+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,y.addDisposableDomListener)(this.element,"copy",(j=>{this.hasSelection()&&(0,v.copyHandler)(j,this._selectionService)})));const X=j=>(0,v.handlePasteEvent)(j,this.textarea,this.coreService,this.optionsService);this.register((0,y.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,y.addDisposableDomListener)(this.element,"paste",X)),z.isFirefox?this.register((0,y.addDisposableDomListener)(this.element,"mousedown",(j=>{j.button===2&&(0,v.rightClickHandler)(j,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,y.addDisposableDomListener)(this.element,"contextmenu",(j=>{(0,v.rightClickHandler)(j,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),z.isLinux&&this.register((0,y.addDisposableDomListener)(this.element,"auxclick",(j=>{j.button===1&&(0,v.moveTextAreaUnderMouseCursor)(j,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,y.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,y.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var ne;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ne=this.element)==null?void 0:ne.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.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"),X.appendChild(this.element);const j=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),j.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,y.addDisposableDomListener)(this.screenElement,"mousemove",(ee=>this.updateCursorStyle(ee)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),j.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",S.promptLabel),z.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(C.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(N.ICoreBrowserService,this._coreBrowserService),this.register((0,y.addDisposableDomListener)(this.textarea,"focus",(ee=>this._handleTextAreaFocus(ee)))),this.register((0,y.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(N.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(V.ThemeService),this._instantiationService.setService(N.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(g.CharacterJoinerService),this._instantiationService.setService(N.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(N.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ee=>this._onRender.fire(ee)))),this.onResize((ee=>this._renderService.resize(ee.cols,ee.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(h.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(k.MouseService),this._instantiationService.setService(N.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(f.Linkifier,this.screenElement)),this.element.appendChild(j);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(T.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ee=>this.scrollLines(ee.amount,ee.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(E.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(N.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ee=>this.scrollLines(ee.amount,ee.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ee=>this._renderService.handleSelectionChanged(ee.start,ee.end,ee.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ee=>{this.textarea.value=ee,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ee=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,y.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,y.addDisposableDomListener)(this.element,"mousedown",(ee=>this._selectionService.handleMouseDown(ee)))),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(J.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ee=>this._handleScreenReaderModeOptionChange(ee)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ee=>{!this._overviewRulerRenderer&&ee&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,j=this.element;function ne(ve){const ie=X._mouseService.getMouseReportCoords(ve,X.screenElement);if(!ie)return!1;let pe,Re;switch(ve.overrideType||ve.type){case"mousemove":Re=32,ve.buttons===void 0?(pe=3,ve.button!==void 0&&(pe=ve.button<3?ve.button:3)):pe=1&ve.buttons?0:4&ve.buttons?1:2&ve.buttons?2:3;break;case"mouseup":Re=0,pe=ve.button<3?ve.button:3;break;case"mousedown":Re=1,pe=ve.button<3?ve.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(ve)===!1||X.viewport.getLinesScrolled(ve)===0)return!1;Re=ve.deltaY<0?0:1,pe=4;break;default:return!1}return!(Re===void 0||pe===void 0||pe>4)&&X.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:pe,action:Re,ctrl:ve.ctrlKey,alt:ve.altKey,shift:ve.shiftKey})}const ee={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ce={mouseup:ve=>(ne(ve),ve.buttons||(this._document.removeEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.removeEventListener("mousemove",ee.mousedrag)),this.cancel(ve)),wheel:ve=>(ne(ve),this.cancel(ve,!0)),mousedrag:ve=>{ve.buttons&&ne(ve)},mousemove:ve=>{ve.buttons||ne(ve)}};this.register(this.coreMouseService.onProtocolChange((ve=>{ve?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ve)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&ve?ee.mousemove||(j.addEventListener("mousemove",ce.mousemove),ee.mousemove=ce.mousemove):(j.removeEventListener("mousemove",ee.mousemove),ee.mousemove=null),16&ve?ee.wheel||(j.addEventListener("wheel",ce.wheel,{passive:!1}),ee.wheel=ce.wheel):(j.removeEventListener("wheel",ee.wheel),ee.wheel=null),2&ve?ee.mouseup||(ee.mouseup=ce.mouseup):(this._document.removeEventListener("mouseup",ee.mouseup),ee.mouseup=null),4&ve?ee.mousedrag||(ee.mousedrag=ce.mousedrag):(this._document.removeEventListener("mousemove",ee.mousedrag),ee.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,y.addDisposableDomListener)(j,"mousedown",(ve=>{if(ve.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ve))return ne(ve),ee.mouseup&&this._document.addEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.addEventListener("mousemove",ee.mousedrag),this.cancel(ve)}))),this.register((0,y.addDisposableDomListener)(j,"wheel",(ve=>{if(!ee.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ve)===!1)return!1;if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(ve);if(ie===0)return;const pe=Y.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ve.deltaY<0?"A":"B");let Re="";for(let Te=0;Te<Math.abs(ie);Te++)Re+=pe;return this.coreService.triggerDataEvent(Re,!0),this.cancel(ve,!0)}return this.viewport.handleWheel(ve)?this.cancel(ve):void 0}}),{passive:!1})),this.register((0,y.addDisposableDomListener)(j,"touchstart",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ve),this.cancel(ve)}),{passive:!0})),this.register((0,y.addDisposableDomListener)(j,"touchmove",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ve)?void 0:this.cancel(ve)}),{passive:!1}))}refresh(X,j){var ne;(ne=this._renderService)==null||ne.refreshRows(X,j)}updateCursorStyle(X){var j;(j=this._selectionService)!=null&&j.shouldColumnSelect(X)?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(X,j,ne=0){var ee;ne===1?(super.scrollLines(X,j,ne),this.refresh(0,this.rows-1)):(ee=this.viewport)==null||ee.scrollLines(X)}paste(X){(0,v.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const j=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),j}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,j,ne){this._selectionService.setSelection(X,j,ne)}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 X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,j){var ne;(ne=this._selectionService)==null||ne.selectLines(X,j)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const j=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!j&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;j||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ne=(0,W.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ne.type===3||ne.type===2){const ee=this.rows-1;return this.scrollLines(ne.type===2?-ee:ee),this.cancel(X,!0)}return ne.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ne.cancel&&this.cancel(X,!0),!ne.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ne.key!==Y.C0.ETX&&ne.key!==Y.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ne.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ne.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,j){const ne=X.isMac&&!this.options.macOptionIsMeta&&j.altKey&&!j.ctrlKey&&!j.metaKey||X.isWindows&&j.altKey&&j.ctrlKey&&!j.metaKey||X.isWindows&&j.getModifierState("AltGraph");return j.type==="keypress"?ne:ne&&(!j.keyCode||j.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(j){return j.keyCode===16||j.keyCode===17||j.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let j;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)j=X.charCode;else if(X.which===null||X.which===void 0)j=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;j=X.which}return!(!j||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(j=String.fromCharCode(j),this._onKey.fire({key:j,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(j,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const j=X.data;return this.coreService.triggerDataEvent(j,!0),this.cancel(X),!0}return!1}resize(X,j){X!==this.cols||j!==this.rows?super.resize(X,j):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,j){var ne,ee;(ne=this._charSizeService)==null||ne.measure(),(ee=this.viewport)==null||ee.syncScrollArea(!0)}clear(){var X;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 j=1;j<this.rows;j++)this.buffer.lines.push(this.buffer.getBlankLine(K.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var j,ne;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(j=this._selectionService)==null||j.reset(),this._decorationService.reset(),(ne=this.viewport)==null||ne.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(Y.C0.ESC+"[I"):this.coreService.triggerDataEvent(Y.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case H.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const j=this._renderService.dimensions.css.canvas.width.toFixed(0),ne=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[4;${ne};${j}t`);break;case H.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ee=this._renderService.dimensions.css.cell.width.toFixed(0),ce=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[6;${ce};${ee}t`)}}cancel(X,j){if(this.options.cancelEvents||j)return X.preventDefault(),X.stopPropagation(),!1}}o.Terminal=le},9924:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(d,v=1e3){this._renderCallback=d,this._debounceThresholdMS=v,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,v,y){this._rowCount=y,d=d!==void 0?d:0,v=v!==void 0?v:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,v):v;const f=Date.now();if(f-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=f,this._innerRefresh();else if(!this._additionalRefreshRequested){const S=f-this._lastRefreshMs,x=this._debounceThresholdMS-S;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),x)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),v=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,v)}}},1680:function(R,o,d){var v=this&&this.__decorate||function(h,l,u,g){var C,k=arguments.length,D=k<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(h,l,u,g);else for(var E=h.length-1;E>=0;E--)(C=h[E])&&(D=(k<3?C(D):k>3?C(l,u,D):C(l,u))||D);return k>3&&D&&Object.defineProperty(l,u,D),D},y=this&&this.__param||function(h,l){return function(u,g){l(u,g,h)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const f=d(3656),S=d(4725),x=d(8460),T=d(844),w=d(2585);let c=o.Viewport=class extends T.Disposable{constructor(h,l,u,g,C,k,D,E){super(),this._viewportElement=h,this._scrollArea=l,this._bufferService=u,this._optionsService=g,this._charSizeService=C,this._renderService=k,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new x.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((N=>this._activeBuffer=N.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((N=>this._renderDimensions=N))),this._handleThemeChange(E.colors),this.register(E.onChangeColors((N=>this._handleThemeChange(N)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(h){this._viewportElement.style.backgroundColor=h.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(h){if(h)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const h=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==h&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=h),this._refreshAnimationFrame=null}syncScrollArea(h=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(h);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(h)}_handleScroll(h){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const h=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(h*(this._smoothScrollState.target-this._smoothScrollState.origin)),h<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(h,l){const u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&u<this._lastRecordedBufferHeight)||(h.cancelable&&h.preventDefault(),!1)}handleWheel(h){const l=this._getPixelsScrolled(h);return l!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(h,l))}scrollLines(h){if(h!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const l=h*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:h,suppressScrollEvent:!1})}_getPixelsScrolled(h){if(h.deltaY===0||h.shiftKey)return 0;let l=this._applyScrollModifier(h.deltaY,h);return h.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:h.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(h,l){var E;let u,g="";const C=[],k=l??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let N=h;N<k;N++){const V=D.get(N);if(!V)continue;const q=(E=D.get(N+1))==null?void 0:E.isWrapped;if(g+=V.translateToString(!q),!q||N===D.length-1){const O=document.createElement("div");O.textContent=g,C.push(O),g.length>0&&(u=O),g=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(h){if(h.deltaY===0||h.shiftKey)return 0;let l=this._applyScrollModifier(h.deltaY,h);return h.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):h.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(h,l){const u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&l.altKey||u==="ctrl"&&l.ctrlKey||u==="shift"&&l.shiftKey?h*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:h*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(h){this._lastTouchY=h.touches[0].pageY}handleTouchMove(h){const l=this._lastTouchY-h.touches[0].pageY;return this._lastTouchY=h.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(h,l))}};o.Viewport=c=v([y(2,w.IBufferService),y(3,w.IOptionsService),y(4,S.ICharSizeService),y(5,S.IRenderService),y(6,S.ICoreBrowserService),y(7,S.IThemeService)],c)},3107:function(R,o,d){var v=this&&this.__decorate||function(w,c,h,l){var u,g=arguments.length,C=g<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,h):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,c,h,l);else for(var k=w.length-1;k>=0;k--)(u=w[k])&&(C=(g<3?u(C):g>3?u(c,h,C):u(c,h))||C);return g>3&&C&&Object.defineProperty(c,h,C),C},y=this&&this.__param||function(w,c){return function(h,l){c(h,l,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const f=d(4725),S=d(844),x=d(2585);let T=o.BufferDecorationRenderer=class extends S.Disposable{constructor(w,c,h,l,u){super(),this._screenElement=w,this._bufferService=c,this._coreBrowserService=h,this._decorationService=l,this._renderService=u,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((g=>this._removeDecoration(g)))),this.register((0,S.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){var l;const c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",((l=w==null?void 0:w.options)==null?void 0:l.layer)==="top"),c.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const h=w.options.x??0;return h&&h>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(w,c),c}_refreshStyle(w){const c=w.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let h=this._decorationElements.get(w);h||(h=this._createElement(w),w.element=h,this._decorationElements.set(w,h),this._container.appendChild(h),w.onDispose((()=>{this._decorationElements.delete(w),h.remove()}))),h.style.top=c*this._renderService.dimensions.css.cell.height+"px",h.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(h)}}_refreshXPosition(w,c=w.element){if(!c)return;const h=w.options.x??0;(w.options.anchor||"left")==="right"?c.style.right=h?h*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=h?h*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){var c;(c=this._decorationElements.get(w))==null||c.remove(),this._decorationElements.delete(w),w.dispose()}};o.BufferDecorationRenderer=T=v([y(1,x.IBufferService),y(2,f.ICoreBrowserService),y(3,x.IDecorationService),y(4,f.IRenderService)],T)},5871:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=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(d){if(d.options.overviewRulerOptions){for(const v of this._zones)if(v.color===d.options.overviewRulerOptions.color&&v.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(v,d.marker.line))return;if(this._lineAdjacentToZone(v,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(v,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,v){return v>=d.startBufferLine&&v<=d.endBufferLine}_lineAdjacentToZone(d,v,y){return v>=d.startBufferLine-this._linePadding[y||"full"]&&v<=d.endBufferLine+this._linePadding[y||"full"]}_addLineToZone(d,v){d.startBufferLine=Math.min(d.startBufferLine,v),d.endBufferLine=Math.max(d.endBufferLine,v)}}},5744:function(R,o,d){var v=this&&this.__decorate||function(u,g,C,k){var D,E=arguments.length,N=E<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,C):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(u,g,C,k);else for(var V=u.length-1;V>=0;V--)(D=u[V])&&(N=(E<3?D(N):E>3?D(g,C,N):D(g,C))||N);return E>3&&N&&Object.defineProperty(g,C,N),N},y=this&&this.__param||function(u,g){return function(C,k){g(C,k,u)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const f=d(5871),S=d(4725),x=d(844),T=d(2585),w={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0};let l=o.OverviewRulerRenderer=class extends x.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,g,C,k,D,E,N){var q;super(),this._viewportElement=u,this._screenElement=g,this._bufferService=C,this._decorationService=k,this._renderService=D,this._optionsService=E,this._coreBrowserService=N,this._colorZoneStore=new f.ColorZoneStore,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(),(q=this._viewportElement.parentElement)==null||q.insertBefore(this._canvas,this._viewportElement);const V=this._canvas.getContext("2d");if(!V)throw new Error("Ctx cannot be null");this._ctx=V,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,x.toDisposable)((()=>{var O;(O=this._canvas)==null||O.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const u=Math.floor(this._canvas.width/3),g=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=u,c.center=g,c.right=u,this._refreshDrawHeightConstants(),h.full=0,h.left=0,h.center=c.left,h.right=c.left+c.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const u=this._canvas.height/this._bufferService.buffer.lines.length,g=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);w.left=g,w.center=g,w.right=g}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.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(const g of this._decorationService.decorations)this._colorZoneStore.addDecoration(g);this._ctx.lineWidth=1;const u=this._colorZoneStore.zones;for(const g of u)g.position!=="full"&&this._renderColorZone(g);for(const g of u)g.position==="full"&&this._renderColorZone(g);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(u){this._ctx.fillStyle=u.color,this._ctx.fillRect(h[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-w[u.position||"full"]/2),c[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[u.position||"full"]))}_queueRefresh(u,g){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=g||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=l=v([y(2,T.IBufferService),y(3,T.IDecorationService),y(4,S.IRenderService),y(5,T.IOptionsService),y(6,S.ICoreBrowserService)],l)},2950:function(R,o,d){var v=this&&this.__decorate||function(w,c,h,l){var u,g=arguments.length,C=g<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,h):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,c,h,l);else for(var k=w.length-1;k>=0;k--)(u=w[k])&&(C=(g<3?u(C):g>3?u(c,h,C):u(c,h))||C);return g>3&&C&&Object.defineProperty(c,h,C),C},y=this&&this.__param||function(w,c){return function(h,l){c(h,l,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const f=d(4725),S=d(2585),x=d(2584);let T=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,c,h,l,u,g){this._textarea=w,this._compositionView=c,this._bufferService=h,this._optionsService=l,this._coreService=u,this._renderService=g,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(w){this._compositionView.textContent=w.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(w){if(this._isComposing||this._isSendingComposition){if(w.keyCode===229||w.keyCode===16||w.keyCode===17||w.keyCode===18)return!1;this._finalizeComposition(!1)}return w.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(w){if(this._compositionView.classList.remove("active"),this._isComposing=!1,w){const c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let h;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,h=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),h.length>0&&this._coreService.triggerDataEvent(h,!0)}}),0)}else{this._isSendingComposition=!1;const c=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(c,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const c=this._textarea.value,h=c.replace(w,"");this._dataAlreadySent=h,c.length>w.length?this._coreService.triggerDataEvent(h,!0):c.length<w.length?this._coreService.triggerDataEvent(`${x.C0.DEL}`,!0):c.length===w.length&&c!==w&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),h=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=h+"px",this._compositionView.style.lineHeight=h+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const g=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(g.width,1)+"px",this._textarea.style.height=Math.max(g.height,1)+"px",this._textarea.style.lineHeight=g.height+"px"}w||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};o.CompositionHelper=T=v([y(2,S.IBufferService),y(3,S.IOptionsService),y(4,S.ICoreService),y(5,f.IRenderService)],T)},9806:(R,o)=>{function d(v,y,f){const S=f.getBoundingClientRect(),x=v.getComputedStyle(f),T=parseInt(x.getPropertyValue("padding-left")),w=parseInt(x.getPropertyValue("padding-top"));return[y.clientX-S.left-T,y.clientY-S.top-w]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=d,o.getCoords=function(v,y,f,S,x,T,w,c,h){if(!T)return;const l=d(v,y,f);return l?(l[0]=Math.ceil((l[0]+(h?w/2:0))/w),l[1]=Math.ceil(l[1]/c),l[0]=Math.min(Math.max(l[0],1),S+(h?1:0)),l[1]=Math.min(Math.max(l[1],1),x),l):void 0}},9504:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const v=d(2584);function y(c,h,l,u){const g=c-f(c,l),C=h-f(h,l),k=Math.abs(g-C)-(function(D,E,N){let V=0;const q=D-f(D,N),O=E-f(E,N);for(let A=0;A<Math.abs(q-O);A++){const U=S(D,E)==="A"?-1:1,z=N.buffer.lines.get(q+U*A);z!=null&&z.isWrapped&&V++}return V})(c,h,l);return w(k,T(S(c,h),u))}function f(c,h){let l=0,u=h.buffer.lines.get(c),g=u==null?void 0:u.isWrapped;for(;g&&c>=0&&c<h.rows;)l++,u=h.buffer.lines.get(--c),g=u==null?void 0:u.isWrapped;return l}function S(c,h){return c>h?"A":"B"}function x(c,h,l,u,g,C){let k=c,D=h,E="";for(;k!==l||D!==u;)k+=g?1:-1,g&&k>C.cols-1?(E+=C.buffer.translateBufferLineToString(D,!1,c,k),k=0,c=0,D++):!g&&k<0&&(E+=C.buffer.translateBufferLineToString(D,!1,0,c+1),k=C.cols-1,c=k,D--);return E+C.buffer.translateBufferLineToString(D,!1,c,k)}function T(c,h){const l=h?"O":"[";return v.C0.ESC+l+c}function w(c,h){c=Math.floor(c);let l="";for(let u=0;u<c;u++)l+=h;return l}o.moveToCellSequence=function(c,h,l,u){const g=l.buffer.x,C=l.buffer.y;if(!l.buffer.hasScrollback)return(function(E,N,V,q,O,A){return y(N,q,O,A).length===0?"":w(x(E,N,E,N-f(N,O),!1,O).length,T("D",A))})(g,C,0,h,l,u)+y(C,h,l,u)+(function(E,N,V,q,O,A){let U;U=y(N,q,O,A).length>0?q-f(q,O):N;const z=q,K=(function(Y,W,B,I,P,H){let J;return J=y(B,I,P,H).length>0?I-f(I,P):W,Y<B&&J<=I||Y>=B&&J<I?"C":"D"})(E,N,V,q,O,A);return w(x(E,U,V,z,K==="C",O).length,T(K,A))})(g,C,c,h,l,u);let k;if(C===h)return k=g>c?"D":"C",w(Math.abs(g-c),T(k,u));k=C>h?"D":"C";const D=Math.abs(C-h);return w((function(E,N){return N.cols-E})(C>h?c:g,l)+(D-1)*l.cols+1+((C>h?g:c)-1),T(k,u))}},1296:function(R,o,d){var v=this&&this.__decorate||function(A,U,z,K){var Y,W=arguments.length,B=W<3?U:K===null?K=Object.getOwnPropertyDescriptor(U,z):K;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(A,U,z,K);else for(var I=A.length-1;I>=0;I--)(Y=A[I])&&(B=(W<3?Y(B):W>3?Y(U,z,B):Y(U,z))||B);return W>3&&B&&Object.defineProperty(U,z,B),B},y=this&&this.__param||function(A,U){return function(z,K){U(z,K,A)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const f=d(3787),S=d(2550),x=d(2223),T=d(6171),w=d(6052),c=d(4725),h=d(8055),l=d(8460),u=d(844),g=d(2585),C="xterm-dom-renderer-owner-",k="xterm-rows",D="xterm-fg-",E="xterm-bg-",N="xterm-focus",V="xterm-selection";let q=1,O=o.DomRenderer=class extends u.Disposable{constructor(A,U,z,K,Y,W,B,I,P,H,J,se,le){super(),this._terminal=A,this._document=U,this._element=z,this._screenElement=K,this._viewportElement=Y,this._helperContainer=W,this._linkifier2=B,this._charSizeService=P,this._optionsService=H,this._bufferService=J,this._coreBrowserService=se,this._themeService=le,this._terminalClass=q++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new l.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(k),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(V),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,T.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((de=>this._injectCss(de)))),this._injectCss(this._themeService.colors),this._rowFactory=I.createInstance(f.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((de=>this._handleLinkHover(de)))),this.register(this._linkifier2.onHideLinkUnderline((de=>this._handleLinkLeave(de)))),this.register((0,u.toDisposable)((()=>{this._element.classList.remove(C+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new S.WidthCache(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(){const A=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*A,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*A),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/A),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/A),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(const z of this._rowElements)z.style.width=`${this.dimensions.css.canvas.width}px`,z.style.height=`${this.dimensions.css.cell.height}px`,z.style.lineHeight=`${this.dimensions.css.cell.height}px`,z.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const U=`${this._terminalSelector} .${k} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=U,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(A){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let U=`${this._terminalSelector} .${k} { color: ${A.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;U+=`${this._terminalSelector} .${k} .xterm-dim { color: ${h.color.multiplyOpacity(A.foreground,.5).css};}`,U+=`${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;}`;const z=`blink_underline_${this._terminalClass}`,K=`blink_bar_${this._terminalClass}`,Y=`blink_block_${this._terminalClass}`;U+=`@keyframes ${z} { 50% { border-bottom-style: hidden; }}`,U+=`@keyframes ${K} { 50% { box-shadow: none; }}`,U+=`@keyframes ${Y} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,U+=`${this._terminalSelector} .${k}.${N} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${k}.${N} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${k}.${N} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-block { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css};}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${A.cursor.css} !important; color: ${A.cursorAccent.css} !important;}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${A.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${A.cursor.css} inset;}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${A.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,U+=`${this._terminalSelector} .${V} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${V} div { position: absolute; background-color: ${A.selectionBackgroundOpaque.css};}${this._terminalSelector} .${V} div { position: absolute; background-color: ${A.selectionInactiveBackgroundOpaque.css};}`;for(const[W,B]of A.ansi.entries())U+=`${this._terminalSelector} .${D}${W} { color: ${B.css}; }${this._terminalSelector} .${D}${W}.xterm-dim { color: ${h.color.multiplyOpacity(B,.5).css}; }${this._terminalSelector} .${E}${W} { background-color: ${B.css}; }`;U+=`${this._terminalSelector} .${D}${x.INVERTED_DEFAULT_COLOR} { color: ${h.color.opaque(A.background).css}; }${this._terminalSelector} .${D}${x.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${h.color.multiplyOpacity(h.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${E}${x.INVERTED_DEFAULT_COLOR} { background-color: ${A.foreground.css}; }`,this._themeStyleElement.textContent=U}_setDefaultSpacing(){const A=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${A}px`,this._rowFactory.defaultSpacing=A}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(A,U){for(let z=this._rowElements.length;z<=U;z++){const K=this._document.createElement("div");this._rowContainer.appendChild(K),this._rowElements.push(K)}for(;this._rowElements.length>U;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(A,U){this._refreshRowElements(A,U),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(N),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(N),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(A,U,z){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,U,z),this.renderRows(0,this._bufferService.rows-1),!A||!U)return;this._selectionRenderModel.update(this._terminal,A,U,z);const K=this._selectionRenderModel.viewportStartRow,Y=this._selectionRenderModel.viewportEndRow,W=this._selectionRenderModel.viewportCappedStartRow,B=this._selectionRenderModel.viewportCappedEndRow;if(W>=this._bufferService.rows||B<0)return;const I=this._document.createDocumentFragment();if(z){const P=A[0]>U[0];I.appendChild(this._createSelectionElement(W,P?U[0]:A[0],P?A[0]:U[0],B-W+1))}else{const P=K===W?A[0]:0,H=W===Y?U[0]:this._bufferService.cols;I.appendChild(this._createSelectionElement(W,P,H));const J=B-W-1;if(I.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,J)),W!==B){const se=Y===B?U[0]:this._bufferService.cols;I.appendChild(this._createSelectionElement(B,0,se))}}this._selectionContainer.appendChild(I)}_createSelectionElement(A,U,z,K=1){const Y=this._document.createElement("div"),W=U*this.dimensions.css.cell.width;let B=this.dimensions.css.cell.width*(z-U);return W+B>this.dimensions.css.canvas.width&&(B=this.dimensions.css.canvas.width-W),Y.style.height=K*this.dimensions.css.cell.height+"px",Y.style.top=A*this.dimensions.css.cell.height+"px",Y.style.left=`${W}px`,Y.style.width=`${B}px`,Y}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(const A of this._rowElements)A.replaceChildren()}renderRows(A,U){const z=this._bufferService.buffer,K=z.ybase+z.y,Y=Math.min(z.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,B=this._optionsService.rawOptions.cursorStyle,I=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=A;P<=U;P++){const H=P+z.ydisp,J=this._rowElements[P],se=z.lines.get(H);if(!J||!se)break;J.replaceChildren(...this._rowFactory.createRow(se,H,H===K,B,I,Y,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!0)}_handleLinkLeave(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!1)}_setCellUnderline(A,U,z,K,Y,W){z<0&&(A=0),K<0&&(U=0);const B=this._bufferService.rows-1;z=Math.max(Math.min(z,B),0),K=Math.max(Math.min(K,B),0),Y=Math.min(Y,this._bufferService.cols);const I=this._bufferService.buffer,P=I.ybase+I.y,H=Math.min(I.x,Y-1),J=this._optionsService.rawOptions.cursorBlink,se=this._optionsService.rawOptions.cursorStyle,le=this._optionsService.rawOptions.cursorInactiveStyle;for(let de=z;de<=K;++de){const X=de+I.ydisp,j=this._rowElements[de],ne=I.lines.get(X);if(!j||!ne)break;j.replaceChildren(...this._rowFactory.createRow(ne,X,X===P,se,le,H,J,this.dimensions.css.cell.width,this._widthCache,W?de===z?A:0:-1,W?(de===K?U:Y)-1:-1))}}};o.DomRenderer=O=v([y(7,g.IInstantiationService),y(8,c.ICharSizeService),y(9,g.IOptionsService),y(10,g.IBufferService),y(11,c.ICoreBrowserService),y(12,c.IThemeService)],O)},3787:function(R,o,d){var v=this&&this.__decorate||function(k,D,E,N){var V,q=arguments.length,O=q<3?D:N===null?N=Object.getOwnPropertyDescriptor(D,E):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(k,D,E,N);else for(var A=k.length-1;A>=0;A--)(V=k[A])&&(O=(q<3?V(O):q>3?V(D,E,O):V(D,E))||O);return q>3&&O&&Object.defineProperty(D,E,O),O},y=this&&this.__param||function(k,D){return function(E,N){D(E,N,k)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const f=d(2223),S=d(643),x=d(511),T=d(2585),w=d(8055),c=d(4725),h=d(4269),l=d(6171),u=d(3734);let g=o.DomRendererRowFactory=class{constructor(k,D,E,N,V,q,O){this._document=k,this._characterJoinerService=D,this._optionsService=E,this._coreBrowserService=N,this._coreService=V,this._decorationService=q,this._themeService=O,this._workCell=new x.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(k,D,E){this._selectionStart=k,this._selectionEnd=D,this._columnSelectMode=E}createRow(k,D,E,N,V,q,O,A,U,z,K){const Y=[],W=this._characterJoinerService.getJoinedCharacters(D),B=this._themeService.colors;let I,P=k.getNoBgTrimmedLength();E&&P<q+1&&(P=q+1);let H=0,J="",se=0,le=0,de=0,X=!1,j=0,ne=!1,ee=0;const ce=[],ve=z!==-1&&K!==-1;for(let ie=0;ie<P;ie++){k.loadCell(ie,this._workCell);let pe=this._workCell.getWidth();if(pe===0)continue;let Re=!1,Te=ie,ye=this._workCell;if(W.length>0&&ie===W[0][0]){Re=!0;const ze=W.shift();ye=new h.JoinedCellData(this._workCell,k.translateToString(!0,ze[0],ze[1]),ze[1]-ze[0]),Te=ze[1]-1,pe=ye.getWidth()}const Je=this._isCellInSelection(ie,D),kt=E&&ie===q,Ct=ve&&ie>=z&&ie<=K;let Qe=!1;this._decorationService.forEachDecorationAtCell(ie,D,void 0,(ze=>{Qe=!0}));let Ze=ye.getChars()||S.WHITESPACE_CELL_CHAR;if(Ze===" "&&(ye.isUnderline()||ye.isOverline())&&(Ze=" "),ee=pe*A-U.get(Ze,ye.isBold(),ye.isItalic()),I){if(H&&(Je&&ne||!Je&&!ne&&ye.bg===se)&&(Je&&ne&&B.selectionForeground||ye.fg===le)&&ye.extended.ext===de&&Ct===X&&ee===j&&!kt&&!Re&&!Qe){ye.isInvisible()?J+=S.WHITESPACE_CELL_CHAR:J+=Ze,H++;continue}H&&(I.textContent=J),I=this._document.createElement("span"),H=0,J=""}else I=this._document.createElement("span");if(se=ye.bg,le=ye.fg,de=ye.extended.ext,X=Ct,j=ee,ne=Je,Re&&q>=ie&&q<=Te&&(q=ie),!this._coreService.isCursorHidden&&kt&&this._coreService.isCursorInitialized){if(ce.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&ce.push("xterm-cursor-blink"),ce.push(N==="bar"?"xterm-cursor-bar":N==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(V)switch(V){case"outline":ce.push("xterm-cursor-outline");break;case"block":ce.push("xterm-cursor-block");break;case"bar":ce.push("xterm-cursor-bar");break;case"underline":ce.push("xterm-cursor-underline")}}if(ye.isBold()&&ce.push("xterm-bold"),ye.isItalic()&&ce.push("xterm-italic"),ye.isDim()&&ce.push("xterm-dim"),J=ye.isInvisible()?S.WHITESPACE_CELL_CHAR:ye.getChars()||S.WHITESPACE_CELL_CHAR,ye.isUnderline()&&(ce.push(`xterm-underline-${ye.extended.underlineStyle}`),J===" "&&(J=" "),!ye.isUnderlineColorDefault()))if(ye.isUnderlineColorRGB())I.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(ye.getUnderlineColor()).join(",")})`;else{let ze=ye.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ye.isBold()&&ze<8&&(ze+=8),I.style.textDecorationColor=B.ansi[ze].css}ye.isOverline()&&(ce.push("xterm-overline"),J===" "&&(J=" ")),ye.isStrikethrough()&&ce.push("xterm-strikethrough"),Ct&&(I.style.textDecoration="underline");let et=ye.getFgColor(),Vt=ye.getFgColorMode(),xt=ye.getBgColor(),at=ye.getBgColorMode();const bt=!!ye.isInverse();if(bt){const ze=et;et=xt,xt=ze;const Pr=Vt;Vt=at,at=Pr}let ht,sr,_t,Tt=!1;switch(this._decorationService.forEachDecorationAtCell(ie,D,void 0,(ze=>{ze.options.layer!=="top"&&Tt||(ze.backgroundColorRGB&&(at=50331648,xt=ze.backgroundColorRGB.rgba>>8&16777215,ht=ze.backgroundColorRGB),ze.foregroundColorRGB&&(Vt=50331648,et=ze.foregroundColorRGB.rgba>>8&16777215,sr=ze.foregroundColorRGB),Tt=ze.options.layer==="top")})),!Tt&&Je&&(ht=this._coreBrowserService.isFocused?B.selectionBackgroundOpaque:B.selectionInactiveBackgroundOpaque,xt=ht.rgba>>8&16777215,at=50331648,Tt=!0,B.selectionForeground&&(Vt=50331648,et=B.selectionForeground.rgba>>8&16777215,sr=B.selectionForeground)),Tt&&ce.push("xterm-decoration-top"),at){case 16777216:case 33554432:_t=B.ansi[xt],ce.push(`xterm-bg-${xt}`);break;case 50331648:_t=w.channels.toColor(xt>>16,xt>>8&255,255&xt),this._addStyle(I,`background-color:#${C((xt>>>0).toString(16),"0",6)}`);break;default:bt?(_t=B.foreground,ce.push(`xterm-bg-${f.INVERTED_DEFAULT_COLOR}`)):_t=B.background}switch(ht||ye.isDim()&&(ht=w.color.multiplyOpacity(_t,.5)),Vt){case 16777216:case 33554432:ye.isBold()&&et<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(et+=8),this._applyMinimumContrast(I,_t,B.ansi[et],ye,ht,void 0)||ce.push(`xterm-fg-${et}`);break;case 50331648:const ze=w.channels.toColor(et>>16&255,et>>8&255,255&et);this._applyMinimumContrast(I,_t,ze,ye,ht,sr)||this._addStyle(I,`color:#${C(et.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(I,_t,B.foreground,ye,ht,sr)||bt&&ce.push(`xterm-fg-${f.INVERTED_DEFAULT_COLOR}`)}ce.length&&(I.className=ce.join(" "),ce.length=0),kt||Re||Qe?I.textContent=J:H++,ee!==this.defaultSpacing&&(I.style.letterSpacing=`${ee}px`),Y.push(I),ie=Te}return I&&H&&(I.textContent=J),Y}_applyMinimumContrast(k,D,E,N,V,q){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.treatGlyphAsBackgroundColor)(N.getCode()))return!1;const O=this._getContrastCache(N);let A;if(V||q||(A=O.getColor(D.rgba,E.rgba)),A===void 0){const U=this._optionsService.rawOptions.minimumContrastRatio/(N.isDim()?2:1);A=w.color.ensureContrastRatio(V||D,q||E,U),O.setColor((V||D).rgba,(q||E).rgba,A??null)}return!!A&&(this._addStyle(k,`color:${A.css}`),!0)}_getContrastCache(k){return k.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(k,D){k.setAttribute("style",`${k.getAttribute("style")||""}${D};`)}_isCellInSelection(k,D){const E=this._selectionStart,N=this._selectionEnd;return!(!E||!N)&&(this._columnSelectMode?E[0]<=N[0]?k>=E[0]&&D>=E[1]&&k<N[0]&&D<=N[1]:k<E[0]&&D>=E[1]&&k>=N[0]&&D<=N[1]:D>E[1]&&D<N[1]||E[1]===N[1]&&D===E[1]&&k>=E[0]&&k<N[0]||E[1]<N[1]&&D===N[1]&&k<N[0]||E[1]<N[1]&&D===E[1]&&k>=E[0])}};function C(k,D,E){for(;k.length<E;)k=D+k;return k}o.DomRendererRowFactory=g=v([y(1,c.ICharacterJoinerService),y(2,T.IOptionsService),y(3,c.ICoreBrowserService),y(4,T.ICoreService),y(5,T.IDecorationService),y(6,c.IThemeService)],g)},2550:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(d,v){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.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";const y=d.createElement("span");y.classList.add("xterm-char-measure-element");const f=d.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold";const S=d.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontStyle="italic";const x=d.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontWeight="bold",x.style.fontStyle="italic",this._measureElements=[y,f,S,x],this._container.appendChild(y),this._container.appendChild(f),this._container.appendChild(S),this._container.appendChild(x),v.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(d,v,y,f){d===this._font&&v===this._fontSize&&y===this._weight&&f===this._weightBold||(this._font=d,this._fontSize=v,this._weight=y,this._weightBold=f,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${y}`,this._measureElements[1].style.fontWeight=`${f}`,this._measureElements[2].style.fontWeight=`${y}`,this._measureElements[3].style.fontWeight=`${f}`,this.clear())}get(d,v,y){let f=0;if(!v&&!y&&d.length===1&&(f=d.charCodeAt(0))<256){if(this._flat[f]!==-9999)return this._flat[f];const T=this._measure(d,0);return T>0&&(this._flat[f]=T),T}let S=d;v&&(S+="B"),y&&(S+="I");let x=this._holey.get(S);if(x===void 0){let T=0;v&&(T|=1),y&&(T|=2),x=this._measure(d,T),x>0&&this._holey.set(S,x)}return x}_measure(d,v){const y=this._measureElements[v];return y.textContent=d.repeat(32),y.offsetWidth/32}}},2223:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const v=d(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=v.isFirefox||v.isLegacyEdge?"bottom":"ideographic"},6171:(R,o)=>{function d(y){return 57508<=y&&y<=57558}function v(y){return y>=128512&&y<=128591||y>=127744&&y<=128511||y>=128640&&y<=128767||y>=9728&&y<=9983||y>=9984&&y<=10175||y>=65024&&y<=65039||y>=129280&&y<=129535||y>=127462&&y<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(y){if(!y)throw new Error("value must not be falsy");return y},o.isPowerlineGlyph=d,o.isRestrictedPowerlineGlyph=function(y){return 57520<=y&&y<=57527},o.isEmoji=v,o.allowRescaling=function(y,f,S,x){return f===1&&S>Math.ceil(1.5*x)&&y!==void 0&&y>255&&!v(y)&&!d(y)&&!(function(T){return 57344<=T&&T<=63743})(y)},o.treatGlyphAsBackgroundColor=function(y){return d(y)||(function(f){return 9472<=f&&f<=9631})(y)},o.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},o.computeNextVariantOffset=function(y,f,S=0){return(y-(2*Math.round(f)-S))%(2*Math.round(f))}},6052:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class d{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(y,f,S,x=!1){if(this.selectionStart=f,this.selectionEnd=S,!f||!S||f[0]===S[0]&&f[1]===S[1])return void this.clear();const T=y.buffers.active.ydisp,w=f[1]-T,c=S[1]-T,h=Math.max(w,0),l=Math.min(c,y.rows-1);h>=y.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=x,this.viewportStartRow=w,this.viewportEndRow=c,this.viewportCappedStartRow=h,this.viewportCappedEndRow=l,this.startCol=f[0],this.endCol=S[0])}isCellSelected(y,f,S){return!!this.hasSelection&&(S-=y.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?f>=this.startCol&&S>=this.viewportCappedStartRow&&f<this.endCol&&S<=this.viewportCappedEndRow:f<this.startCol&&S>=this.viewportCappedStartRow&&f>=this.endCol&&S<=this.viewportCappedEndRow:S>this.viewportStartRow&&S<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&S===this.viewportStartRow&&f>=this.startCol&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportEndRow&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportStartRow&&f>=this.startCol)}}o.createSelectionRenderModel=function(){return new d}},456:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(d){this._bufferService=d,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?d%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)-1]:[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[d,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[Math.max(d,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const d=this.selectionStart,v=this.selectionEnd;return!(!d||!v)&&(d[1]>v[1]||d[1]===v[1]&&d[0]>v[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(R,o,d){var v=this&&this.__decorate||function(l,u,g,C){var k,D=arguments.length,E=D<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(l,u,g,C);else for(var N=l.length-1;N>=0;N--)(k=l[N])&&(E=(D<3?k(E):D>3?k(u,g,E):k(u,g))||E);return D>3&&E&&Object.defineProperty(u,g,E),E},y=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const f=d(2585),S=d(8460),x=d(844);let T=o.CharSizeService=class extends x.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(l,u,g){super(),this._optionsService=g,this.width=0,this.height=0,this._onCharSizeChange=this.register(new S.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new h(this._optionsService))}catch{this._measureStrategy=this.register(new c(l,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const l=this._measureStrategy.measure();l.width===this.width&&l.height===this.height||(this.width=l.width,this.height=l.height,this._onCharSizeChange.fire())}};o.CharSizeService=T=v([y(2,f.IOptionsService)],T);class w extends x.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,g){u!==void 0&&u>0&&g!==void 0&&g>0&&(this._result.width=u,this._result.height=g)}}class c extends w{constructor(u,g,C){super(),this._document=u,this._parentElement=g,this._optionsService=C,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}}class h extends w{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const g=this._ctx.measureText("W");if(!("width"in g&&"fontBoundingBoxAscent"in g&&"fontBoundingBoxDescent"in g))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const u=this._ctx.measureText("W");return this._validateAndSet(u.width,u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),this._result}}},4269:function(R,o,d){var v=this&&this.__decorate||function(h,l,u,g){var C,k=arguments.length,D=k<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(h,l,u,g);else for(var E=h.length-1;E>=0;E--)(C=h[E])&&(D=(k<3?C(D):k>3?C(l,u,D):C(l,u))||D);return k>3&&D&&Object.defineProperty(l,u,D),D},y=this&&this.__param||function(h,l){return function(u,g){l(u,g,h)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const f=d(3734),S=d(643),x=d(511),T=d(2585);class w extends f.AttributeData{constructor(l,u,g){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=u,this._width=g}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=w;let c=o.CharacterJoinerService=class _p{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new x.CellData}register(l){const u={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(u),u.id}deregister(l){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===l)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];const u=this._bufferService.buffer.lines.get(l);if(!u||u.length===0)return[];const g=[],C=u.translateToString(!0);let k=0,D=0,E=0,N=u.getFg(0),V=u.getBg(0);for(let q=0;q<u.getTrimmedLength();q++)if(u.loadCell(q,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==N||this._workCell.bg!==V){if(q-k>1){const O=this._getJoinedRanges(C,E,D,u,k);for(let A=0;A<O.length;A++)g.push(O[A])}k=q,E=D,N=this._workCell.fg,V=this._workCell.bg}D+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-k>1){const q=this._getJoinedRanges(C,E,D,u,k);for(let O=0;O<q.length;O++)g.push(q[O])}return g}_getJoinedRanges(l,u,g,C,k){const D=l.substring(u,g);let E=[];try{E=this._characterJoiners[0].handler(D)}catch(N){console.error(N)}for(let N=1;N<this._characterJoiners.length;N++)try{const V=this._characterJoiners[N].handler(D);for(let q=0;q<V.length;q++)_p._mergeRanges(E,V[q])}catch(V){console.error(V)}return this._stringRangesToCellRanges(E,C,k),E}_stringRangesToCellRanges(l,u,g){let C=0,k=!1,D=0,E=l[C];if(E){for(let N=g;N<this._bufferService.cols;N++){const V=u.getWidth(N),q=u.getString(N).length||S.WHITESPACE_CELL_CHAR.length;if(V!==0){if(!k&&E[0]<=D&&(E[0]=N,k=!0),E[1]<=D){if(E[1]=N,E=l[++C],!E)break;E[0]<=D?(E[0]=N,k=!0):k=!1}D+=q}}E&&(E[1]=this._bufferService.cols)}}static _mergeRanges(l,u){let g=!1;for(let C=0;C<l.length;C++){const k=l[C];if(g){if(u[1]<=k[0])return l[C-1][1]=u[1],l;if(u[1]<=k[1])return l[C-1][1]=Math.max(u[1],k[1]),l.splice(C,1),l;l.splice(C,1),C--}else{if(u[1]<=k[0])return l.splice(C,0,u),l;if(u[1]<=k[1])return k[0]=Math.min(u[0],k[0]),l;u[0]<k[1]&&(k[0]=Math.min(u[0],k[0]),g=!0)}}return g?l[l.length-1][1]=u[1]:l.push(u),l}};o.CharacterJoinerService=c=v([y(0,T.IBufferService)],c)},5114:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const v=d(844),y=d(8460),f=d(3656);class S extends v.Disposable{constructor(w,c,h){super(),this._textarea=w,this._window=c,this.mainDocument=h,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new x(this._window),this._onDprChange=this.register(new y.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new y.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((l=>this._screenDprMonitor.setWindow(l)))),this.register((0,y.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,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}}o.CoreBrowserService=S;class x extends v.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new v.MutableDisposable),this._onDprChange=this.register(new y.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,v.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,f.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var w;this._outerListener&&((w=this._resolutionMediaMatchList)==null||w.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)}}},779:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const v=d(844);class y extends v.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,v.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(S){return this.linkProviders.push(S),{dispose:()=>{const x=this.linkProviders.indexOf(S);x!==-1&&this.linkProviders.splice(x,1)}}}}o.LinkProviderService=y},8934:function(R,o,d){var v=this&&this.__decorate||function(T,w,c,h){var l,u=arguments.length,g=u<3?w:h===null?h=Object.getOwnPropertyDescriptor(w,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(T,w,c,h);else for(var C=T.length-1;C>=0;C--)(l=T[C])&&(g=(u<3?l(g):u>3?l(w,c,g):l(w,c))||g);return u>3&&g&&Object.defineProperty(w,c,g),g},y=this&&this.__param||function(T,w){return function(c,h){w(c,h,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const f=d(4725),S=d(9806);let x=o.MouseService=class{constructor(T,w){this._renderService=T,this._charSizeService=w}getCoords(T,w,c,h,l){return(0,S.getCoords)(window,T,w,c,h,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(T,w){const c=(0,S.getCoordsRelativeToElement)(window,T,w);if(this._charSizeService.hasValidSize)return c[0]=Math.min(Math.max(c[0],0),this._renderService.dimensions.css.canvas.width-1),c[1]=Math.min(Math.max(c[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(c[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(c[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(c[0]),y:Math.floor(c[1])}}};o.MouseService=x=v([y(0,f.IRenderService),y(1,f.ICharSizeService)],x)},3230:function(R,o,d){var v=this&&this.__decorate||function(l,u,g,C){var k,D=arguments.length,E=D<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(l,u,g,C);else for(var N=l.length-1;N>=0;N--)(k=l[N])&&(E=(D<3?k(E):D>3?k(u,g,E):k(u,g))||E);return D>3&&E&&Object.defineProperty(u,g,E),E},y=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const f=d(6193),S=d(4725),x=d(8460),T=d(844),w=d(7226),c=d(2585);let h=o.RenderService=class extends T.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,u,g,C,k,D,E,N){super(),this._rowCount=l,this._charSizeService=C,this._renderer=this.register(new T.MutableDisposable),this._pausedResizeTask=new w.DebouncedIdleTask,this._observerDisposable=this.register(new T.MutableDisposable),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 x.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new x.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new x.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new x.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f.RenderDebouncer(((V,q)=>this._renderRows(V,q)),E),this.register(this._renderDebouncer),this.register(E.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var V;return(V=this._renderer.value)==null?void 0:V.clear()}))),this.register(g.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(k.onDecorationRegistered((()=>this._fullRefresh()))),this.register(k.onDecorationRemoved((()=>this._fullRefresh()))),this.register(g.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(g.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(N.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(E.window,u),this.register(E.onWindowChange((V=>this._registerIntersectionObserver(V,u))))}_registerIntersectionObserver(l,u){if("IntersectionObserver"in l){const g=new l.IntersectionObserver((C=>this._handleIntersectionChange(C[C.length-1])),{threshold:0});g.observe(u),this._observerDisposable.value=(0,T.toDisposable)((()=>g.disconnect()))}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.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(l,u,g=!1){this._isPaused?this._needsFullRefresh=!0:(g||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,u,this._rowCount))}_renderRows(l,u){this._renderer.value&&(l=Math.min(l,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(l,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:l,end:u}),this._onRender.fire({start:l,end:u}),this._isNextRenderRedrawOnly=!0)}resize(l,u){this._rowCount=u,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(l){this._renderer.value=l,this._renderer.value&&(this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var l,u;this._renderer.value&&((u=(l=this._renderer.value).clearTextureAtlas)==null||u.call(l),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(l,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var g;return(g=this._renderer.value)==null?void 0:g.handleResize(l,u)})):this._renderer.value.handleResize(l,u),this._fullRefresh())}handleCharSizeChanged(){var l;(l=this._renderer.value)==null||l.handleCharSizeChanged()}handleBlur(){var l;(l=this._renderer.value)==null||l.handleBlur()}handleFocus(){var l;(l=this._renderer.value)==null||l.handleFocus()}handleSelectionChanged(l,u,g){var C;this._selectionState.start=l,this._selectionState.end=u,this._selectionState.columnSelectMode=g,(C=this._renderer.value)==null||C.handleSelectionChanged(l,u,g)}handleCursorMove(){var l;(l=this._renderer.value)==null||l.handleCursorMove()}clear(){var l;(l=this._renderer.value)==null||l.clear()}};o.RenderService=h=v([y(2,c.IOptionsService),y(3,S.ICharSizeService),y(4,c.IDecorationService),y(5,c.IBufferService),y(6,S.ICoreBrowserService),y(7,S.IThemeService)],h)},9312:function(R,o,d){var v=this&&this.__decorate||function(E,N,V,q){var O,A=arguments.length,U=A<3?N:q===null?q=Object.getOwnPropertyDescriptor(N,V):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(E,N,V,q);else for(var z=E.length-1;z>=0;z--)(O=E[z])&&(U=(A<3?O(U):A>3?O(N,V,U):O(N,V))||U);return A>3&&U&&Object.defineProperty(N,V,U),U},y=this&&this.__param||function(E,N){return function(V,q){N(V,q,E)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const f=d(9806),S=d(9504),x=d(456),T=d(4725),w=d(8460),c=d(844),h=d(6114),l=d(4841),u=d(511),g=d(2585),C=" ",k=new RegExp(C,"g");let D=o.SelectionService=class extends c.Disposable{constructor(E,N,V,q,O,A,U,z,K){super(),this._element=E,this._screenElement=N,this._linkifier=V,this._bufferService=q,this._coreService=O,this._mouseService=A,this._optionsService=U,this._renderService=z,this._coreBrowserService=K,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new w.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Y=>this._handleMouseMove(Y),this._mouseUpListener=Y=>this._handleMouseUp(Y),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Y=>this._handleTrim(Y))),this.register(this._bufferService.buffers.onBufferActivate((Y=>this._handleBufferActivate(Y)))),this.enable(),this._model=new x.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,c.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const E=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!(!E||!N||E[0]===N[0]&&E[1]===N[1])}get selectionText(){const E=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;if(!E||!N)return"";const V=this._bufferService.buffer,q=[];if(this._activeSelectionMode===3){if(E[0]===N[0])return"";const O=E[0]<N[0]?E[0]:N[0],A=E[0]<N[0]?N[0]:E[0];for(let U=E[1];U<=N[1];U++){const z=V.translateBufferLineToString(U,!0,O,A);q.push(z)}}else{const O=E[1]===N[1]?N[0]:void 0;q.push(V.translateBufferLineToString(E[1],!0,E[0],O));for(let A=E[1]+1;A<=N[1]-1;A++){const U=V.lines.get(A),z=V.translateBufferLineToString(A,!0);U!=null&&U.isWrapped?q[q.length-1]+=z:q.push(z)}if(E[1]!==N[1]){const A=V.lines.get(N[1]),U=V.translateBufferLineToString(N[1],!0,0,N[0]);A&&A.isWrapped?q[q.length-1]+=U:q.push(U)}}return q.map((O=>O.replace(k," "))).join(h.isWindows?`\r
56
+ `:`
57
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(E){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),h.isLinux&&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){const N=this._getMouseBufferCoords(E),V=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!!(V&&q&&N)&&this._areCoordsInSelection(N,V,q)}isCellInSelection(E,N){const V=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!(!V||!q)&&this._areCoordsInSelection([E,N],V,q)}_areCoordsInSelection(E,N,V){return E[1]>N[1]&&E[1]<V[1]||N[1]===V[1]&&E[1]===N[1]&&E[0]>=N[0]&&E[0]<V[0]||N[1]<V[1]&&E[1]===V[1]&&E[0]<V[0]||N[1]<V[1]&&E[1]===N[1]&&E[0]>=N[0]}_selectWordAtCursor(E,N){var O,A;const V=(A=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:A.range;if(V)return this._model.selectionStart=[V.start.x-1,V.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(V,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const q=this._getMouseBufferCoords(E);return!!q&&(this._selectWordAt(q,N),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(E,N){this._model.clearSelection(),E=Math.max(E,0),N=Math.min(N,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,E],this._model.selectionEnd=[this._bufferService.cols,N],this.refresh(),this._onSelectionChange.fire()}_handleTrim(E){this._model.handleTrim(E)&&this.refresh()}_getMouseBufferCoords(E){const N=this._mouseService.getCoords(E,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(N)return N[0]--,N[1]--,N[1]+=this._bufferService.buffer.ydisp,N}_getMouseEventScrollAmount(E){let N=(0,f.getCoordsRelativeToElement)(this._coreBrowserService.window,E,this._screenElement)[1];const V=this._renderService.dimensions.css.canvas.height;return N>=0&&N<=V?0:(N>V&&(N-=V),N=Math.min(Math.max(N,-50),50),N/=50,N/Math.abs(N)+Math.round(14*N))}shouldForceSelection(E){return h.isMac?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()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(E){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(E))}_handleSingleClick(E){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(E)?3:0,this._model.selectionStart=this._getMouseBufferCoords(E),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const N=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);N&&N.length!==this._model.selectionStart[0]&&N.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(E){this._selectWordAtCursor(E,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(E){const N=this._getMouseBufferCoords(E);N&&(this._activeSelectionMode=2,this._selectLineAt(N[1]))}shouldColumnSelect(E){return E.altKey&&!(h.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(E){if(E.stopImmediatePropagation(),!this._model.selectionStart)return;const N=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(E),!this._model.selectionEnd)return void this.refresh(!0);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));const V=this._bufferService.buffer;if(this._model.selectionEnd[1]<V.lines.length){const q=V.lines.get(this._model.selectionEnd[1]);q&&q.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}N&&N[0]===this._model.selectionEnd[0]&&N[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});const 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){const N=E.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&N<500&&E.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const V=this._mouseService.getCoords(E,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(V&&V[0]!==void 0&&V[1]!==void 0){const q=(0,S.moveToCellSequence)(V[0]-1,V[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(q,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const E=this._model.finalSelectionStart,N=this._model.finalSelectionEnd,V=!(!E||!N||E[0]===N[0]&&E[1]===N[1]);V?E&&N&&(this._oldSelectionStart&&this._oldSelectionEnd&&E[0]===this._oldSelectionStart[0]&&E[1]===this._oldSelectionStart[1]&&N[0]===this._oldSelectionEnd[0]&&N[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(E,N,V)):this._oldHasSelection&&this._fireOnSelectionChange(E,N,V)}_fireOnSelectionChange(E,N,V){this._oldSelectionStart=E,this._oldSelectionEnd=N,this._oldHasSelection=V,this._onSelectionChange.fire()}_handleBufferActivate(E){this.clearSelection(),this._trimListener.dispose(),this._trimListener=E.activeBuffer.lines.onTrim((N=>this._handleTrim(N)))}_convertViewportColToCharacterIndex(E,N){let V=N;for(let q=0;N>=q;q++){const O=E.loadCell(q,this._workCell).getChars().length;this._workCell.getWidth()===0?V--:O>1&&N!==q&&(V+=O-1)}return V}setSelection(E,N,V){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[E,N],this._model.selectionStartLength=V,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(E){this._isClickInSelection(E)||(this._selectWordAtCursor(E,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(E,N,V=!0,q=!0){if(E[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,A=O.lines.get(E[1]);if(!A)return;const U=O.translateBufferLineToString(E[1],!1);let z=this._convertViewportColToCharacterIndex(A,E[0]),K=z;const Y=E[0]-z;let W=0,B=0,I=0,P=0;if(U.charAt(z)===" "){for(;z>0&&U.charAt(z-1)===" ";)z--;for(;K<U.length&&U.charAt(K+1)===" ";)K++}else{let se=E[0],le=E[0];A.getWidth(se)===0&&(W++,se--),A.getWidth(le)===2&&(B++,le++);const de=A.getString(le).length;for(de>1&&(P+=de-1,K+=de-1);se>0&&z>0&&!this._isCharWordSeparator(A.loadCell(se-1,this._workCell));){A.loadCell(se-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(W++,se--):X>1&&(I+=X-1,z-=X-1),z--,se--}for(;le<A.length&&K+1<U.length&&!this._isCharWordSeparator(A.loadCell(le+1,this._workCell));){A.loadCell(le+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(B++,le++):X>1&&(P+=X-1,K+=X-1),K++,le++}}K++;let H=z+Y-W+I,J=Math.min(this._bufferService.cols,K-z+W+B-I-P);if(N||U.slice(z,K).trim()!==""){if(V&&H===0&&A.getCodePoint(0)!==32){const se=O.lines.get(E[1]-1);if(se&&A.isWrapped&&se.getCodePoint(this._bufferService.cols-1)!==32){const le=this._getWordAt([this._bufferService.cols-1,E[1]-1],!1,!0,!1);if(le){const de=this._bufferService.cols-le.start;H-=de,J+=de}}}if(q&&H+J===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){const se=O.lines.get(E[1]+1);if(se!=null&&se.isWrapped&&se.getCodePoint(0)!==32){const le=this._getWordAt([0,E[1]+1],!1,!1,!0);le&&(J+=le.length)}}return{start:H,length:J}}}_selectWordAt(E,N){const V=this._getWordAt(E,N);if(V){for(;V.start<0;)V.start+=this._bufferService.cols,E[1]--;this._model.selectionStart=[V.start,E[1]],this._model.selectionStartLength=V.length}}_selectToWordAt(E){const N=this._getWordAt(E,!0);if(N){let V=E[1];for(;N.start<0;)N.start+=this._bufferService.cols,V--;if(!this._model.areSelectionValuesReversed())for(;N.start+N.length>this._bufferService.cols;)N.length-=this._bufferService.cols,V++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?N.start:N.start+N.length,V]}}_isCharWordSeparator(E){return E.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(E.getChars())>=0}_selectLineAt(E){const N=this._bufferService.buffer.getWrappedRangeForLine(E),V={start:{x:0,y:N.first},end:{x:this._bufferService.cols-1,y:N.last}};this._model.selectionStart=[0,N.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(V,this._bufferService.cols)}};o.SelectionService=D=v([y(3,g.IBufferService),y(4,g.ICoreService),y(5,T.IMouseService),y(6,g.IOptionsService),y(7,T.IRenderService),y(8,T.ICoreBrowserService)],D)},4725:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const v=d(8343);o.ICharSizeService=(0,v.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,v.createDecorator)("CoreBrowserService"),o.IMouseService=(0,v.createDecorator)("MouseService"),o.IRenderService=(0,v.createDecorator)("RenderService"),o.ISelectionService=(0,v.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,v.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,v.createDecorator)("ThemeService"),o.ILinkProviderService=(0,v.createDecorator)("LinkProviderService")},6731:function(R,o,d){var v=this&&this.__decorate||function(D,E,N,V){var q,O=arguments.length,A=O<3?E:V===null?V=Object.getOwnPropertyDescriptor(E,N):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(D,E,N,V);else for(var U=D.length-1;U>=0;U--)(q=D[U])&&(A=(O<3?q(A):O>3?q(E,N,A):q(E,N))||A);return O>3&&A&&Object.defineProperty(E,N,A),A},y=this&&this.__param||function(D,E){return function(N,V){E(N,V,D)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const f=d(7239),S=d(8055),x=d(8460),T=d(844),w=d(2585),c=S.css.toColor("#ffffff"),h=S.css.toColor("#000000"),l=S.css.toColor("#ffffff"),u=S.css.toColor("#000000"),g={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[S.css.toColor("#2e3436"),S.css.toColor("#cc0000"),S.css.toColor("#4e9a06"),S.css.toColor("#c4a000"),S.css.toColor("#3465a4"),S.css.toColor("#75507b"),S.css.toColor("#06989a"),S.css.toColor("#d3d7cf"),S.css.toColor("#555753"),S.css.toColor("#ef2929"),S.css.toColor("#8ae234"),S.css.toColor("#fce94f"),S.css.toColor("#729fcf"),S.css.toColor("#ad7fa8"),S.css.toColor("#34e2e2"),S.css.toColor("#eeeeec")],E=[0,95,135,175,215,255];for(let N=0;N<216;N++){const V=E[N/36%6|0],q=E[N/6%6|0],O=E[N%6];D.push({css:S.channels.toCss(V,q,O),rgba:S.channels.toRgba(V,q,O)})}for(let N=0;N<24;N++){const V=8+10*N;D.push({css:S.channels.toCss(V,V,V),rgba:S.channels.toRgba(V,V,V)})}return D})());let C=o.ThemeService=class extends T.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new f.ColorContrastCache,this._halfContrastCache=new f.ColorContrastCache,this._onChangeColors=this.register(new x.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:h,cursor:l,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:g,selectionBackgroundOpaque:S.color.blend(h,g),selectionInactiveBackgroundTransparent:g,selectionInactiveBackgroundOpaque:S.color.blend(h,g),ansi:o.DEFAULT_ANSI_COLORS.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))))}_setTheme(D={}){const E=this._colors;if(E.foreground=k(D.foreground,c),E.background=k(D.background,h),E.cursor=k(D.cursor,l),E.cursorAccent=k(D.cursorAccent,u),E.selectionBackgroundTransparent=k(D.selectionBackground,g),E.selectionBackgroundOpaque=S.color.blend(E.background,E.selectionBackgroundTransparent),E.selectionInactiveBackgroundTransparent=k(D.selectionInactiveBackground,E.selectionBackgroundTransparent),E.selectionInactiveBackgroundOpaque=S.color.blend(E.background,E.selectionInactiveBackgroundTransparent),E.selectionForeground=D.selectionForeground?k(D.selectionForeground,S.NULL_COLOR):void 0,E.selectionForeground===S.NULL_COLOR&&(E.selectionForeground=void 0),S.color.isOpaque(E.selectionBackgroundTransparent)&&(E.selectionBackgroundTransparent=S.color.opacity(E.selectionBackgroundTransparent,.3)),S.color.isOpaque(E.selectionInactiveBackgroundTransparent)&&(E.selectionInactiveBackgroundTransparent=S.color.opacity(E.selectionInactiveBackgroundTransparent,.3)),E.ansi=o.DEFAULT_ANSI_COLORS.slice(),E.ansi[0]=k(D.black,o.DEFAULT_ANSI_COLORS[0]),E.ansi[1]=k(D.red,o.DEFAULT_ANSI_COLORS[1]),E.ansi[2]=k(D.green,o.DEFAULT_ANSI_COLORS[2]),E.ansi[3]=k(D.yellow,o.DEFAULT_ANSI_COLORS[3]),E.ansi[4]=k(D.blue,o.DEFAULT_ANSI_COLORS[4]),E.ansi[5]=k(D.magenta,o.DEFAULT_ANSI_COLORS[5]),E.ansi[6]=k(D.cyan,o.DEFAULT_ANSI_COLORS[6]),E.ansi[7]=k(D.white,o.DEFAULT_ANSI_COLORS[7]),E.ansi[8]=k(D.brightBlack,o.DEFAULT_ANSI_COLORS[8]),E.ansi[9]=k(D.brightRed,o.DEFAULT_ANSI_COLORS[9]),E.ansi[10]=k(D.brightGreen,o.DEFAULT_ANSI_COLORS[10]),E.ansi[11]=k(D.brightYellow,o.DEFAULT_ANSI_COLORS[11]),E.ansi[12]=k(D.brightBlue,o.DEFAULT_ANSI_COLORS[12]),E.ansi[13]=k(D.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),E.ansi[14]=k(D.brightCyan,o.DEFAULT_ANSI_COLORS[14]),E.ansi[15]=k(D.brightWhite,o.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const N=Math.min(E.ansi.length-16,D.extendedAnsi.length);for(let V=0;V<N;V++)E.ansi[V+16]=k(D.extendedAnsi[V],o.DEFAULT_ANSI_COLORS[V+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(D){this._restoreColor(D),this._onChangeColors.fire(this.colors)}_restoreColor(D){if(D!==void 0)switch(D){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[D]=this._restoreColors.ansi[D]}else for(let E=0;E<this._restoreColors.ansi.length;++E)this._colors.ansi[E]=this._restoreColors.ansi[E]}modifyColors(D){D(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function k(D,E){if(D!==void 0)try{return S.css.toColor(D)}catch{}return E}o.ThemeService=C=v([y(0,w.IOptionsService)],C)},6349:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const v=d(8460),y=d(844);class f extends y.Disposable{constructor(x){super(),this._maxLength=x,this.onDeleteEmitter=this.register(new v.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new v.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new v.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(x){if(this._maxLength===x)return;const T=new Array(x);for(let w=0;w<Math.min(x,this.length);w++)T[w]=this._array[this._getCyclicIndex(w)];this._array=T,this._maxLength=x,this._startIndex=0}get length(){return this._length}set length(x){if(x>this._length)for(let T=this._length;T<x;T++)this._array[T]=void 0;this._length=x}get(x){return this._array[this._getCyclicIndex(x)]}set(x,T){this._array[this._getCyclicIndex(x)]=T}push(x){this._array[this._getCyclicIndex(this._length)]=x,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(x,T,...w){if(T){for(let c=x;c<this._length-T;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+T)];this._length-=T,this.onDeleteEmitter.fire({index:x,amount:T})}for(let c=this._length-1;c>=x;c--)this._array[this._getCyclicIndex(c+w.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<w.length;c++)this._array[this._getCyclicIndex(x+c)]=w[c];if(w.length&&this.onInsertEmitter.fire({index:x,amount:w.length}),this._length+w.length>this._maxLength){const c=this._length+w.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=w.length}trimStart(x){x>this._length&&(x=this._length),this._startIndex+=x,this._length-=x,this.onTrimEmitter.fire(x)}shiftElements(x,T,w){if(!(T<=0)){if(x<0||x>=this._length)throw new Error("start argument out of range");if(x+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let h=T-1;h>=0;h--)this.set(x+h+w,this.get(x+h));const c=x+T+w-this._length;if(c>0)for(this._length+=c;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let c=0;c<T;c++)this.set(x+c+w,this.get(x+c))}}_getCyclicIndex(x){return(this._startIndex+x)%this._maxLength}}o.CircularList=f},1439:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function d(v,y=5){if(typeof v!="object")return v;const f=Array.isArray(v)?[]:{};for(const S in v)f[S]=y<=1?v[S]:v[S]&&d(v[S],y-1);return f}},8055:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let d=0,v=0,y=0,f=0;var S,x,T,w,c;function h(u){const g=u.toString(16);return g.length<2?"0"+g:g}function l(u,g){return u<g?(g+.05)/(u+.05):(u+.05)/(g+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(g,C,k,D){return D!==void 0?`#${h(g)}${h(C)}${h(k)}${h(D)}`:`#${h(g)}${h(C)}${h(k)}`},u.toRgba=function(g,C,k,D=255){return(g<<24|C<<16|k<<8|D)>>>0},u.toColor=function(g,C,k,D){return{css:u.toCss(g,C,k,D),rgba:u.toRgba(g,C,k,D)}}})(S||(o.channels=S={})),(function(u){function g(C,k){return f=Math.round(255*k),[d,v,y]=c.toChannels(C.rgba),{css:S.toCss(d,v,y,f),rgba:S.toRgba(d,v,y,f)}}u.blend=function(C,k){if(f=(255&k.rgba)/255,f===1)return{css:k.css,rgba:k.rgba};const D=k.rgba>>24&255,E=k.rgba>>16&255,N=k.rgba>>8&255,V=C.rgba>>24&255,q=C.rgba>>16&255,O=C.rgba>>8&255;return d=V+Math.round((D-V)*f),v=q+Math.round((E-q)*f),y=O+Math.round((N-O)*f),{css:S.toCss(d,v,y),rgba:S.toRgba(d,v,y)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,k,D){const E=c.ensureContrastRatio(C.rgba,k.rgba,D);if(E)return S.toColor(E>>24&255,E>>16&255,E>>8&255)},u.opaque=function(C){const k=(255|C.rgba)>>>0;return[d,v,y]=c.toChannels(k),{css:S.toCss(d,v,y),rgba:k}},u.opacity=g,u.multiplyOpacity=function(C,k){return f=255&C.rgba,g(C,f*k/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(x||(o.color=x={})),(function(u){let g,C;try{const k=document.createElement("canvas");k.width=1,k.height=1;const D=k.getContext("2d",{willReadFrequently:!0});D&&(g=D,g.globalCompositeOperation="copy",C=g.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(k){if(k.match(/#[\da-f]{3,8}/i))switch(k.length){case 4:return d=parseInt(k.slice(1,2).repeat(2),16),v=parseInt(k.slice(2,3).repeat(2),16),y=parseInt(k.slice(3,4).repeat(2),16),S.toColor(d,v,y);case 5:return d=parseInt(k.slice(1,2).repeat(2),16),v=parseInt(k.slice(2,3).repeat(2),16),y=parseInt(k.slice(3,4).repeat(2),16),f=parseInt(k.slice(4,5).repeat(2),16),S.toColor(d,v,y,f);case 7:return{css:k,rgba:(parseInt(k.slice(1),16)<<8|255)>>>0};case 9:return{css:k,rgba:parseInt(k.slice(1),16)>>>0}}const D=k.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return d=parseInt(D[1]),v=parseInt(D[2]),y=parseInt(D[3]),f=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),S.toColor(d,v,y,f);if(!g||!C)throw new Error("css.toColor: Unsupported css format");if(g.fillStyle=C,g.fillStyle=k,typeof g.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(g.fillRect(0,0,1,1),[d,v,y,f]=g.getImageData(0,0,1,1).data,f!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(d,v,y,f),css:k}}})(T||(o.css=T={})),(function(u){function g(C,k,D){const E=C/255,N=k/255,V=D/255;return .2126*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.7152*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.0722*(V<=.03928?V/12.92:Math.pow((V+.055)/1.055,2.4))}u.relativeLuminance=function(C){return g(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=g})(w||(o.rgb=w={})),(function(u){function g(k,D,E){const N=k>>24&255,V=k>>16&255,q=k>>8&255;let O=D>>24&255,A=D>>16&255,U=D>>8&255,z=l(w.relativeLuminance2(O,A,U),w.relativeLuminance2(N,V,q));for(;z<E&&(O>0||A>0||U>0);)O-=Math.max(0,Math.ceil(.1*O)),A-=Math.max(0,Math.ceil(.1*A)),U-=Math.max(0,Math.ceil(.1*U)),z=l(w.relativeLuminance2(O,A,U),w.relativeLuminance2(N,V,q));return(O<<24|A<<16|U<<8|255)>>>0}function C(k,D,E){const N=k>>24&255,V=k>>16&255,q=k>>8&255;let O=D>>24&255,A=D>>16&255,U=D>>8&255,z=l(w.relativeLuminance2(O,A,U),w.relativeLuminance2(N,V,q));for(;z<E&&(O<255||A<255||U<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),A=Math.min(255,A+Math.ceil(.1*(255-A))),U=Math.min(255,U+Math.ceil(.1*(255-U))),z=l(w.relativeLuminance2(O,A,U),w.relativeLuminance2(N,V,q));return(O<<24|A<<16|U<<8|255)>>>0}u.blend=function(k,D){if(f=(255&D)/255,f===1)return D;const E=D>>24&255,N=D>>16&255,V=D>>8&255,q=k>>24&255,O=k>>16&255,A=k>>8&255;return d=q+Math.round((E-q)*f),v=O+Math.round((N-O)*f),y=A+Math.round((V-A)*f),S.toRgba(d,v,y)},u.ensureContrastRatio=function(k,D,E){const N=w.relativeLuminance(k>>8),V=w.relativeLuminance(D>>8);if(l(N,V)<E){if(V<N){const A=g(k,D,E),U=l(N,w.relativeLuminance(A>>8));if(U<E){const z=C(k,D,E);return U>l(N,w.relativeLuminance(z>>8))?A:z}return A}const q=C(k,D,E),O=l(N,w.relativeLuminance(q>>8));if(O<E){const A=g(k,D,E);return O>l(N,w.relativeLuminance(A>>8))?q:A}return q}},u.reduceLuminance=g,u.increaseLuminance=C,u.toChannels=function(k){return[k>>24&255,k>>16&255,k>>8&255,255&k]}})(c||(o.rgba=c={})),o.toPaddedHex=h,o.contrastRatio=l},8969:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const v=d(844),y=d(2585),f=d(4348),S=d(7866),x=d(744),T=d(7302),w=d(6975),c=d(8460),h=d(1753),l=d(1480),u=d(7994),g=d(9282),C=d(5435),k=d(5981),D=d(2660);let E=!1;class N extends v.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((q=>{var O;(O=this._onScrollApi)==null||O.fire(q.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(q){for(const O in q)this.optionsService.options[O]=q[O]}constructor(q){super(),this._windowsWrappingHeuristics=this.register(new v.MutableDisposable),this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new c.EventEmitter),this._instantiationService=new f.InstantiationService,this.optionsService=this.register(new T.OptionsService(q)),this._instantiationService.setService(y.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(x.BufferService)),this._instantiationService.setService(y.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(S.LogService)),this._instantiationService.setService(y.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(y.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(h.CoreMouseService)),this._instantiationService.setService(y.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(y.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(y.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(y.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,c.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,c.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,c.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,c.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new k.WriteBuffer(((O,A)=>this._inputHandler.parse(O,A)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(q,O){this._writeBuffer.write(q,O)}writeSync(q,O){this._logService.logLevel<=y.LogLevelEnum.WARN&&!E&&(this._logService.warn("writeSync is unreliable and will be removed soon."),E=!0),this._writeBuffer.writeSync(q,O)}input(q,O=!0){this.coreService.triggerDataEvent(q,O)}resize(q,O){isNaN(q)||isNaN(O)||(q=Math.max(q,x.MINIMUM_COLS),O=Math.max(O,x.MINIMUM_ROWS),this._bufferService.resize(q,O))}scroll(q,O=!1){this._bufferService.scroll(q,O)}scrollLines(q,O,A){this._bufferService.scrollLines(q,O,A)}scrollPages(q){this.scrollLines(q*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(q){const O=q-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(q,O){return this._inputHandler.registerEscHandler(q,O)}registerDcsHandler(q,O){return this._inputHandler.registerDcsHandler(q,O)}registerCsiHandler(q,O){return this._inputHandler.registerCsiHandler(q,O)}registerOscHandler(q,O){return this._inputHandler.registerOscHandler(q,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let q=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?q=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(q=!0),q?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const q=[];q.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null,this._bufferService))),q.push(this.registerCsiHandler({final:"H"},(()=>((0,g.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,v.toDisposable)((()=>{for(const O of q)O.dispose()}))}}}o.CoreTerminal=N},8460:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let v=0;v<this._listeners.length;v++)if(this._listeners[v]===d)return void this._listeners.splice(v,1)}}})),this._event}fire(d,v){const y=[];for(let f=0;f<this._listeners.length;f++)y.push(this._listeners[f]);for(let f=0;f<y.length;f++)y[f].call(void 0,d,v)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(d,v){return d((y=>v.fire(y)))},o.runAndSubscribe=function(d,v){return v(void 0),d((y=>v(y)))}},5435:function(R,o,d){var v=this&&this.__decorate||function(W,B,I,P){var H,J=arguments.length,se=J<3?B:P===null?P=Object.getOwnPropertyDescriptor(B,I):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")se=Reflect.decorate(W,B,I,P);else for(var le=W.length-1;le>=0;le--)(H=W[le])&&(se=(J<3?H(se):J>3?H(B,I,se):H(B,I))||se);return J>3&&se&&Object.defineProperty(B,I,se),se},y=this&&this.__param||function(W,B){return function(I,P){B(I,P,W)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const f=d(2584),S=d(7116),x=d(2015),T=d(844),w=d(482),c=d(8437),h=d(8460),l=d(643),u=d(511),g=d(3734),C=d(2585),k=d(1480),D=d(6242),E=d(6351),N=d(5941),V={"(":0,")":1,"*":2,"+":3,"-":1,".":2},q=131072;function O(W,B){if(W>24)return B.setWinLines||!1;switch(W){case 1:return!!B.restoreWin;case 2:return!!B.minimizeWin;case 3:return!!B.setWinPosition;case 4:return!!B.setWinSizePixels;case 5:return!!B.raiseWin;case 6:return!!B.lowerWin;case 7:return!!B.refreshWin;case 8:return!!B.setWinSizeChars;case 9:return!!B.maximizeWin;case 10:return!!B.fullscreenWin;case 11:return!!B.getWinState;case 13:return!!B.getWinPosition;case 14:return!!B.getWinSizePixels;case 15:return!!B.getScreenSizePixels;case 16:return!!B.getCellSizePixels;case 18:return!!B.getWinSizeChars;case 19:return!!B.getScreenSizeChars;case 20:return!!B.getIconTitle;case 21:return!!B.getWinTitle;case 22:return!!B.pushTitle;case 23:return!!B.popTitle;case 24:return!!B.setWinLines}return!1}var A;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(A||(o.WindowsOptionsReportType=A={}));let U=0;class z extends T.Disposable{getAttrData(){return this._curAttrData}constructor(B,I,P,H,J,se,le,de,X=new x.EscapeSequenceParser){super(),this._bufferService=B,this._charsetService=I,this._coreService=P,this._logService=H,this._optionsService=J,this._oscLinkService=se,this._coreMouseService=le,this._unicodeService=de,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new h.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new h.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new h.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new h.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new h.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new h.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new h.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new h.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new h.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new h.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new h.EventEmitter),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 K(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((j=>this._activeBuffer=j.activeBuffer))),this._parser.setCsiHandlerFallback(((j,ne)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(j),params:ne.toArray()})})),this._parser.setEscHandlerFallback((j=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(j)})})),this._parser.setExecuteHandlerFallback((j=>{this._logService.debug("Unknown EXECUTE code: ",{code:j})})),this._parser.setOscHandlerFallback(((j,ne,ee)=>{this._logService.debug("Unknown OSC code: ",{identifier:j,action:ne,data:ee})})),this._parser.setDcsHandlerFallback(((j,ne,ee)=>{ne==="HOOK"&&(ee=ee.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(j),action:ne,payload:ee})})),this._parser.setPrintHandler(((j,ne,ee)=>this.print(j,ne,ee))),this._parser.registerCsiHandler({final:"@"},(j=>this.insertChars(j))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(j=>this.scrollLeft(j))),this._parser.registerCsiHandler({final:"A"},(j=>this.cursorUp(j))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(j=>this.scrollRight(j))),this._parser.registerCsiHandler({final:"B"},(j=>this.cursorDown(j))),this._parser.registerCsiHandler({final:"C"},(j=>this.cursorForward(j))),this._parser.registerCsiHandler({final:"D"},(j=>this.cursorBackward(j))),this._parser.registerCsiHandler({final:"E"},(j=>this.cursorNextLine(j))),this._parser.registerCsiHandler({final:"F"},(j=>this.cursorPrecedingLine(j))),this._parser.registerCsiHandler({final:"G"},(j=>this.cursorCharAbsolute(j))),this._parser.registerCsiHandler({final:"H"},(j=>this.cursorPosition(j))),this._parser.registerCsiHandler({final:"I"},(j=>this.cursorForwardTab(j))),this._parser.registerCsiHandler({final:"J"},(j=>this.eraseInDisplay(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(j=>this.eraseInDisplay(j,!0))),this._parser.registerCsiHandler({final:"K"},(j=>this.eraseInLine(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(j=>this.eraseInLine(j,!0))),this._parser.registerCsiHandler({final:"L"},(j=>this.insertLines(j))),this._parser.registerCsiHandler({final:"M"},(j=>this.deleteLines(j))),this._parser.registerCsiHandler({final:"P"},(j=>this.deleteChars(j))),this._parser.registerCsiHandler({final:"S"},(j=>this.scrollUp(j))),this._parser.registerCsiHandler({final:"T"},(j=>this.scrollDown(j))),this._parser.registerCsiHandler({final:"X"},(j=>this.eraseChars(j))),this._parser.registerCsiHandler({final:"Z"},(j=>this.cursorBackwardTab(j))),this._parser.registerCsiHandler({final:"`"},(j=>this.charPosAbsolute(j))),this._parser.registerCsiHandler({final:"a"},(j=>this.hPositionRelative(j))),this._parser.registerCsiHandler({final:"b"},(j=>this.repeatPrecedingCharacter(j))),this._parser.registerCsiHandler({final:"c"},(j=>this.sendDeviceAttributesPrimary(j))),this._parser.registerCsiHandler({prefix:">",final:"c"},(j=>this.sendDeviceAttributesSecondary(j))),this._parser.registerCsiHandler({final:"d"},(j=>this.linePosAbsolute(j))),this._parser.registerCsiHandler({final:"e"},(j=>this.vPositionRelative(j))),this._parser.registerCsiHandler({final:"f"},(j=>this.hVPosition(j))),this._parser.registerCsiHandler({final:"g"},(j=>this.tabClear(j))),this._parser.registerCsiHandler({final:"h"},(j=>this.setMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(j=>this.setModePrivate(j))),this._parser.registerCsiHandler({final:"l"},(j=>this.resetMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(j=>this.resetModePrivate(j))),this._parser.registerCsiHandler({final:"m"},(j=>this.charAttributes(j))),this._parser.registerCsiHandler({final:"n"},(j=>this.deviceStatus(j))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(j=>this.deviceStatusPrivate(j))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(j=>this.softReset(j))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(j=>this.setCursorStyle(j))),this._parser.registerCsiHandler({final:"r"},(j=>this.setScrollRegion(j))),this._parser.registerCsiHandler({final:"s"},(j=>this.saveCursor(j))),this._parser.registerCsiHandler({final:"t"},(j=>this.windowOptions(j))),this._parser.registerCsiHandler({final:"u"},(j=>this.restoreCursor(j))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(j=>this.insertColumns(j))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(j=>this.deleteColumns(j))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(j=>this.selectProtected(j))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(j=>this.requestMode(j,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(j=>this.requestMode(j,!1))),this._parser.setExecuteHandler(f.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(f.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(f.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(f.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(f.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(f.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(f.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(f.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(f.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler((j=>(this.setTitle(j),this.setIconName(j),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((j=>this.setIconName(j)))),this._parser.registerOscHandler(2,new D.OscHandler((j=>this.setTitle(j)))),this._parser.registerOscHandler(4,new D.OscHandler((j=>this.setOrReportIndexedColor(j)))),this._parser.registerOscHandler(8,new D.OscHandler((j=>this.setHyperlink(j)))),this._parser.registerOscHandler(10,new D.OscHandler((j=>this.setOrReportFgColor(j)))),this._parser.registerOscHandler(11,new D.OscHandler((j=>this.setOrReportBgColor(j)))),this._parser.registerOscHandler(12,new D.OscHandler((j=>this.setOrReportCursorColor(j)))),this._parser.registerOscHandler(104,new D.OscHandler((j=>this.restoreIndexedColor(j)))),this._parser.registerOscHandler(110,new D.OscHandler((j=>this.restoreFgColor(j)))),this._parser.registerOscHandler(111,new D.OscHandler((j=>this.restoreBgColor(j)))),this._parser.registerOscHandler(112,new D.OscHandler((j=>this.restoreCursorColor(j)))),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(const j in S.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:j},(()=>this.selectCharset("("+j))),this._parser.registerEscHandler({intermediates:")",final:j},(()=>this.selectCharset(")"+j))),this._parser.registerEscHandler({intermediates:"*",final:j},(()=>this.selectCharset("*"+j))),this._parser.registerEscHandler({intermediates:"+",final:j},(()=>this.selectCharset("+"+j))),this._parser.registerEscHandler({intermediates:"-",final:j},(()=>this.selectCharset("-"+j))),this._parser.registerEscHandler({intermediates:".",final:j},(()=>this.selectCharset("."+j))),this._parser.registerEscHandler({intermediates:"/",final:j},(()=>this.selectCharset("/"+j)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((j=>(this._logService.error("Parsing error: ",j),j))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new E.DcsHandler(((j,ne)=>this.requestStatusString(j,ne))))}_preserveStack(B,I,P,H){this._parseStack.paused=!0,this._parseStack.cursorStartX=B,this._parseStack.cursorStartY=I,this._parseStack.decodedLength=P,this._parseStack.position=H}_logSlowResolvingAsync(B){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([B,new Promise(((I,P)=>setTimeout((()=>P("#SLOW_TIMEOUT")),5e3)))]).catch((I=>{if(I!=="#SLOW_TIMEOUT")throw I;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(B,I){let P,H=this._activeBuffer.x,J=this._activeBuffer.y,se=0;const le=this._parseStack.paused;if(le){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,I))return this._logSlowResolvingAsync(P),P;H=this._parseStack.cursorStartX,J=this._parseStack.cursorStartY,this._parseStack.paused=!1,B.length>q&&(se=this._parseStack.position+q)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof B=="string"?` "${B}"`:` "${Array.prototype.map.call(B,(j=>String.fromCharCode(j))).join("")}"`),typeof B=="string"?B.split("").map((j=>j.charCodeAt(0))):B),this._parseBuffer.length<B.length&&this._parseBuffer.length<q&&(this._parseBuffer=new Uint32Array(Math.min(B.length,q))),le||this._dirtyRowTracker.clearRange(),B.length>q)for(let j=se;j<B.length;j+=q){const ne=j+q<B.length?j+q:B.length,ee=typeof B=="string"?this._stringDecoder.decode(B.substring(j,ne),this._parseBuffer):this._utf8Decoder.decode(B.subarray(j,ne),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,ee))return this._preserveStack(H,J,ee,j),this._logSlowResolvingAsync(P),P}else if(!le){const j=typeof B=="string"?this._stringDecoder.decode(B,this._parseBuffer):this._utf8Decoder.decode(B,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,j))return this._preserveStack(H,J,j,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===H&&this._activeBuffer.y===J||this._onCursorMove.fire();const de=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(de,this._bufferService.rows-1))}print(B,I,P){let H,J;const se=this._charsetService.charset,le=this._optionsService.rawOptions.screenReaderMode,de=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,j=this._coreService.modes.insertMode,ne=this._curAttrData;let ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-I>0&&ee.getWidth(this._activeBuffer.x-1)===2&&ee.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ne);let ce=this._parser.precedingJoinState;for(let ve=I;ve<P;++ve){if(H=B[ve],H<127&&se){const Te=se[String.fromCharCode(H)];Te&&(H=Te.charCodeAt(0))}const ie=this._unicodeService.charProperties(H,ce);J=k.UnicodeService.extractWidth(ie);const pe=k.UnicodeService.extractShouldJoin(ie),Re=pe?k.UnicodeService.extractWidth(ce):0;if(ce=ie,le&&this._onA11yChar.fire((0,w.stringFromCodePoint)(H)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+J-Re>de){if(X){const Te=ee;let ye=this._activeBuffer.x-Re;for(this._activeBuffer.x=Re,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),ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Re>0&&ee instanceof c.BufferLine&&ee.copyCellsFrom(Te,ye,0,Re,!1);ye<de;)Te.setCellFromCodepoint(ye++,0,1,ne)}else if(this._activeBuffer.x=de-1,J===2)continue}if(pe&&this._activeBuffer.x){const Te=ee.getWidth(this._activeBuffer.x-1)?1:2;ee.addCodepointToCell(this._activeBuffer.x-Te,H,J);for(let ye=J-Re;--ye>=0;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,ne)}else if(j&&(ee.insertCells(this._activeBuffer.x,J-Re,this._activeBuffer.getNullCell(ne)),ee.getWidth(de-1)===2&&ee.setCellFromCodepoint(de-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,ne)),ee.setCellFromCodepoint(this._activeBuffer.x++,H,J,ne),J>0)for(;--J;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,ne)}this._parser.precedingJoinState=ce,this._activeBuffer.x<de&&P-I>0&&ee.getWidth(this._activeBuffer.x)===0&&!ee.hasContent(this._activeBuffer.x)&&ee.setCellFromCodepoint(this._activeBuffer.x,0,1,ne),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(B,I){return B.final!=="t"||B.prefix||B.intermediates?this._parser.registerCsiHandler(B,I):this._parser.registerCsiHandler(B,(P=>!O(P.params[0],this._optionsService.rawOptions.windowOptions)||I(P)))}registerDcsHandler(B,I){return this._parser.registerDcsHandler(B,new E.DcsHandler(I))}registerEscHandler(B,I){return this._parser.registerEscHandler(B,I)}registerOscHandler(B,I){return this._parser.registerOscHandler(B,new D.OscHandler(I))}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 B;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&&((B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&B.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);I.hasWidth(this._activeBuffer.x)&&!I.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const B=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-B),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(B=this._bufferService.cols-1){this._activeBuffer.x=Math.min(B,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(B,I){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=B,this._activeBuffer.y=this._activeBuffer.scrollTop+I):(this._activeBuffer.x=B,this._activeBuffer.y=I),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(B,I){this._restrictCursor(),this._setCursor(this._activeBuffer.x+B,this._activeBuffer.y+I)}cursorUp(B){const I=this._activeBuffer.y-this._activeBuffer.scrollTop;return I>=0?this._moveCursor(0,-Math.min(I,B.params[0]||1)):this._moveCursor(0,-(B.params[0]||1)),!0}cursorDown(B){const I=this._activeBuffer.scrollBottom-this._activeBuffer.y;return I>=0?this._moveCursor(0,Math.min(I,B.params[0]||1)):this._moveCursor(0,B.params[0]||1),!0}cursorForward(B){return this._moveCursor(B.params[0]||1,0),!0}cursorBackward(B){return this._moveCursor(-(B.params[0]||1),0),!0}cursorNextLine(B){return this.cursorDown(B),this._activeBuffer.x=0,!0}cursorPrecedingLine(B){return this.cursorUp(B),this._activeBuffer.x=0,!0}cursorCharAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(B){return this._setCursor(B.length>=2?(B.params[1]||1)-1:0,(B.params[0]||1)-1),!0}charPosAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(B){return this._moveCursor(B.params[0]||1,0),!0}linePosAbsolute(B){return this._setCursor(this._activeBuffer.x,(B.params[0]||1)-1),!0}vPositionRelative(B){return this._moveCursor(0,B.params[0]||1),!0}hVPosition(B){return this.cursorPosition(B),!0}tabClear(B){const I=B.params[0];return I===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:I===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let I=B.params[0]||1;for(;I--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let I=B.params[0]||1;for(;I--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(B){const I=B.params[0];return I===1&&(this._curAttrData.bg|=536870912),I!==2&&I!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(B,I,P,H=!1,J=!1){const se=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);se.replaceCells(I,P,this._activeBuffer.getNullCell(this._eraseAttrData()),J),H&&(se.isWrapped=!1)}_resetBufferLine(B,I=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),I),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+B),P.isWrapped=!1)}eraseInDisplay(B,I=!1){let P;switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,I);P<this._bufferService.rows;P++)this._resetBufferLine(P,I);this._dirtyRowTracker.markDirty(P);break;case 1:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P,0,this._activeBuffer.x+1,!0,I),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,I);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,I);this._dirtyRowTracker.markDirty(0);break;case 3:const H=this._activeBuffer.lines.length-this._bufferService.rows;H>0&&(this._activeBuffer.lines.trimStart(H),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-H,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-H,0),this._onScroll.fire(0))}return!0}eraseInLine(B,I=!1){switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,I);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,I);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,I)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(B){this._restrictCursor();let I=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y,H=this._bufferService.rows-1-this._activeBuffer.scrollBottom,J=this._bufferService.rows-1+this._activeBuffer.ybase-H+1;for(;I--;)this._activeBuffer.lines.splice(J-1,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(B){this._restrictCursor();let I=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y;let H;for(H=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-H;I--;)this._activeBuffer.lines.splice(P,1),this._activeBuffer.lines.splice(H,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(B){this._restrictCursor();const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return I&&(I.insertCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(B){this._restrictCursor();const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return I&&(I.deleteCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(B){let I=B.params[0]||1;for(;I--;)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(B){let I=B.params[0]||1;for(;I--;)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(c.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=B.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);H.deleteCells(0,I,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=B.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);H.insertCells(0,I,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=B.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);H.insertCells(this._activeBuffer.x,I,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=B.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);H.deleteCells(this._activeBuffer.x,I,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(B){this._restrictCursor();const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return I&&(I.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(B.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(B){const I=this._parser.precedingJoinState;if(!I)return!0;const P=B.params[0]||1,H=k.UnicodeService.extractWidth(I),J=this._activeBuffer.x-H,se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(J),le=new Uint32Array(se.length*P);let de=0;for(let j=0;j<se.length;){const ne=se.codePointAt(j)||0;le[de++]=ne,j+=ne>65535?2:1}let X=de;for(let j=1;j<P;++j)le.copyWithin(X,0,de),X+=de;return this.print(le,0,X),!0}sendDeviceAttributesPrimary(B){return B.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(f.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(f.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(B){return B.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(f.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(f.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(B.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(f.C0.ESC+"[>83;40003;0c")),!0}_is(B){return(this._optionsService.rawOptions.termName+"").indexOf(B)===0}setMode(B){for(let I=0;I<B.length;I++)switch(B.params[I]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(B){for(let I=0;I<B.length;I++)switch(B.params[I]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,S.DEFAULT_CHARSET),this._charsetService.setgCharset(1,S.DEFAULT_CHARSET),this._charsetService.setgCharset(2,S.DEFAULT_CHARSET),this._charsetService.setgCharset(3,S.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(B){for(let I=0;I<B.length;I++)switch(B.params[I]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(B){for(let I=0;I<B.length;I++)switch(B.params[I]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),B.params[I]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(B,I){const P=this._coreService.decPrivateModes,{activeProtocol:H,activeEncoding:J}=this._coreMouseService,se=this._coreService,{buffers:le,cols:de}=this._bufferService,{active:X,alt:j}=le,ne=this._optionsService.rawOptions,ee=pe=>pe?1:2,ce=B.params[0];return ve=ce,ie=I?ce===2?4:ce===4?ee(se.modes.insertMode):ce===12?3:ce===20?ee(ne.convertEol):0:ce===1?ee(P.applicationCursorKeys):ce===3?ne.windowOptions.setWinLines?de===80?2:de===132?1:0:0:ce===6?ee(P.origin):ce===7?ee(P.wraparound):ce===8?3:ce===9?ee(H==="X10"):ce===12?ee(ne.cursorBlink):ce===25?ee(!se.isCursorHidden):ce===45?ee(P.reverseWraparound):ce===66?ee(P.applicationKeypad):ce===67?4:ce===1e3?ee(H==="VT200"):ce===1002?ee(H==="DRAG"):ce===1003?ee(H==="ANY"):ce===1004?ee(P.sendFocus):ce===1005?4:ce===1006?ee(J==="SGR"):ce===1015?4:ce===1016?ee(J==="SGR_PIXELS"):ce===1048?1:ce===47||ce===1047||ce===1049?ee(X===j):ce===2004?ee(P.bracketedPasteMode):0,se.triggerDataEvent(`${f.C0.ESC}[${I?"":"?"}${ve};${ie}$y`),!0;var ve,ie}_updateAttrColor(B,I,P,H,J){return I===2?(B|=50331648,B&=-16777216,B|=g.AttributeData.fromColorRGB([P,H,J])):I===5&&(B&=-50331904,B|=33554432|255&P),B}_extractColor(B,I,P){const H=[0,0,-1,0,0,0];let J=0,se=0;do{if(H[se+J]=B.params[I+se],B.hasSubParams(I+se)){const le=B.getSubParams(I+se);let de=0;do H[1]===5&&(J=1),H[se+de+1+J]=le[de];while(++de<le.length&&de+se+1+J<H.length);break}if(H[1]===5&&se+J>=2||H[1]===2&&se+J>=5)break;H[1]&&(J=1)}while(++se+I<B.length&&se+J<H.length);for(let le=2;le<H.length;++le)H[le]===-1&&(H[le]=0);switch(H[0]){case 38:P.fg=this._updateAttrColor(P.fg,H[1],H[3],H[4],H[5]);break;case 48:P.bg=this._updateAttrColor(P.bg,H[1],H[3],H[4],H[5]);break;case 58:P.extended=P.extended.clone(),P.extended.underlineColor=this._updateAttrColor(P.extended.underlineColor,H[1],H[3],H[4],H[5])}return se}_processUnderline(B,I){I.extended=I.extended.clone(),(!~B||B>5)&&(B=1),I.extended.underlineStyle=B,I.fg|=268435456,B===0&&(I.fg&=-268435457),I.updateExtended()}_processSGR0(B){B.fg=c.DEFAULT_ATTR_DATA.fg,B.bg=c.DEFAULT_ATTR_DATA.bg,B.extended=B.extended.clone(),B.extended.underlineStyle=0,B.extended.underlineColor&=-67108864,B.updateExtended()}charAttributes(B){if(B.length===1&&B.params[0]===0)return this._processSGR0(this._curAttrData),!0;const I=B.length;let P;const H=this._curAttrData;for(let J=0;J<I;J++)P=B.params[J],P>=30&&P<=37?(H.fg&=-50331904,H.fg|=16777216|P-30):P>=40&&P<=47?(H.bg&=-50331904,H.bg|=16777216|P-40):P>=90&&P<=97?(H.fg&=-50331904,H.fg|=16777224|P-90):P>=100&&P<=107?(H.bg&=-50331904,H.bg|=16777224|P-100):P===0?this._processSGR0(H):P===1?H.fg|=134217728:P===3?H.bg|=67108864:P===4?(H.fg|=268435456,this._processUnderline(B.hasSubParams(J)?B.getSubParams(J)[0]:1,H)):P===5?H.fg|=536870912:P===7?H.fg|=67108864:P===8?H.fg|=1073741824:P===9?H.fg|=2147483648:P===2?H.bg|=134217728:P===21?this._processUnderline(2,H):P===22?(H.fg&=-134217729,H.bg&=-134217729):P===23?H.bg&=-67108865:P===24?(H.fg&=-268435457,this._processUnderline(0,H)):P===25?H.fg&=-536870913:P===27?H.fg&=-67108865:P===28?H.fg&=-1073741825:P===29?H.fg&=2147483647:P===39?(H.fg&=-67108864,H.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):P===49?(H.bg&=-67108864,H.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):P===38||P===48||P===58?J+=this._extractColor(B,J,H):P===53?H.bg|=1073741824:P===55?H.bg&=-1073741825:P===59?(H.extended=H.extended.clone(),H.extended.underlineColor=-1,H.updateExtended()):P===100?(H.fg&=-67108864,H.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,H.bg&=-67108864,H.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",P);return!0}deviceStatus(B){switch(B.params[0]){case 5:this._coreService.triggerDataEvent(`${f.C0.ESC}[0n`);break;case 6:const I=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[${I};${P}R`)}return!0}deviceStatusPrivate(B){if(B.params[0]===6){const I=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[?${I};${P}R`)}return!0}softReset(B){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=c.DEFAULT_ATTR_DATA.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(B){const I=B.params[0]||1;switch(I){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const P=I%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(B){const I=B.params[0]||1;let P;return(B.length<2||(P=B.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>I&&(this._activeBuffer.scrollTop=I-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(B){if(!O(B.params[0],this._optionsService.rawOptions.windowOptions))return!0;const I=B.length>1?B.params[1]:0;switch(B.params[0]){case 14:I!==2&&this._onRequestWindowsOptionsReport.fire(A.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(A.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${f.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:I!==0&&I!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),I!==0&&I!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:I!==0&&I!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),I!==0&&I!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(B){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(B){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(B){return this._windowTitle=B,this._onTitleChange.fire(B),!0}setIconName(B){return this._iconName=B,!0}setOrReportIndexedColor(B){const I=[],P=B.split(";");for(;P.length>1;){const H=P.shift(),J=P.shift();if(/^\d+$/.exec(H)){const se=parseInt(H);if(Y(se))if(J==="?")I.push({type:0,index:se});else{const le=(0,N.parseColor)(J);le&&I.push({type:1,index:se,color:le})}}}return I.length&&this._onColor.fire(I),!0}setHyperlink(B){const I=B.split(";");return!(I.length<2)&&(I[1]?this._createHyperlink(I[0],I[1]):!I[0]&&this._finishHyperlink())}_createHyperlink(B,I){this._getCurrentLinkId()&&this._finishHyperlink();const P=B.split(":");let H;const J=P.findIndex((se=>se.startsWith("id=")));return J!==-1&&(H=P[J].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:H,uri:I}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(B,I){const P=B.split(";");for(let H=0;H<P.length&&!(I>=this._specialColors.length);++H,++I)if(P[H]==="?")this._onColor.fire([{type:0,index:this._specialColors[I]}]);else{const J=(0,N.parseColor)(P[H]);J&&this._onColor.fire([{type:1,index:this._specialColors[I],color:J}])}return!0}setOrReportFgColor(B){return this._setOrReportSpecialColor(B,0)}setOrReportBgColor(B){return this._setOrReportSpecialColor(B,1)}setOrReportCursorColor(B){return this._setOrReportSpecialColor(B,2)}restoreIndexedColor(B){if(!B)return this._onColor.fire([{type:2}]),!0;const I=[],P=B.split(";");for(let H=0;H<P.length;++H)if(/^\d+$/.exec(P[H])){const J=parseInt(P[H]);Y(J)&&I.push({type:2,index:J})}return I.length&&this._onColor.fire(I),!0}restoreFgColor(B){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(B){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(B){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,S.DEFAULT_CHARSET),!0}selectCharset(B){return B.length!==2?(this.selectDefaultCharset(),!0):(B[0]==="/"||this._charsetService.setgCharset(V[B[0]],S.CHARSETS[B[1]]||S.DEFAULT_CHARSET),!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){const B=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,B,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=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(B){return this._charsetService.setgLevel(B),!0}screenAlignmentPattern(){const B=new u.CellData;B.content=4194373,B.fg=this._curAttrData.fg,B.bg=this._curAttrData.bg,this._setCursor(0,0);for(let I=0;I<this._bufferService.rows;++I){const P=this._activeBuffer.ybase+this._activeBuffer.y+I,H=this._activeBuffer.lines.get(P);H&&(H.fill(B),H.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(B,I){const P=this._bufferService.buffer,H=this._optionsService.rawOptions;return(J=>(this._coreService.triggerDataEvent(`${f.C0.ESC}${J}${f.C0.ESC}\\`),!0))(B==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:B==='"p'?'P1$r61;1"p':B==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:B==="m"?"P1$r0m":B===" q"?`P1$r${{block:2,underline:4,bar:6}[H.cursorStyle]-(H.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(B,I){this._dirtyRowTracker.markRangeDirty(B,I)}}o.InputHandler=z;let K=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,B){W>B&&(U=W,W=B,B=U),W<this.start&&(this.start=W),B>this.end&&(this.end=B)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Y(W){return 0<=W&&W<256}K=v([y(0,C.IBufferService)],K)},844:(R,o)=>{function d(v){for(const y of v)y.dispose();v.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const v of this._disposables)v.dispose();this._disposables.length=0}register(v){return this._disposables.push(v),v}unregister(v){const y=this._disposables.indexOf(v);y!==-1&&this._disposables.splice(y,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(v){var y;this._isDisposed||v===this._value||((y=this._value)==null||y.dispose(),this._value=v)}clear(){this.value=void 0}dispose(){var v;this._isDisposed=!0,(v=this._value)==null||v.dispose(),this._value=void 0}},o.toDisposable=function(v){return{dispose:v}},o.disposeArray=d,o.getDisposeArrayDisposable=function(v){return{dispose:()=>d(v)}}},1505:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(y,f,S){this._data[y]||(this._data[y]={}),this._data[y][f]=S}get(y,f){return this._data[y]?this._data[y][f]:void 0}clear(){this._data={}}}o.TwoKeyMap=d,o.FourKeyMap=class{constructor(){this._data=new d}set(v,y,f,S,x){this._data.get(v,y)||this._data.set(v,y,new d),this._data.get(v,y).set(f,S,x)}get(v,y,f,S){var x;return(x=this._data.get(v,y))==null?void 0:x.get(f,S)}clear(){this._data.clear()}}},6114:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const d=o.isNode?"node":navigator.userAgent,v=o.isNode?"node":navigator.platform;o.isFirefox=d.includes("Firefox"),o.isLegacyEdge=d.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(d),o.getSafariVersion=function(){if(!o.isSafari)return 0;const y=d.match(/Version\/(\d+)/);return y===null||y.length<2?0:parseInt(y[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(v),o.isIpad=v==="iPad",o.isIphone=v==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(v),o.isLinux=v.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(d)},6106:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let d=0;o.SortedList=class{constructor(v){this._getKey=v,this._array=[]}clear(){this._array.length=0}insert(v){this._array.length!==0?(d=this._search(this._getKey(v)),this._array.splice(d,0,v)):this._array.push(v)}delete(v){if(this._array.length===0)return!1;const y=this._getKey(v);if(y===void 0||(d=this._search(y),d===-1)||this._getKey(this._array[d])!==y)return!1;do if(this._array[d]===v)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===y);return!1}*getKeyIterator(v){if(this._array.length!==0&&(d=this._search(v),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===v))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===v)}forEachByKey(v,y){if(this._array.length!==0&&(d=this._search(v),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===v))do y(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===v)}values(){return[...this._array].values()}_search(v){let y=0,f=this._array.length-1;for(;f>=y;){let S=y+f>>1;const x=this._getKey(this._array[S]);if(x>v)f=S-1;else{if(!(x<v)){for(;S>0&&this._getKey(this._array[S-1])===v;)S--;return S}y=S+1}}return y}}},7226:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const v=d(6114);class y{constructor(){this._tasks=[],this._i=0}enqueue(x){this._tasks.push(x),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(x){this._idleCallback=void 0;let T=0,w=0,c=x.timeRemaining(),h=0;for(;this._i<this._tasks.length;){if(T=Date.now(),this._tasks[this._i]()||this._i++,T=Math.max(1,Date.now()-T),w=Math.max(T,w),h=x.timeRemaining(),1.5*w>h)return c-T<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-T))}ms`),void this._start();c=h}this.clear()}}class f extends y{_requestCallback(x){return setTimeout((()=>x(this._createDeadline(16))))}_cancelCallback(x){clearTimeout(x)}_createDeadline(x){const T=Date.now()+x;return{timeRemaining:()=>Math.max(0,T-Date.now())}}}o.PriorityTaskQueue=f,o.IdleTaskQueue=!v.isNode&&"requestIdleCallback"in window?class extends y{_requestCallback(S){return requestIdleCallback(S)}_cancelCallback(S){cancelIdleCallback(S)}}:f,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(S){this._queue.clear(),this._queue.enqueue(S)}flush(){this._queue.flush()}}},9282:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const v=d(643);o.updateWindowsModeWrappedState=function(y){const f=y.buffer.lines.get(y.buffer.ybase+y.buffer.y-1),S=f==null?void 0:f.get(y.cols-1),x=y.buffer.lines.get(y.buffer.ybase+y.buffer.y);x&&S&&(x.isWrapped=S[v.CHAR_DATA_CODE_INDEX]!==v.NULL_CELL_CODE&&S[v.CHAR_DATA_CODE_INDEX]!==v.WHITESPACE_CELL_CODE)}},3734:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new v}static toColorRGB(f){return[f>>>16&255,f>>>8&255,255&f]}static fromColorRGB(f){return(255&f[0])<<16|(255&f[1])<<8|255&f[2]}clone(){const f=new d;return f.fg=this.fg,f.bg=this.bg,f.extended=this.extended.clone(),f}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=d;class v{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(f){this._ext=f}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(f){this._ext&=-469762049,this._ext|=f<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(f){this._ext&=-67108864,this._ext|=67108863&f}get urlId(){return this._urlId}set urlId(f){this._urlId=f}get underlineVariantOffset(){const f=(3758096384&this._ext)>>29;return f<0?4294967288^f:f}set underlineVariantOffset(f){this._ext&=536870911,this._ext|=f<<29&3758096384}constructor(f=0,S=0){this._ext=0,this._urlId=0,this._ext=f,this._urlId=S}clone(){return new v(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=v},9092:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const v=d(6349),y=d(7226),f=d(3734),S=d(8437),x=d(4634),T=d(511),w=d(643),c=d(4863),h=d(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(l,u,g){this._hasScrollback=l,this._optionsService=u,this._bufferService=g,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=S.DEFAULT_ATTR_DATA.clone(),this.savedCharset=h.DEFAULT_CHARSET,this.markers=[],this._nullCell=T.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=T.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new y.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new v.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new f.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new f.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,u){return new S.BufferLine(this._bufferService.cols,this.getNullCell(l),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;const u=l+this._optionsService.rawOptions.scrollback;return u>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:u}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=S.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new v.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,u){const g=this.getNullCell(S.DEFAULT_ATTR_DATA);let C=0;const k=this._getCorrectBufferLength(u);if(k>this.lines.maxLength&&(this.lines.maxLength=k),this.lines.length>0){if(this._cols<l)for(let E=0;E<this.lines.length;E++)C+=+this.lines.get(E).resize(l,g);let D=0;if(this._rows<u)for(let E=this._rows;E<u;E++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new S.BufferLine(l,g)):this.ybase>0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new S.BufferLine(l,g)));else for(let E=this._rows;E>u;E--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(k<this.lines.maxLength){const E=this.lines.length-k;E>0&&(this.lines.trimStart(E),this.ybase=Math.max(this.ybase-E,0),this.ydisp=Math.max(this.ydisp-E,0),this.savedY=Math.max(this.savedY-E,0)),this.lines.maxLength=k}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,u-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(l,u),this._cols>l))for(let D=0;D<this.lines.length;D++)C+=+this.lines.get(D).resize(l,g);this._cols=l,this._rows=u,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return l}get _isReflowEnabled(){const l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,u){this._cols!==l&&(l>this._cols?this._reflowLarger(l,u):this._reflowSmaller(l,u))}_reflowLarger(l,u){const g=(0,x.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(S.DEFAULT_ATTR_DATA));if(g.length>0){const C=(0,x.reflowLargerCreateNewLayout)(this.lines,g);(0,x.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(l,u,C.countRemoved)}}_reflowLargerAdjustViewport(l,u,g){const C=this.getNullCell(S.DEFAULT_ATTR_DATA);let k=g;for(;k-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new S.BufferLine(l,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-g,0)}_reflowSmaller(l,u){const g=this.getNullCell(S.DEFAULT_ATTR_DATA),C=[];let k=0;for(let D=this.lines.length-1;D>=0;D--){let E=this.lines.get(D);if(!E||!E.isWrapped&&E.getTrimmedLength()<=l)continue;const N=[E];for(;E.isWrapped&&D>0;)E=this.lines.get(--D),N.unshift(E);const V=this.ybase+this.y;if(V>=D&&V<D+N.length)continue;const q=N[N.length-1].getTrimmedLength(),O=(0,x.reflowSmallerGetNewLineLengths)(N,this._cols,l),A=O.length-N.length;let U;U=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+A):Math.max(0,this.lines.length-this.lines.maxLength+A);const z=[];for(let P=0;P<A;P++){const H=this.getBlankLine(S.DEFAULT_ATTR_DATA,!0);z.push(H)}z.length>0&&(C.push({start:D+N.length+k,newLines:z}),k+=z.length),N.push(...z);let K=O.length-1,Y=O[K];Y===0&&(K--,Y=O[K]);let W=N.length-A-1,B=q;for(;W>=0;){const P=Math.min(B,Y);if(N[K]===void 0)break;if(N[K].copyCellsFrom(N[W],B-P,Y-P,P,!0),Y-=P,Y===0&&(K--,Y=O[K]),B-=P,B===0){W--;const H=Math.max(W,0);B=(0,x.getWrappedLineTrimmedLength)(N,H,this._cols)}}for(let P=0;P<N.length;P++)O[P]<l&&N[P].setCell(O[P],g);let I=A-U;for(;I-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+k)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+u-1)}if(C.length>0){const D=[],E=[];for(let K=0;K<this.lines.length;K++)E.push(this.lines.get(K));const N=this.lines.length;let V=N-1,q=0,O=C[q];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+k);let A=0;for(let K=Math.min(this.lines.maxLength-1,N+k-1);K>=0;K--)if(O&&O.start>V+A){for(let Y=O.newLines.length-1;Y>=0;Y--)this.lines.set(K--,O.newLines[Y]);K++,D.push({index:V+1,amount:O.newLines.length}),A+=O.newLines.length,O=C[++q]}else this.lines.set(K,E[V--]);let U=0;for(let K=D.length-1;K>=0;K--)D[K].index+=U,this.lines.onInsertEmitter.fire(D[K]),U+=D[K].amount;const z=Math.max(0,N+k-this.lines.maxLength);z>0&&this.lines.onTrimEmitter.fire(z)}}translateBufferLineToString(l,u,g=0,C){const k=this.lines.get(l);return k?k.translateToString(u,g,C):""}getWrappedRangeForLine(l){let u=l,g=l;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;g+1<this.lines.length&&this.lines.get(g+1).isWrapped;)g++;return{first:u,last:g}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===l&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){const u=new c.Marker(l);return this.markers.push(u),u.register(this.lines.onTrim((g=>{u.line-=g,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((g=>{u.line>=g.index&&(u.line+=g.amount)}))),u.register(this.lines.onDelete((g=>{u.line>=g.index&&u.line<g.index+g.amount&&u.dispose(),u.line>g.index&&(u.line-=g.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const v=d(3734),y=d(511),f=d(643),S=d(482);o.DEFAULT_ATTR_DATA=Object.freeze(new v.AttributeData);let x=0;class T{constructor(c,h,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);const u=h||y.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]);for(let g=0;g<c;++g)this.setCell(g,u);this.length=c}get(c){const h=this._data[3*c+0],l=2097151&h;return[this._data[3*c+1],2097152&h?this._combined[c]:l?(0,S.stringFromCodePoint)(l):"",h>>22,2097152&h?this._combined[c].charCodeAt(this._combined[c].length-1):l]}set(c,h){this._data[3*c+1]=h[f.CHAR_DATA_ATTR_INDEX],h[f.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=h[1],this._data[3*c+0]=2097152|c|h[f.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=h[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|h[f.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(c){return this._data[3*c+0]>>22}hasWidth(c){return 12582912&this._data[3*c+0]}getFg(c){return this._data[3*c+1]}getBg(c){return this._data[3*c+2]}hasContent(c){return 4194303&this._data[3*c+0]}getCodePoint(c){const h=this._data[3*c+0];return 2097152&h?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&h}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){const h=this._data[3*c+0];return 2097152&h?this._combined[c]:2097151&h?(0,S.stringFromCodePoint)(2097151&h):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,h){return x=3*c,h.content=this._data[x+0],h.fg=this._data[x+1],h.bg=this._data[x+2],2097152&h.content&&(h.combinedData=this._combined[c]),268435456&h.bg&&(h.extended=this._extendedAttrs[c]),h}setCell(c,h){2097152&h.content&&(this._combined[c]=h.combinedData),268435456&h.bg&&(this._extendedAttrs[c]=h.extended),this._data[3*c+0]=h.content,this._data[3*c+1]=h.fg,this._data[3*c+2]=h.bg}setCellFromCodepoint(c,h,l,u){268435456&u.bg&&(this._extendedAttrs[c]=u.extended),this._data[3*c+0]=h|l<<22,this._data[3*c+1]=u.fg,this._data[3*c+2]=u.bg}addCodepointToCell(c,h,l){let u=this._data[3*c+0];2097152&u?this._combined[c]+=(0,S.stringFromCodePoint)(h):2097151&u?(this._combined[c]=(0,S.stringFromCodePoint)(2097151&u)+(0,S.stringFromCodePoint)(h),u&=-2097152,u|=2097152):u=h|4194304,l&&(u&=-12582913,u|=l<<22),this._data[3*c+0]=u}insertCells(c,h,l){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),h<this.length-c){const u=new y.CellData;for(let g=this.length-c-h-1;g>=0;--g)this.setCell(c+h+g,this.loadCell(c+g,u));for(let g=0;g<h;++g)this.setCell(c+g,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(c,h,l){if(c%=this.length,h<this.length-c){const u=new y.CellData;for(let g=0;g<this.length-c-h;++g)this.setCell(c+g,this.loadCell(c+h+g,u));for(let g=this.length-h;g<this.length;++g)this.setCell(g,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,l)}replaceCells(c,h,l,u=!1){if(u)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,l),h<this.length&&this.getWidth(h-1)===2&&!this.isProtected(h)&&this.setCellFromCodepoint(h,0,1,l);c<h&&c<this.length;)this.isProtected(c)||this.setCell(c,l),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),h<this.length&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h,0,1,l);c<h&&c<this.length;)this.setCell(c++,l)}resize(c,h){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const l=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{const u=new Uint32Array(l);u.set(this._data),this._data=u}for(let u=this.length;u<c;++u)this.setCell(u,h)}else{this._data=this._data.subarray(0,l);const u=Object.keys(this._combined);for(let C=0;C<u.length;C++){const k=parseInt(u[C],10);k>=c&&delete this._combined[k]}const g=Object.keys(this._extendedAttrs);for(let C=0;C<g.length;C++){const k=parseInt(g[C],10);k>=c&&delete this._extendedAttrs[k]}}return this.length=c,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const c=new Uint32Array(this._data.length);return c.set(this._data),this._data=c,1}return 0}fill(c,h=!1){if(h)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,c);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,c)}}copyFrom(c){this.length!==c.length?this._data=new Uint32Array(c._data):this._data.set(c._data),this.length=c.length,this._combined={};for(const h in c._combined)this._combined[h]=c._combined[h];this._extendedAttrs={};for(const h in c._extendedAttrs)this._extendedAttrs[h]=c._extendedAttrs[h];this.isWrapped=c.isWrapped}clone(){const c=new T(0);c._data=new Uint32Array(this._data),c.length=this.length;for(const h in this._combined)c._combined[h]=this._combined[h];for(const h in this._extendedAttrs)c._extendedAttrs[h]=this._extendedAttrs[h];return c.isWrapped=this.isWrapped,c}getTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0])return c+(this._data[3*c+0]>>22);return 0}getNoBgTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0]||50331648&this._data[3*c+2])return c+(this._data[3*c+0]>>22);return 0}copyCellsFrom(c,h,l,u,g){const C=c._data;if(g)for(let D=u-1;D>=0;D--){for(let E=0;E<3;E++)this._data[3*(l+D)+E]=C[3*(h+D)+E];268435456&C[3*(h+D)+2]&&(this._extendedAttrs[l+D]=c._extendedAttrs[h+D])}else for(let D=0;D<u;D++){for(let E=0;E<3;E++)this._data[3*(l+D)+E]=C[3*(h+D)+E];268435456&C[3*(h+D)+2]&&(this._extendedAttrs[l+D]=c._extendedAttrs[h+D])}const k=Object.keys(c._combined);for(let D=0;D<k.length;D++){const E=parseInt(k[D],10);E>=h&&(this._combined[E-h+l]=c._combined[E])}}translateToString(c,h,l,u){h=h??0,l=l??this.length,c&&(l=Math.min(l,this.getTrimmedLength())),u&&(u.length=0);let g="";for(;h<l;){const C=this._data[3*h+0],k=2097151&C,D=2097152&C?this._combined[h]:k?(0,S.stringFromCodePoint)(k):f.WHITESPACE_CELL_CHAR;if(g+=D,u)for(let E=0;E<D.length;++E)u.push(h);h+=C>>22||1}return u&&u.push(h),g}}o.BufferLine=T},4841:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(d,v){if(d.start.y>d.end.y)throw new Error(`Buffer range end (${d.end.x}, ${d.end.y}) cannot be before start (${d.start.x}, ${d.start.y})`);return v*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(R,o)=>{function d(v,y,f){if(y===v.length-1)return v[y].getTrimmedLength();const S=!v[y].hasContent(f-1)&&v[y].getWidth(f-1)===1,x=v[y+1].getWidth(0)===2;return S&&x?f-1:f}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(v,y,f,S,x){const T=[];for(let w=0;w<v.length-1;w++){let c=w,h=v.get(++c);if(!h.isWrapped)continue;const l=[v.get(w)];for(;c<v.length&&h.isWrapped;)l.push(h),h=v.get(++c);if(S>=w&&S<c){w+=l.length-1;continue}let u=0,g=d(l,u,y),C=1,k=0;for(;C<l.length;){const E=d(l,C,y),N=E-k,V=f-g,q=Math.min(N,V);l[u].copyCellsFrom(l[C],k,g,q,!1),g+=q,g===f&&(u++,g=0),k+=q,k===E&&(C++,k=0),g===0&&u!==0&&l[u-1].getWidth(f-1)===2&&(l[u].copyCellsFrom(l[u-1],f-1,g++,1,!1),l[u-1].setCell(f-1,x))}l[u].replaceCells(g,f,x);let D=0;for(let E=l.length-1;E>0&&(E>u||l[E].getTrimmedLength()===0);E--)D++;D>0&&(T.push(w+l.length-D),T.push(D)),w+=l.length-1}return T},o.reflowLargerCreateNewLayout=function(v,y){const f=[];let S=0,x=y[S],T=0;for(let w=0;w<v.length;w++)if(x===w){const c=y[++S];v.onDeleteEmitter.fire({index:w-T,amount:c}),w+=c-1,T+=c,x=y[++S]}else f.push(w);return{layout:f,countRemoved:T}},o.reflowLargerApplyNewLayout=function(v,y){const f=[];for(let S=0;S<y.length;S++)f.push(v.get(y[S]));for(let S=0;S<f.length;S++)v.set(S,f[S]);v.length=y.length},o.reflowSmallerGetNewLineLengths=function(v,y,f){const S=[],x=v.map(((h,l)=>d(v,l,y))).reduce(((h,l)=>h+l));let T=0,w=0,c=0;for(;c<x;){if(x-c<f){S.push(x-c);break}T+=f;const h=d(v,w,y);T>h&&(T-=h,w++);const l=v[w].getWidth(T-1)===2;l&&T--;const u=l?f-1:f;S.push(u),c+=u}return S},o.getWrappedLineTrimmedLength=d},5295:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const v=d(8460),y=d(844),f=d(9092);class S extends y.Disposable{constructor(T,w){super(),this._optionsService=T,this._bufferService=w,this._onBufferActivate=this.register(new v.EventEmitter),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 f.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new f.Buffer(!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(T){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(T),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(T,w){this._normal.resize(T,w),this._alt.resize(T,w),this.setupTabStops(T)}setupTabStops(T){this._normal.setupTabStops(T),this._alt.setupTabStops(T)}}o.BufferSet=S},511:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const v=d(482),y=d(643),f=d(3734);class S extends f.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new f.ExtendedAttrs,this.combinedData=""}static fromCharData(T){const w=new S;return w.setFromCharData(T),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,v.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(T){this.fg=T[y.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(T[y.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(T[y.CHAR_DATA_CHAR_INDEX].length===2){const c=T[y.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){const h=T[y.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=h&&h<=57343?this.content=1024*(c-55296)+h-56320+65536|T[y.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=T[y.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|T[y.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=T[y.CHAR_DATA_CHAR_INDEX],this.content=2097152|T[y.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=S},643:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const v=d(8460),y=d(844);class f{get id(){return this._id}constructor(x){this.line=x,this.isDisposed=!1,this._disposables=[],this._id=f._nextId++,this._onDispose=this.register(new v.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,y.disposeArray)(this._disposables),this._disposables.length=0)}register(x){return this._disposables.push(x),x}}o.Marker=f,f._nextId=1},7116:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(R,o)=>{var d,v,y;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(f){f.NUL="\0",f.SOH="",f.STX="",f.ETX="",f.EOT="",f.ENQ="",f.ACK="",f.BEL="\x07",f.BS="\b",f.HT=" ",f.LF=`
58
+ `,f.VT="\v",f.FF="\f",f.CR="\r",f.SO="",f.SI="",f.DLE="",f.DC1="",f.DC2="",f.DC3="",f.DC4="",f.NAK="",f.SYN="",f.ETB="",f.CAN="",f.EM="",f.SUB="",f.ESC="\x1B",f.FS="",f.GS="",f.RS="",f.US="",f.SP=" ",f.DEL=""})(d||(o.C0=d={})),(function(f){f.PAD="€",f.HOP="",f.BPH="‚",f.NBH="ƒ",f.IND="„",f.NEL="…",f.SSA="†",f.ESA="‡",f.HTS="ˆ",f.HTJ="‰",f.VTS="Š",f.PLD="‹",f.PLU="Œ",f.RI="",f.SS2="Ž",f.SS3="",f.DCS="",f.PU1="‘",f.PU2="’",f.STS="“",f.CCH="”",f.MW="•",f.SPA="–",f.EPA="—",f.SOS="˜",f.SGCI="™",f.SCI="š",f.CSI="›",f.ST="œ",f.OSC="",f.PM="ž",f.APC="Ÿ"})(v||(o.C1=v={})),(function(f){f.ST=`${d.ESC}\\`})(y||(o.C1_ESCAPED=y={}))},7399:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const v=d(2584),y={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:["'",'"']};o.evaluateKeyboardEvent=function(f,S,x,T){const w={type:0,cancel:!1,key:void 0},c=(f.shiftKey?1:0)|(f.altKey?2:0)|(f.ctrlKey?4:0)|(f.metaKey?8:0);switch(f.keyCode){case 0:f.key==="UIKeyInputUpArrow"?w.key=S?v.C0.ESC+"OA":v.C0.ESC+"[A":f.key==="UIKeyInputLeftArrow"?w.key=S?v.C0.ESC+"OD":v.C0.ESC+"[D":f.key==="UIKeyInputRightArrow"?w.key=S?v.C0.ESC+"OC":v.C0.ESC+"[C":f.key==="UIKeyInputDownArrow"&&(w.key=S?v.C0.ESC+"OB":v.C0.ESC+"[B");break;case 8:w.key=f.ctrlKey?"\b":v.C0.DEL,f.altKey&&(w.key=v.C0.ESC+w.key);break;case 9:if(f.shiftKey){w.key=v.C0.ESC+"[Z";break}w.key=v.C0.HT,w.cancel=!0;break;case 13:w.key=f.altKey?v.C0.ESC+v.C0.CR:v.C0.CR,w.cancel=!0;break;case 27:w.key=v.C0.ESC,f.altKey&&(w.key=v.C0.ESC+v.C0.ESC),w.cancel=!0;break;case 37:if(f.metaKey)break;c?(w.key=v.C0.ESC+"[1;"+(c+1)+"D",w.key===v.C0.ESC+"[1;3D"&&(w.key=v.C0.ESC+(x?"b":"[1;5D"))):w.key=S?v.C0.ESC+"OD":v.C0.ESC+"[D";break;case 39:if(f.metaKey)break;c?(w.key=v.C0.ESC+"[1;"+(c+1)+"C",w.key===v.C0.ESC+"[1;3C"&&(w.key=v.C0.ESC+(x?"f":"[1;5C"))):w.key=S?v.C0.ESC+"OC":v.C0.ESC+"[C";break;case 38:if(f.metaKey)break;c?(w.key=v.C0.ESC+"[1;"+(c+1)+"A",x||w.key!==v.C0.ESC+"[1;3A"||(w.key=v.C0.ESC+"[1;5A")):w.key=S?v.C0.ESC+"OA":v.C0.ESC+"[A";break;case 40:if(f.metaKey)break;c?(w.key=v.C0.ESC+"[1;"+(c+1)+"B",x||w.key!==v.C0.ESC+"[1;3B"||(w.key=v.C0.ESC+"[1;5B")):w.key=S?v.C0.ESC+"OB":v.C0.ESC+"[B";break;case 45:f.shiftKey||f.ctrlKey||(w.key=v.C0.ESC+"[2~");break;case 46:w.key=c?v.C0.ESC+"[3;"+(c+1)+"~":v.C0.ESC+"[3~";break;case 36:w.key=c?v.C0.ESC+"[1;"+(c+1)+"H":S?v.C0.ESC+"OH":v.C0.ESC+"[H";break;case 35:w.key=c?v.C0.ESC+"[1;"+(c+1)+"F":S?v.C0.ESC+"OF":v.C0.ESC+"[F";break;case 33:f.shiftKey?w.type=2:f.ctrlKey?w.key=v.C0.ESC+"[5;"+(c+1)+"~":w.key=v.C0.ESC+"[5~";break;case 34:f.shiftKey?w.type=3:f.ctrlKey?w.key=v.C0.ESC+"[6;"+(c+1)+"~":w.key=v.C0.ESC+"[6~";break;case 112:w.key=c?v.C0.ESC+"[1;"+(c+1)+"P":v.C0.ESC+"OP";break;case 113:w.key=c?v.C0.ESC+"[1;"+(c+1)+"Q":v.C0.ESC+"OQ";break;case 114:w.key=c?v.C0.ESC+"[1;"+(c+1)+"R":v.C0.ESC+"OR";break;case 115:w.key=c?v.C0.ESC+"[1;"+(c+1)+"S":v.C0.ESC+"OS";break;case 116:w.key=c?v.C0.ESC+"[15;"+(c+1)+"~":v.C0.ESC+"[15~";break;case 117:w.key=c?v.C0.ESC+"[17;"+(c+1)+"~":v.C0.ESC+"[17~";break;case 118:w.key=c?v.C0.ESC+"[18;"+(c+1)+"~":v.C0.ESC+"[18~";break;case 119:w.key=c?v.C0.ESC+"[19;"+(c+1)+"~":v.C0.ESC+"[19~";break;case 120:w.key=c?v.C0.ESC+"[20;"+(c+1)+"~":v.C0.ESC+"[20~";break;case 121:w.key=c?v.C0.ESC+"[21;"+(c+1)+"~":v.C0.ESC+"[21~";break;case 122:w.key=c?v.C0.ESC+"[23;"+(c+1)+"~":v.C0.ESC+"[23~";break;case 123:w.key=c?v.C0.ESC+"[24;"+(c+1)+"~":v.C0.ESC+"[24~";break;default:if(!f.ctrlKey||f.shiftKey||f.altKey||f.metaKey)if(x&&!T||!f.altKey||f.metaKey)!x||f.altKey||f.ctrlKey||f.shiftKey||!f.metaKey?f.key&&!f.ctrlKey&&!f.altKey&&!f.metaKey&&f.keyCode>=48&&f.key.length===1?w.key=f.key:f.key&&f.ctrlKey&&(f.key==="_"&&(w.key=v.C0.US),f.key==="@"&&(w.key=v.C0.NUL)):f.keyCode===65&&(w.type=1);else{const h=y[f.keyCode],l=h==null?void 0:h[f.shiftKey?1:0];if(l)w.key=v.C0.ESC+l;else if(f.keyCode>=65&&f.keyCode<=90){const u=f.ctrlKey?f.keyCode-64:f.keyCode+32;let g=String.fromCharCode(u);f.shiftKey&&(g=g.toUpperCase()),w.key=v.C0.ESC+g}else if(f.keyCode===32)w.key=v.C0.ESC+(f.ctrlKey?v.C0.NUL:" ");else if(f.key==="Dead"&&f.code.startsWith("Key")){let u=f.code.slice(3,4);f.shiftKey||(u=u.toLowerCase()),w.key=v.C0.ESC+u,w.cancel=!0}}else f.keyCode>=65&&f.keyCode<=90?w.key=String.fromCharCode(f.keyCode-64):f.keyCode===32?w.key=v.C0.NUL:f.keyCode>=51&&f.keyCode<=55?w.key=String.fromCharCode(f.keyCode-51+27):f.keyCode===56?w.key=v.C0.DEL:f.keyCode===219?w.key=v.C0.ESC:f.keyCode===220?w.key=v.C0.FS:f.keyCode===221&&(w.key=v.C0.GS)}return w}},482:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},o.utf32ToString=function(d,v=0,y=d.length){let f="";for(let S=v;S<y;++S){let x=d[S];x>65535?(x-=65536,f+=String.fromCharCode(55296+(x>>10))+String.fromCharCode(x%1024+56320)):f+=String.fromCharCode(x)}return f},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,v){const y=d.length;if(!y)return 0;let f=0,S=0;if(this._interim){const x=d.charCodeAt(S++);56320<=x&&x<=57343?v[f++]=1024*(this._interim-55296)+x-56320+65536:(v[f++]=this._interim,v[f++]=x),this._interim=0}for(let x=S;x<y;++x){const T=d.charCodeAt(x);if(55296<=T&&T<=56319){if(++x>=y)return this._interim=T,f;const w=d.charCodeAt(x);56320<=w&&w<=57343?v[f++]=1024*(T-55296)+w-56320+65536:(v[f++]=T,v[f++]=w)}else T!==65279&&(v[f++]=T)}return f}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,v){const y=d.length;if(!y)return 0;let f,S,x,T,w=0,c=0,h=0;if(this.interim[0]){let g=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let k,D=0;for(;(k=63&this.interim[++D])&&D<4;)C<<=6,C|=k;const E=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,N=E-D;for(;h<N;){if(h>=y)return 0;if(k=d[h++],(192&k)!=128){h--,g=!0;break}this.interim[D++]=k,C<<=6,C|=63&k}g||(E===2?C<128?h--:v[w++]=C:E===3?C<2048||C>=55296&&C<=57343||C===65279||(v[w++]=C):C<65536||C>1114111||(v[w++]=C)),this.interim.fill(0)}const l=y-4;let u=h;for(;u<y;){for(;!(!(u<l)||128&(f=d[u])||128&(S=d[u+1])||128&(x=d[u+2])||128&(T=d[u+3]));)v[w++]=f,v[w++]=S,v[w++]=x,v[w++]=T,u+=4;if(f=d[u++],f<128)v[w++]=f;else if((224&f)==192){if(u>=y)return this.interim[0]=f,w;if(S=d[u++],(192&S)!=128){u--;continue}if(c=(31&f)<<6|63&S,c<128){u--;continue}v[w++]=c}else if((240&f)==224){if(u>=y)return this.interim[0]=f,w;if(S=d[u++],(192&S)!=128){u--;continue}if(u>=y)return this.interim[0]=f,this.interim[1]=S,w;if(x=d[u++],(192&x)!=128){u--;continue}if(c=(15&f)<<12|(63&S)<<6|63&x,c<2048||c>=55296&&c<=57343||c===65279)continue;v[w++]=c}else if((248&f)==240){if(u>=y)return this.interim[0]=f,w;if(S=d[u++],(192&S)!=128){u--;continue}if(u>=y)return this.interim[0]=f,this.interim[1]=S,w;if(x=d[u++],(192&x)!=128){u--;continue}if(u>=y)return this.interim[0]=f,this.interim[1]=S,this.interim[2]=x,w;if(T=d[u++],(192&T)!=128){u--;continue}if(c=(7&f)<<18|(63&S)<<12|(63&x)<<6|63&T,c<65536||c>1114111)continue;v[w++]=c}}return w}}},225:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const v=d(1480),y=[[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]],f=[[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]];let S;o.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let x=0;x<y.length;++x)S.fill(0,y[x][0],y[x][1]+1)}}wcwidth(x){return x<32?0:x<127?1:x<65536?S[x]:(function(T,w){let c,h=0,l=w.length-1;if(T<w[0][0]||T>w[l][1])return!1;for(;l>=h;)if(c=h+l>>1,T>w[c][1])h=c+1;else{if(!(T<w[c][0]))return!0;l=c-1}return!1})(x,f)?0:x>=131072&&x<=196605||x>=196608&&x<=262141?2:1}charProperties(x,T){let w=this.wcwidth(x),c=w===0&&T!==0;if(c){const h=v.UnicodeService.extractWidth(T);h===0?c=!1:h>w&&(w=h)}return v.UnicodeService.createPropertyValue(0,w,c)}}},5981:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const v=d(8460),y=d(844);class f extends y.Disposable{constructor(x){super(),this._action=x,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(x,T){if(T!==void 0&&this._syncCalls>T)return void(this._syncCalls=0);if(this._pendingData+=x.length,this._writeBuffer.push(x),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(x,T){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=x.length,this._writeBuffer.push(x),this._callbacks.push(T),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=x.length,this._writeBuffer.push(x),this._callbacks.push(T)}_innerWrite(x=0,T=!0){const w=x||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const c=this._writeBuffer[this._bufferOffset],h=this._action(c,T);if(h){const u=g=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,g))):this._innerWrite(w,g);return void h.catch((g=>(queueMicrotask((()=>{throw g})),Promise.resolve(!1)))).then(u)}const l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}o.WriteBuffer=f},5941:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const d=/^([\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})$/,v=/^[\da-f]+$/;function y(f,S){const x=f.toString(16),T=x.length<2?"0"+x:x;switch(S){case 4:return x[0];case 8:return T;case 12:return(T+T).slice(0,3);default:return T+T}}o.parseColor=function(f){if(!f)return;let S=f.toLowerCase();if(S.indexOf("rgb:")===0){S=S.slice(4);const x=d.exec(S);if(x){const T=x[1]?15:x[4]?255:x[7]?4095:65535;return[Math.round(parseInt(x[1]||x[4]||x[7]||x[10],16)/T*255),Math.round(parseInt(x[2]||x[5]||x[8]||x[11],16)/T*255),Math.round(parseInt(x[3]||x[6]||x[9]||x[12],16)/T*255)]}}else if(S.indexOf("#")===0&&(S=S.slice(1),v.exec(S)&&[3,6,9,12].includes(S.length))){const x=S.length/3,T=[0,0,0];for(let w=0;w<3;++w){const c=parseInt(S.slice(x*w,x*w+x),16);T[w]=x===1?c<<4:x===2?c:x===3?c>>4:c>>8}return T}},o.toRgbString=function(f,S=16){const[x,T,w]=f;return`rgb:${y(x,S)}/${y(T,S)}/${y(w,S)}`}},5770:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const v=d(482),y=d(8742),f=d(5770),S=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=S,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=S}registerHandler(T,w){this._handlers[T]===void 0&&(this._handlers[T]=[]);const c=this._handlers[T];return c.push(w),{dispose:()=>{const h=c.indexOf(w);h!==-1&&c.splice(h,1)}}}clearHandler(T){this._handlers[T]&&delete this._handlers[T]}setHandlerFallback(T){this._handlerFb=T}reset(){if(this._active.length)for(let T=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;T>=0;--T)this._active[T].unhook(!1);this._stack.paused=!1,this._active=S,this._ident=0}hook(T,w){if(this.reset(),this._ident=T,this._active=this._handlers[T]||S,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(T,w,c){if(this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].put(T,w,c);else this._handlerFb(this._ident,"PUT",(0,v.utf32ToString)(T,w,c))}unhook(T,w=!0){if(this._active.length){let c=!1,h=this._active.length-1,l=!1;if(this._stack.paused&&(h=this._stack.loopPosition-1,c=w,l=this._stack.fallThrough,this._stack.paused=!1),!l&&c===!1){for(;h>=0&&(c=this._active[h].unhook(T),c!==!0);h--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!1,c;h--}for(;h>=0;h--)if(c=this._active[h].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",T);this._active=S,this._ident=0}};const x=new y.Params;x.addParam(0),o.DcsHandler=class{constructor(T){this._handler=T,this._data="",this._params=x,this._hitLimit=!1}hook(T){this._params=T.length>1||T.params[0]?T.clone():x,this._data="",this._hitLimit=!1}put(T,w,c){this._hitLimit||(this._data+=(0,v.utf32ToString)(T,w,c),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(T){let w=!1;if(this._hitLimit)w=!1;else if(T&&(w=this._handler(this._data,this._params),w instanceof Promise))return w.then((c=>(this._params=x,this._data="",this._hitLimit=!1,c)));return this._params=x,this._data="",this._hitLimit=!1,w}}},2015:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const v=d(844),y=d(8742),f=d(6242),S=d(6351);class x{constructor(h){this.table=new Uint8Array(h)}setDefault(h,l){this.table.fill(h<<4|l)}add(h,l,u,g){this.table[l<<8|h]=u<<4|g}addMany(h,l,u,g){for(let C=0;C<h.length;C++)this.table[l<<8|h[C]]=u<<4|g}}o.TransitionTable=x;const T=160;o.VT500_TRANSITION_TABLE=(function(){const c=new x(4095),h=Array.apply(null,Array(256)).map(((D,E)=>E)),l=(D,E)=>h.slice(D,E),u=l(32,127),g=l(0,24);g.push(25),g.push.apply(g,l(28,32));const C=l(0,14);let k;for(k in c.setDefault(1,0),c.addMany(u,0,2,0),C)c.addMany([24,26,153,154],k,3,0),c.addMany(l(128,144),k,3,0),c.addMany(l(144,152),k,3,0),c.add(156,k,0,0),c.add(27,k,11,1),c.add(157,k,4,8),c.addMany([152,158,159],k,0,7),c.add(155,k,11,3),c.add(144,k,11,9);return c.addMany(g,0,3,0),c.addMany(g,1,3,1),c.add(127,1,0,1),c.addMany(g,8,0,8),c.addMany(g,3,3,3),c.add(127,3,0,3),c.addMany(g,4,3,4),c.add(127,4,0,4),c.addMany(g,6,3,6),c.addMany(g,5,3,5),c.add(127,5,0,5),c.addMany(g,2,3,2),c.add(127,2,0,2),c.add(93,1,4,8),c.addMany(u,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(l(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(u,7,0,7),c.addMany(g,7,0,7),c.add(156,7,0,0),c.add(127,7,0,7),c.add(91,1,11,3),c.addMany(l(64,127),3,7,0),c.addMany(l(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(l(48,60),4,8,4),c.addMany(l(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(l(32,64),6,0,6),c.add(127,6,0,6),c.addMany(l(64,127),6,0,0),c.addMany(l(32,48),3,9,5),c.addMany(l(32,48),5,9,5),c.addMany(l(48,64),5,0,6),c.addMany(l(64,127),5,7,0),c.addMany(l(32,48),4,9,5),c.addMany(l(32,48),1,9,2),c.addMany(l(32,48),2,9,2),c.addMany(l(48,127),2,10,0),c.addMany(l(48,80),1,10,0),c.addMany(l(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(l(96,127),1,10,0),c.add(80,1,11,9),c.addMany(g,9,0,9),c.add(127,9,0,9),c.addMany(l(28,32),9,0,9),c.addMany(l(32,48),9,9,12),c.addMany(l(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(g,11,0,11),c.addMany(l(32,128),11,0,11),c.addMany(l(28,32),11,0,11),c.addMany(g,10,0,10),c.add(127,10,0,10),c.addMany(l(28,32),10,0,10),c.addMany(l(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(l(32,48),10,9,12),c.addMany(g,12,0,12),c.add(127,12,0,12),c.addMany(l(28,32),12,0,12),c.addMany(l(32,48),12,9,12),c.addMany(l(48,64),12,0,11),c.addMany(l(64,127),12,12,13),c.addMany(l(64,127),10,12,13),c.addMany(l(64,127),9,12,13),c.addMany(g,13,13,13),c.addMany(u,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(T,0,2,0),c.add(T,8,5,8),c.add(T,6,0,6),c.add(T,11,0,11),c.add(T,13,13,13),c})();class w extends v.Disposable{constructor(h=o.VT500_TRANSITION_TABLE){super(),this._transitions=h,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new y.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(l,u,g)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,u)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,v.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new f.OscParser),this._dcsParser=this.register(new S.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(h,l=[64,126]){let u=0;if(h.prefix){if(h.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=h.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(h.intermediates){if(h.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<h.intermediates.length;++C){const k=h.intermediates.charCodeAt(C);if(32>k||k>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=k}}if(h.final.length!==1)throw new Error("final must be a single byte");const g=h.final.charCodeAt(0);if(l[0]>g||g>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return u<<=8,u|=g,u}identToString(h){const l=[];for(;h;)l.push(String.fromCharCode(255&h)),h>>=8;return l.reverse().join("")}setPrintHandler(h){this._printHandler=h}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(h,l){const u=this._identifier(h,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);const g=this._escHandlers[u];return g.push(l),{dispose:()=>{const C=g.indexOf(l);C!==-1&&g.splice(C,1)}}}clearEscHandler(h){this._escHandlers[this._identifier(h,[48,126])]&&delete this._escHandlers[this._identifier(h,[48,126])]}setEscHandlerFallback(h){this._escHandlerFb=h}setExecuteHandler(h,l){this._executeHandlers[h.charCodeAt(0)]=l}clearExecuteHandler(h){this._executeHandlers[h.charCodeAt(0)]&&delete this._executeHandlers[h.charCodeAt(0)]}setExecuteHandlerFallback(h){this._executeHandlerFb=h}registerCsiHandler(h,l){const u=this._identifier(h);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);const g=this._csiHandlers[u];return g.push(l),{dispose:()=>{const C=g.indexOf(l);C!==-1&&g.splice(C,1)}}}clearCsiHandler(h){this._csiHandlers[this._identifier(h)]&&delete this._csiHandlers[this._identifier(h)]}setCsiHandlerFallback(h){this._csiHandlerFb=h}registerDcsHandler(h,l){return this._dcsParser.registerHandler(this._identifier(h),l)}clearDcsHandler(h){this._dcsParser.clearHandler(this._identifier(h))}setDcsHandlerFallback(h){this._dcsParser.setHandlerFallback(h)}registerOscHandler(h,l){return this._oscParser.registerHandler(h,l)}clearOscHandler(h){this._oscParser.clearHandler(h)}setOscHandlerFallback(h){this._oscParser.setHandlerFallback(h)}setErrorHandler(h){this._errorHandler=h}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(h,l,u,g,C){this._parseStack.state=h,this._parseStack.handlers=l,this._parseStack.handlerPos=u,this._parseStack.transition=g,this._parseStack.chunkPos=C}parse(h,l,u){let g,C=0,k=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const E=this._parseStack.handlers;let N=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&N>-1){for(;N>=0&&(g=E[N](this._params),g!==!0);N--)if(g instanceof Promise)return this._parseStack.handlerPos=N,g}this._parseStack.handlers=[];break;case 4:if(u===!1&&N>-1){for(;N>=0&&(g=E[N](),g!==!0);N--)if(g instanceof Promise)return this._parseStack.handlerPos=N,g}this._parseStack.handlers=[];break;case 6:if(C=h[this._parseStack.chunkPos],g=this._dcsParser.unhook(C!==24&&C!==26,u),g)return g;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=h[this._parseStack.chunkPos],g=this._oscParser.end(C!==24&&C!==26,u),g)return g;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let E=D;E<l;++E){switch(C=h[E],k=this._transitions.table[this.currentState<<8|(C<160?C:T)],k>>4){case 2:for(let A=E+1;;++A){if(A>=l||(C=h[A])<32||C>126&&C<T){this._printHandler(h,E,A),E=A-1;break}if(++A>=l||(C=h[A])<32||C>126&&C<T){this._printHandler(h,E,A),E=A-1;break}if(++A>=l||(C=h[A])<32||C>126&&C<T){this._printHandler(h,E,A),E=A-1;break}if(++A>=l||(C=h[A])<32||C>126&&C<T){this._printHandler(h,E,A),E=A-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:E,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const N=this._csiHandlers[this._collect<<8|C];let V=N?N.length-1:-1;for(;V>=0&&(g=N[V](this._params),g!==!0);V--)if(g instanceof Promise)return this._preserveStack(3,N,V,k,E),g;V<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++E<l&&(C=h[E])>47&&C<60);E--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:const q=this._escHandlers[this._collect<<8|C];let O=q?q.length-1:-1;for(;O>=0&&(g=q[O](),g!==!0);O--)if(g instanceof Promise)return this._preserveStack(4,q,O,k,E),g;O<0&&this._escHandlerFb(this._collect<<8|C),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|C,this._params);break;case 13:for(let A=E+1;;++A)if(A>=l||(C=h[A])===24||C===26||C===27||C>127&&C<T){this._dcsParser.put(h,E,A),E=A-1;break}break;case 14:if(g=this._dcsParser.unhook(C!==24&&C!==26),g)return this._preserveStack(6,[],0,k,E),g;C===27&&(k|=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 A=E+1;;A++)if(A>=l||(C=h[A])<32||C>127&&C<T){this._oscParser.put(h,E,A),E=A-1;break}break;case 6:if(g=this._oscParser.end(C!==24&&C!==26),g)return this._preserveStack(5,[],0,k,E),g;C===27&&(k|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&k}}}o.EscapeSequenceParser=w},6242:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const v=d(5770),y=d(482),f=[];o.OscParser=class{constructor(){this._state=0,this._active=f,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(S,x){this._handlers[S]===void 0&&(this._handlers[S]=[]);const T=this._handlers[S];return T.push(x),{dispose:()=>{const w=T.indexOf(x);w!==-1&&T.splice(w,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}reset(){if(this._state===2)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].end(!1);this._stack.paused=!1,this._active=f,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||f,this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].start();else this._handlerFb(this._id,"START")}_put(S,x,T){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(S,x,T);else this._handlerFb(this._id,"PUT",(0,y.utf32ToString)(S,x,T))}start(){this.reset(),this._state=1}put(S,x,T){if(this._state!==3){if(this._state===1)for(;x<T;){const w=S[x++];if(w===59){this._state=2,this._start();break}if(w<48||57<w)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+w-48}this._state===2&&T-x>0&&this._put(S,x,T)}}end(S,x=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let T=!1,w=this._active.length-1,c=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,T=x,c=this._stack.fallThrough,this._stack.paused=!1),!c&&T===!1){for(;w>=0&&(T=this._active[w].end(S),T!==!0);w--)if(T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,T;w--}for(;w>=0;w--)if(T=this._active[w].end(!1),T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,T}else this._handlerFb(this._id,"END",S);this._active=f,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(S){this._handler=S,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(S,x,T){this._hitLimit||(this._data+=(0,y.utf32ToString)(S,x,T),this._data.length>v.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(S){let x=!1;if(this._hitLimit)x=!1;else if(S&&(x=this._handler(this._data),x instanceof Promise))return x.then((T=>(this._data="",this._hitLimit=!1,T)));return this._data="",this._hitLimit=!1,x}}},8742:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const d=2147483647;class v{static fromArray(f){const S=new v;if(!f.length)return S;for(let x=Array.isArray(f[0])?1:0;x<f.length;++x){const T=f[x];if(Array.isArray(T))for(let w=0;w<T.length;++w)S.addSubParam(T[w]);else S.addParam(T)}return S}constructor(f=32,S=32){if(this.maxLength=f,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(f),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(f),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const f=new v(this.maxLength,this.maxSubParamsLength);return f.params.set(this.params),f.length=this.length,f._subParams.set(this._subParams),f._subParamsLength=this._subParamsLength,f._subParamsIdx.set(this._subParamsIdx),f._rejectDigits=this._rejectDigits,f._rejectSubDigits=this._rejectSubDigits,f._digitIsSub=this._digitIsSub,f}toArray(){const f=[];for(let S=0;S<this.length;++S){f.push(this.params[S]);const x=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-x>0&&f.push(Array.prototype.slice.call(this._subParams,x,T))}return f}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(f){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=f>d?d:f}}addSubParam(f){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=f>d?d:f,this._subParamsIdx[this.length-1]++}}hasSubParams(f){return(255&this._subParamsIdx[f])-(this._subParamsIdx[f]>>8)>0}getSubParams(f){const S=this._subParamsIdx[f]>>8,x=255&this._subParamsIdx[f];return x-S>0?this._subParams.subarray(S,x):null}getSubParamsAll(){const f={};for(let S=0;S<this.length;++S){const x=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-x>0&&(f[S]=this._subParams.slice(x,T))}return f}addDigit(f){let S;if(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const x=this._digitIsSub?this._subParams:this.params,T=x[S-1];x[S-1]=~T?Math.min(10*T+f,d):f}}o.Params=v},5741:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,v){const y={instance:v,dispose:v.dispose,isDisposed:!1};this._addons.push(y),v.dispose=()=>this._wrappedAddonDispose(y),v.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let v=-1;for(let y=0;y<this._addons.length;y++)if(this._addons[y]===d){v=y;break}if(v===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(v,1)}}},8771:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const v=d(3785),y=d(511);o.BufferApiView=class{constructor(f,S){this._buffer=f,this.type=S}init(f){return this._buffer=f,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(f){const S=this._buffer.lines.get(f);if(S)return new v.BufferLineApiView(S)}getNullCell(){return new y.CellData}}},3785:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const v=d(511);o.BufferLineApiView=class{constructor(y){this._line=y}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(y,f){if(!(y<0||y>=this._line.length))return f?(this._line.loadCell(y,f),f):this._line.loadCell(y,new v.CellData)}translateToString(y,f,S){return this._line.translateToString(y,f,S)}}},8285:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const v=d(8771),y=d(8460),f=d(844);class S extends f.Disposable{constructor(T){super(),this._core=T,this._onBufferChange=this.register(new y.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new v.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new v.BufferApiView(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)}}o.BufferNamespaceApi=S},7975:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,v){return this._core.registerCsiHandler(d,(y=>v(y.toArray())))}addCsiHandler(d,v){return this.registerCsiHandler(d,v)}registerDcsHandler(d,v){return this._core.registerDcsHandler(d,((y,f)=>v(y,f.toArray())))}addDcsHandler(d,v){return this.registerDcsHandler(d,v)}registerEscHandler(d,v){return this._core.registerEscHandler(d,v)}addEscHandler(d,v){return this.registerEscHandler(d,v)}registerOscHandler(d,v){return this._core.registerOscHandler(d,v)}addOscHandler(d,v){return this.registerOscHandler(d,v)}}},7090:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(d){this._core=d}register(d){this._core.unicodeService.register(d)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(d){this._core.unicodeService.activeVersion=d}}},744:function(R,o,d){var v=this&&this.__decorate||function(c,h,l,u){var g,C=arguments.length,k=C<3?h:u===null?u=Object.getOwnPropertyDescriptor(h,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(c,h,l,u);else for(var D=c.length-1;D>=0;D--)(g=c[D])&&(k=(C<3?g(k):C>3?g(h,l,k):g(h,l))||k);return C>3&&k&&Object.defineProperty(h,l,k),k},y=this&&this.__param||function(c,h){return function(l,u){h(l,u,c)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const f=d(8460),S=d(844),x=d(5295),T=d(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let w=o.BufferService=class extends S.Disposable{get buffer(){return this.buffers.active}constructor(c){super(),this.isUserScrolling=!1,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(c.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(c.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new x.BufferSet(c,this))}resize(c,h){this.cols=c,this.rows=h,this.buffers.resize(c,h),this._onResize.fire({cols:c,rows:h})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,h=!1){const l=this.buffer;let u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===c.fg&&u.getBg(0)===c.bg||(u=l.getBlankLine(c,h),this._cachedBlankLine=u),u.isWrapped=h;const g=l.ybase+l.scrollTop,C=l.ybase+l.scrollBottom;if(l.scrollTop===0){const k=l.lines.isFull;C===l.lines.length-1?k?l.lines.recycle().copyFrom(u):l.lines.push(u.clone()):l.lines.splice(C+1,0,u.clone()),k?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{const k=C-g+1;l.lines.shiftElements(g+1,k-1,-1),l.lines.set(C,u.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(c,h,l){const u=this.buffer;if(c<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else c+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);const g=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+c,u.ybase),0),g!==u.ydisp&&(h||this._onScroll.fire(u.ydisp))}};o.BufferService=w=v([y(0,T.IOptionsService)],w)},7994:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,v){this._charsets[d]=v,this.glevel===d&&(this.charset=v)}}},1753:function(R,o,d){var v=this&&this.__decorate||function(u,g,C,k){var D,E=arguments.length,N=E<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,C):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(u,g,C,k);else for(var V=u.length-1;V>=0;V--)(D=u[V])&&(N=(E<3?D(N):E>3?D(g,C,N):D(g,C))||N);return E>3&&N&&Object.defineProperty(g,C,N),N},y=this&&this.__param||function(u,g){return function(C,k){g(C,k,u)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const f=d(2585),S=d(8460),x=d(844),T={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function w(u,g){let C=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(C|=64,C|=u.action):(C|=3&u.button,4&u.button&&(C|=64),8&u.button&&(C|=128),u.action===32?C|=32:u.action!==0||g||(C|=3)),C}const c=String.fromCharCode,h={DEFAULT:u=>{const g=[w(u,!1)+32,u.col+32,u.row+32];return g[0]>255||g[1]>255||g[2]>255?"":`\x1B[M${c(g[0])}${c(g[1])}${c(g[2])}`},SGR:u=>{const g=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${w(u,!0)};${u.col};${u.row}${g}`},SGR_PIXELS:u=>{const g=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${w(u,!0)};${u.x};${u.y}${g}`}};let l=o.CoreMouseService=class extends x.Disposable{constructor(u,g){super(),this._bufferService=u,this._coreService=g,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new S.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const C of Object.keys(T))this.addProtocol(C,T[C]);for(const C of Object.keys(h))this.addEncoding(C,h[C]);this.reset()}addProtocol(u,g){this._protocols[u]=g}addEncoding(u,g){this._encodings[u]=g}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(u){if(!this._protocols[u])throw new Error(`unknown protocol "${u}"`);this._activeProtocol=u,this._onProtocolChange.fire(this._protocols[u].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(u){if(!this._encodings[u])throw new Error(`unknown encoding "${u}"`);this._activeEncoding=u}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(u){if(u.col<0||u.col>=this._bufferService.cols||u.row<0||u.row>=this._bufferService.rows||u.button===4&&u.action===32||u.button===3&&u.action!==32||u.button!==4&&(u.action===2||u.action===3)||(u.col++,u.row++,u.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,u,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(u))return!1;const g=this._encodings[this._activeEncoding](u);return g&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(g):this._coreService.triggerDataEvent(g,!0)),this._lastEvent=u,!0}explainEvents(u){return{down:!!(1&u),up:!!(2&u),drag:!!(4&u),move:!!(8&u),wheel:!!(16&u)}}_equalEvents(u,g,C){if(C){if(u.x!==g.x||u.y!==g.y)return!1}else if(u.col!==g.col||u.row!==g.row)return!1;return u.button===g.button&&u.action===g.action&&u.ctrl===g.ctrl&&u.alt===g.alt&&u.shift===g.shift}};o.CoreMouseService=l=v([y(0,f.IBufferService),y(1,f.ICoreService)],l)},6975:function(R,o,d){var v=this&&this.__decorate||function(l,u,g,C){var k,D=arguments.length,E=D<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(l,u,g,C);else for(var N=l.length-1;N>=0;N--)(k=l[N])&&(E=(D<3?k(E):D>3?k(u,g,E):k(u,g))||E);return D>3&&E&&Object.defineProperty(u,g,E),E},y=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const f=d(1439),S=d(8460),x=d(844),T=d(2585),w=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let h=o.CoreService=class extends x.Disposable{constructor(l,u,g){super(),this._bufferService=l,this._logService=u,this._optionsService=g,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new S.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new S.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new S.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new S.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,f.clone)(w),this.decPrivateModes=(0,f.clone)(c)}reset(){this.modes=(0,f.clone)(w),this.decPrivateModes=(0,f.clone)(c)}triggerDataEvent(l,u=!1){if(this._optionsService.rawOptions.disableStdin)return;const g=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&g.ybase!==g.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,(()=>l.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,(()=>l.split("").map((u=>u.charCodeAt(0))))),this._onBinary.fire(l))}};o.CoreService=h=v([y(0,T.IBufferService),y(1,T.ILogService),y(2,T.IOptionsService)],h)},9074:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const v=d(8055),y=d(8460),f=d(844),S=d(6106);let x=0,T=0;class w extends f.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new S.SortedList((l=>l==null?void 0:l.marker.line)),this._onDecorationRegistered=this.register(new y.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new y.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,f.toDisposable)((()=>this.reset())))}registerDecoration(l){if(l.marker.isDisposed)return;const u=new c(l);if(u){const g=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),g.dispose())})),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(const l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,u,g){let C=0,k=0;for(const D of this._decorations.getKeyIterator(u))C=D.options.x??0,k=C+(D.options.width??1),l>=C&&l<k&&(!g||(D.options.layer??"bottom")===g)&&(yield D)}forEachDecorationAtCell(l,u,g,C){this._decorations.forEachByKey(u,(k=>{x=k.options.x??0,T=x+(k.options.width??1),l>=x&&l<T&&(!g||(k.options.layer??"bottom")===g)&&C(k)}))}}o.DecorationService=w;class c extends f.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=v.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=v.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,this.onRenderEmitter=this.register(new y.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new y.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const v=d(2585),y=d(8343);class f{constructor(...x){this._entries=new Map;for(const[T,w]of x)this.set(T,w)}set(x,T){const w=this._entries.get(x);return this._entries.set(x,T),w}forEach(x){for(const[T,w]of this._entries.entries())x(T,w)}has(x){return this._entries.has(x)}get(x){return this._entries.get(x)}}o.ServiceCollection=f,o.InstantiationService=class{constructor(){this._services=new f,this._services.set(v.IInstantiationService,this)}setService(S,x){this._services.set(S,x)}getService(S){return this._services.get(S)}createInstance(S,...x){const T=(0,y.getServiceDependencies)(S).sort(((h,l)=>h.index-l.index)),w=[];for(const h of T){const l=this._services.get(h.id);if(!l)throw new Error(`[createInstance] ${S.name} depends on UNKNOWN service ${h.id}.`);w.push(l)}const c=T.length>0?T[0].index:x.length;if(x.length!==c)throw new Error(`[createInstance] First service dependency of ${S.name} at position ${c+1} conflicts with ${x.length} static arguments`);return new S(...x,...w)}}},7866:function(R,o,d){var v=this&&this.__decorate||function(c,h,l,u){var g,C=arguments.length,k=C<3?h:u===null?u=Object.getOwnPropertyDescriptor(h,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(c,h,l,u);else for(var D=c.length-1;D>=0;D--)(g=c[D])&&(k=(C<3?g(k):C>3?g(h,l,k):g(h,l))||k);return C>3&&k&&Object.defineProperty(h,l,k),k},y=this&&this.__param||function(c,h){return function(l,u){h(l,u,c)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const f=d(844),S=d(2585),x={trace:S.LogLevelEnum.TRACE,debug:S.LogLevelEnum.DEBUG,info:S.LogLevelEnum.INFO,warn:S.LogLevelEnum.WARN,error:S.LogLevelEnum.ERROR,off:S.LogLevelEnum.OFF};let T,w=o.LogService=class extends f.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=S.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),T=this}_updateLogLevel(){this._logLevel=x[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let h=0;h<c.length;h++)typeof c[h]=="function"&&(c[h]=c[h]())}_log(c,h,l){this._evalLazyOptionalParams(l),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+h,...l)}trace(c,...h){var l;this._logLevel<=S.LogLevelEnum.TRACE&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.trace.bind(this._optionsService.options.logger))??console.log,c,h)}debug(c,...h){var l;this._logLevel<=S.LogLevelEnum.DEBUG&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.debug.bind(this._optionsService.options.logger))??console.log,c,h)}info(c,...h){var l;this._logLevel<=S.LogLevelEnum.INFO&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.info.bind(this._optionsService.options.logger))??console.info,c,h)}warn(c,...h){var l;this._logLevel<=S.LogLevelEnum.WARN&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.warn.bind(this._optionsService.options.logger))??console.warn,c,h)}error(c,...h){var l;this._logLevel<=S.LogLevelEnum.ERROR&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.error.bind(this._optionsService.options.logger))??console.error,c,h)}};o.LogService=w=v([y(0,S.IOptionsService)],w),o.setTraceLogger=function(c){T=c},o.traceCall=function(c,h,l){if(typeof l.value!="function")throw new Error("not supported");const u=l.value;l.value=function(...g){if(T.logLevel!==S.LogLevelEnum.TRACE)return u.apply(this,g);T.trace(`GlyphRenderer#${u.name}(${g.map((k=>JSON.stringify(k))).join(", ")})`);const C=u.apply(this,g);return T.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const v=d(8460),y=d(844),f=d(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:f.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const S=["normal","bold","100","200","300","400","500","600","700","800","900"];class x extends y.Disposable{constructor(w){super(),this._onOptionChange=this.register(new v.EventEmitter),this.onOptionChange=this._onOptionChange.event;const c={...o.DEFAULT_OPTIONS};for(const h in w)if(h in c)try{const l=w[h];c[h]=this._sanitizeAndValidateOption(h,l)}catch(l){console.error(l)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,y.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,c){return this.onOptionChange((h=>{h===w&&c(this.rawOptions[w])}))}onMultipleOptionChange(w,c){return this.onOptionChange((h=>{w.indexOf(h)!==-1&&c()}))}_setupOptions(){const w=h=>{if(!(h in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${h}"`);return this.rawOptions[h]},c=(h,l)=>{if(!(h in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${h}"`);l=this._sanitizeAndValidateOption(h,l),this.rawOptions[h]!==l&&(this.rawOptions[h]=l,this._onOptionChange.fire(h))};for(const h in this.rawOptions){const l={get:w.bind(this,h),set:c.bind(this,h)};Object.defineProperty(this.options,h,l)}}_sanitizeAndValidateOption(w,c){switch(w){case"cursorStyle":if(c||(c=o.DEFAULT_OPTIONS[w]),!(function(h){return h==="block"||h==="underline"||h==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${w}`);break;case"wordSeparator":c||(c=o.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=S.includes(c)?c:o.DEFAULT_OPTIONS[w];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${w} cannot be less than 1, value: ${c}`);break;case"minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));break;case"scrollback":if((c=Math.min(c,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${w} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}o.OptionsService=x},2660:function(R,o,d){var v=this&&this.__decorate||function(x,T,w,c){var h,l=arguments.length,u=l<3?T:c===null?c=Object.getOwnPropertyDescriptor(T,w):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(x,T,w,c);else for(var g=x.length-1;g>=0;g--)(h=x[g])&&(u=(l<3?h(u):l>3?h(T,w,u):h(T,w))||u);return l>3&&u&&Object.defineProperty(T,w,u),u},y=this&&this.__param||function(x,T){return function(w,c){T(w,c,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const f=d(2585);let S=o.OscLinkService=class{constructor(x){this._bufferService=x,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(x){const T=this._bufferService.buffer;if(x.id===void 0){const g=T.addMarker(T.ybase+T.y),C={data:x,id:this._nextId++,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(C,g))),this._dataByLinkId.set(C.id,C),C.id}const w=x,c=this._getEntryIdKey(w),h=this._entriesWithId.get(c);if(h)return this.addLineToLink(h.id,T.ybase+T.y),h.id;const l=T.addMarker(T.ybase+T.y),u={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(u,l))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(x,T){const w=this._dataByLinkId.get(x);if(w&&w.lines.every((c=>c.line!==T))){const c=this._bufferService.buffer.addMarker(T);w.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(w,c)))}}getLinkData(x){var T;return(T=this._dataByLinkId.get(x))==null?void 0:T.data}_getEntryIdKey(x){return`${x.id};;${x.uri}`}_removeMarkerFromLink(x,T){const w=x.lines.indexOf(T);w!==-1&&(x.lines.splice(w,1),x.lines.length===0&&(x.data.id!==void 0&&this._entriesWithId.delete(x.key),this._dataByLinkId.delete(x.id)))}};o.OscLinkService=S=v([y(0,f.IBufferService)],S)},8343:(R,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const d="di$target",v="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(y){return y[v]||[]},o.createDecorator=function(y){if(o.serviceRegistry.has(y))return o.serviceRegistry.get(y);const f=function(S,x,T){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,c,h){c[d]===c?c[v].push({id:w,index:h}):(c[v]=[{id:w,index:h}],c[d]=c)})(f,S,T)};return f.toString=()=>y,o.serviceRegistry.set(y,f),f}},2585:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const v=d(8343);var y;o.IBufferService=(0,v.createDecorator)("BufferService"),o.ICoreMouseService=(0,v.createDecorator)("CoreMouseService"),o.ICoreService=(0,v.createDecorator)("CoreService"),o.ICharsetService=(0,v.createDecorator)("CharsetService"),o.IInstantiationService=(0,v.createDecorator)("InstantiationService"),(function(f){f[f.TRACE=0]="TRACE",f[f.DEBUG=1]="DEBUG",f[f.INFO=2]="INFO",f[f.WARN=3]="WARN",f[f.ERROR=4]="ERROR",f[f.OFF=5]="OFF"})(y||(o.LogLevelEnum=y={})),o.ILogService=(0,v.createDecorator)("LogService"),o.IOptionsService=(0,v.createDecorator)("OptionsService"),o.IOscLinkService=(0,v.createDecorator)("OscLinkService"),o.IUnicodeService=(0,v.createDecorator)("UnicodeService"),o.IDecorationService=(0,v.createDecorator)("DecorationService")},1480:(R,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const v=d(8460),y=d(225);class f{static extractShouldJoin(x){return(1&x)!=0}static extractWidth(x){return x>>1&3}static extractCharKind(x){return x>>3}static createPropertyValue(x,T,w=!1){return(16777215&x)<<3|(3&T)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new v.EventEmitter,this.onChange=this._onChange.event;const x=new y.UnicodeV6;this.register(x),this._active=x.version,this._activeProvider=x}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(x){if(!this._providers[x])throw new Error(`unknown Unicode version "${x}"`);this._active=x,this._activeProvider=this._providers[x],this._onChange.fire(x)}register(x){this._providers[x.version]=x}wcwidth(x){return this._activeProvider.wcwidth(x)}getStringCellWidth(x){let T=0,w=0;const c=x.length;for(let h=0;h<c;++h){let l=x.charCodeAt(h);if(55296<=l&&l<=56319){if(++h>=c)return T+this.wcwidth(l);const C=x.charCodeAt(h);56320<=C&&C<=57343?l=1024*(l-55296)+C-56320+65536:T+=this.wcwidth(C)}const u=this.charProperties(l,w);let g=f.extractWidth(u);f.extractShouldJoin(u)&&(g-=f.extractWidth(w)),T+=g,w=u}return T}charProperties(x,T){return this._activeProvider.charProperties(x,T)}}o.UnicodeService=f}},_={};function p(R){var o=_[R];if(o!==void 0)return o.exports;var d=_[R]={exports:{}};return n[R].call(d.exports,d,d.exports,p),d.exports}var L={};return(()=>{var R=L;Object.defineProperty(R,"__esModule",{value:!0}),R.Terminal=void 0;const o=p(9042),d=p(3236),v=p(844),y=p(5741),f=p(8285),S=p(7975),x=p(7090),T=["cols","rows"];class w extends v.Disposable{constructor(h){super(),this._core=this.register(new d.Terminal(h)),this._addonManager=this.register(new y.AddonManager),this._publicOptions={...this._core.options};const l=g=>this._core.options[g],u=(g,C)=>{this._checkReadonlyOptions(g),this._core.options[g]=C};for(const g in this._core.options){const C={get:l.bind(this,g),set:u.bind(this,g)};Object.defineProperty(this._publicOptions,g,C)}}_checkReadonlyOptions(h){if(T.includes(h))throw new Error(`Option "${h}" 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 S.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new x.UnicodeApi(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 f.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const h=this._core.coreService.decPrivateModes;let l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:h.applicationCursorKeys,applicationKeypadMode:h.applicationKeypad,bracketedPasteMode:h.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:h.origin,reverseWraparoundMode:h.reverseWraparound,sendFocusMode:h.sendFocus,wraparoundMode:h.wraparound}}get options(){return this._publicOptions}set options(h){for(const l in h)this._publicOptions[l]=h[l]}blur(){this._core.blur()}focus(){this._core.focus()}input(h,l=!0){this._core.input(h,l)}resize(h,l){this._verifyIntegers(h,l),this._core.resize(h,l)}open(h){this._core.open(h)}attachCustomKeyEventHandler(h){this._core.attachCustomKeyEventHandler(h)}attachCustomWheelEventHandler(h){this._core.attachCustomWheelEventHandler(h)}registerLinkProvider(h){return this._core.registerLinkProvider(h)}registerCharacterJoiner(h){return this._checkProposedApi(),this._core.registerCharacterJoiner(h)}deregisterCharacterJoiner(h){this._checkProposedApi(),this._core.deregisterCharacterJoiner(h)}registerMarker(h=0){return this._verifyIntegers(h),this._core.registerMarker(h)}registerDecoration(h){return this._checkProposedApi(),this._verifyPositiveIntegers(h.x??0,h.width??0,h.height??0),this._core.registerDecoration(h)}hasSelection(){return this._core.hasSelection()}select(h,l,u){this._verifyIntegers(h,l,u),this._core.select(h,l,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(h,l){this._verifyIntegers(h,l),this._core.selectLines(h,l)}dispose(){super.dispose()}scrollLines(h){this._verifyIntegers(h),this._core.scrollLines(h)}scrollPages(h){this._verifyIntegers(h),this._core.scrollPages(h)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(h){this._verifyIntegers(h),this._core.scrollToLine(h)}clear(){this._core.clear()}write(h,l){this._core.write(h,l)}writeln(h,l){this._core.write(h),this._core.write(`\r
59
+ `,l)}paste(h){this._core.paste(h)}refresh(h,l){this._verifyIntegers(h,l),this._core.refresh(h,l)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(h){this._addonManager.loadAddon(this,h)}static get strings(){return o}_verifyIntegers(...h){for(const l of h)if(l===1/0||isNaN(l)||l%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...h){for(const l of h)if(l&&(l===1/0||isNaN(l)||l%1!=0||l<0))throw new Error("This API only accepts positive integers")}}R.Terminal=w})(),L})()))})(uc)),uc.exports}var X0=Y0();/**
60
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
61
+ * @license MIT
62
+ *
63
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
64
+ * @license MIT
65
+ *
66
+ * Originally forked from (with the author's permission):
67
+ * Fabrice Bellard's javascript vt100 for jslinux:
68
+ * http://bellard.org/jslinux/
69
+ * Copyright (c) 2011 Fabrice Bellard
70
+ */var J0=2,Q0=1,Z0=class{activate(r){this._terminal=r}dispose(){}fit(){let r=this.proposeDimensions();if(!r||!this._terminal||isNaN(r.cols)||isNaN(r.rows))return;let i=this._terminal._core;(this._terminal.rows!==r.rows||this._terminal.cols!==r.cols)&&(i._renderService.clear(),this._terminal.resize(r.cols,r.rows))}proposeDimensions(){var f;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let r=this._terminal._core._renderService.dimensions;if(r.css.cell.width===0||r.css.cell.height===0)return;let i=this._terminal.options.scrollback===0?0:((f=this._terminal.options.overviewRuler)==null?void 0:f.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),_=parseInt(n.getPropertyValue("height")),p=Math.max(0,parseInt(n.getPropertyValue("width"))),L=window.getComputedStyle(this._terminal.element),R={top:parseInt(L.getPropertyValue("padding-top")),bottom:parseInt(L.getPropertyValue("padding-bottom")),right:parseInt(L.getPropertyValue("padding-right")),left:parseInt(L.getPropertyValue("padding-left"))},o=R.top+R.bottom,d=R.right+R.left,v=_-o,y=p-d-i;return{cols:Math.max(J0,Math.floor(y/r.css.cell.width)),rows:Math.max(Q0,Math.floor(v/r.css.cell.height))}}};/**
71
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
72
+ * @license MIT
73
+ *
74
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
75
+ * @license MIT
76
+ *
77
+ * Originally forked from (with the author's permission):
78
+ * Fabrice Bellard's javascript vt100 for jslinux:
79
+ * http://bellard.org/jslinux/
80
+ * Copyright (c) 2011 Fabrice Bellard
81
+ */var dc=[[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]],e1=[[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]],Bt;function t1(r,i){let n=0,_=i.length-1,p;if(r<i[0][0]||r>i[_][1])return!1;for(;_>=n;)if(p=n+_>>1,r>i[p][1])n=p+1;else if(r<i[p][0])_=p-1;else return!0;return!1}var r1=class{constructor(){if(this.version="6",!Bt){Bt=new Uint8Array(65536),Bt.fill(1),Bt[0]=0,Bt.fill(0,1,32),Bt.fill(0,127,160),Bt.fill(2,4352,4448),Bt[9001]=2,Bt[9002]=2,Bt.fill(2,11904,42192),Bt[12351]=1,Bt.fill(2,44032,55204),Bt.fill(2,63744,64256),Bt.fill(2,65040,65050),Bt.fill(2,65072,65136),Bt.fill(2,65280,65377),Bt.fill(2,65504,65511);for(let i=0;i<dc.length;++i)Bt.fill(0,dc[i][0],dc[i][1]+1)}}wcwidth(i){return i<32?0:i<127?1:i<65536?Bt[i]:t1(i,e1)?0:i>=131072&&i<=196605||i>=196608&&i<=262141?2:1}charProperties(i,n){let _=this.wcwidth(i),p=_===0&&n!==0;if(p){let L=ca.extractWidth(n);L===0?p=!1:L>_&&(_=L)}return ca.createPropertyValue(0,_,p)}},i1=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(r){setTimeout(()=>{throw r.stack?Xd.isErrorNoTelemetry(r)?new Xd(r.message+`
82
+
83
+ `+r.stack):new Error(r.message+`
84
+
85
+ `+r.stack):r},0)}}addListener(r){return this.listeners.push(r),()=>{this._removeListener(r)}}emit(r){this.listeners.forEach(i=>{i(r)})}_removeListener(r){this.listeners.splice(this.listeners.indexOf(r),1)}setUnexpectedErrorHandler(r){this.unexpectedErrorHandler=r}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(r){this.unexpectedErrorHandler(r),this.emit(r)}onUnexpectedExternalError(r){this.unexpectedErrorHandler(r)}},s1=new i1;function fc(r){n1(r)||s1.onUnexpectedError(r)}var Ic="Canceled";function n1(r){return r instanceof o1?!0:r instanceof Error&&r.name===Ic&&r.message===Ic}var o1=class extends Error{constructor(){super(Ic),this.name=this.message}},Xd=class jc extends Error{constructor(i){super(i),this.name="CodeExpectedError"}static fromError(i){if(i instanceof jc)return i;let n=new jc;return n.message=i.message,n.stack=i.stack,n}static isErrorNoTelemetry(i){return i.name==="CodeExpectedError"}};function a1(r,i){let n=this,_=!1,p;return function(){return _||(_=!0,i||(p=r.apply(n,arguments))),p}}var l1;(r=>{function i(L){return L<0}r.isLessThan=i;function n(L){return L<=0}r.isLessThanOrEqual=n;function _(L){return L>0}r.isGreaterThan=_;function p(L){return L===0}r.isNeitherLessOrGreaterThan=p,r.greaterThan=1,r.lessThan=-1,r.neitherLessOrGreaterThan=0})(l1||(l1={}));var vp;(r=>{function i(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}r.is=i;let n=Object.freeze([]);function _(){return n}r.empty=_;function*p(g){yield g}r.single=p;function L(g){return i(g)?g:p(g)}r.wrap=L;function R(g){return g||n}r.from=R;function*o(g){for(let C=g.length-1;C>=0;C--)yield g[C]}r.reverse=o;function d(g){return!g||g[Symbol.iterator]().next().done===!0}r.isEmpty=d;function v(g){return g[Symbol.iterator]().next().value}r.first=v;function y(g,C){let k=0;for(let D of g)if(C(D,k++))return!0;return!1}r.some=y;function f(g,C){for(let k of g)if(C(k))return k}r.find=f;function*S(g,C){for(let k of g)C(k)&&(yield k)}r.filter=S;function*x(g,C){let k=0;for(let D of g)yield C(D,k++)}r.map=x;function*T(g,C){let k=0;for(let D of g)yield*C(D,k++)}r.flatMap=T;function*w(...g){for(let C of g)yield*C}r.concat=w;function c(g,C,k){let D=k;for(let E of g)D=C(D,E);return D}r.reduce=c;function*h(g,C,k=g.length){for(C<0&&(C+=g.length),k<0?k+=g.length:k>g.length&&(k=g.length);C<k;C++)yield g[C]}r.slice=h;function l(g,C=Number.POSITIVE_INFINITY){let k=[];if(C===0)return[k,g];let D=g[Symbol.iterator]();for(let E=0;E<C;E++){let N=D.next();if(N.done)return[k,r.empty()];k.push(N.value)}return[k,{[Symbol.iterator](){return D}}]}r.consume=l;async function u(g){let C=[];for await(let k of g)C.push(k);return Promise.resolve(C)}r.asyncToArray=u})(vp||(vp={}));function gp(r){if(vp.is(r)){let i=[];for(let n of r)if(n)try{n.dispose()}catch(_){i.push(_)}if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(r)?[]:r}else if(r)return r.dispose(),r}function c1(...r){return mp(()=>gp(r))}function mp(r){return{dispose:a1(()=>{r()})}}var yp=class wp{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{gp(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?wp.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(i),i}delete(i){if(i){if(i===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(i),i.dispose()}}deleteAndLeak(i){i&&this._toDispose.has(i)&&(this._toDispose.delete(i),void 0)}};yp.DISABLE_DISPOSED_WARNING=!1;var Yc=yp,la=class{constructor(){this._store=new Yc,this._store}dispose(){this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}};la.None=Object.freeze({dispose(){}});var h1=globalThis.performance&&typeof globalThis.performance.now=="function",u1=class Sp{static create(i){return new Sp(i)}constructor(i){this._now=h1&&i===!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}},d1;(r=>{r.None=()=>la.None;function i(O,A){return f(O,()=>{},0,void 0,!0,void 0,A)}r.defer=i;function n(O){return(A,U=null,z)=>{let K=!1,Y;return Y=O(W=>{if(!K)return Y?Y.dispose():K=!0,A.call(U,W)},null,z),K&&Y.dispose(),Y}}r.once=n;function _(O,A,U){return v((z,K=null,Y)=>O(W=>z.call(K,A(W)),null,Y),U)}r.map=_;function p(O,A,U){return v((z,K=null,Y)=>O(W=>{A(W),z.call(K,W)},null,Y),U)}r.forEach=p;function L(O,A,U){return v((z,K=null,Y)=>O(W=>A(W)&&z.call(K,W),null,Y),U)}r.filter=L;function R(O){return O}r.signal=R;function o(...O){return(A,U=null,z)=>{let K=c1(...O.map(Y=>Y(W=>A.call(U,W))));return y(K,z)}}r.any=o;function d(O,A,U,z){let K=U;return _(O,Y=>(K=A(K,Y),K),z)}r.reduce=d;function v(O,A){let U,z={onWillAddFirstListener(){U=O(K.fire,K)},onDidRemoveLastListener(){U==null||U.dispose()}},K=new Oi(z);return A==null||A.add(K),K.event}function y(O,A){return A instanceof Array?A.push(O):A&&A.add(O),O}function f(O,A,U=100,z=!1,K=!1,Y,W){let B,I,P,H=0,J,se={leakWarningThreshold:Y,onWillAddFirstListener(){B=O(de=>{H++,I=A(I,de),z&&!P&&(le.fire(I),I=void 0),J=()=>{let X=I;I=void 0,P=void 0,(!z||H>1)&&le.fire(X),H=0},typeof U=="number"?(clearTimeout(P),P=setTimeout(J,U)):P===void 0&&(P=0,queueMicrotask(J))})},onWillRemoveListener(){K&&H>0&&(J==null||J())},onDidRemoveLastListener(){J=void 0,B.dispose()}},le=new Oi(se);return W==null||W.add(le),le.event}r.debounce=f;function S(O,A=0,U){return r.debounce(O,(z,K)=>z?(z.push(K),z):[K],A,void 0,!0,void 0,U)}r.accumulate=S;function x(O,A=(z,K)=>z===K,U){let z=!0,K;return L(O,Y=>{let W=z||!A(Y,K);return z=!1,K=Y,W},U)}r.latch=x;function T(O,A,U){return[r.filter(O,A,U),r.filter(O,z=>!A(z),U)]}r.split=T;function w(O,A=!1,U=[],z){let K=U.slice(),Y=O(I=>{K?K.push(I):B.fire(I)});z&&z.add(Y);let W=()=>{K==null||K.forEach(I=>B.fire(I)),K=null},B=new Oi({onWillAddFirstListener(){Y||(Y=O(I=>B.fire(I)),z&&z.add(Y))},onDidAddFirstListener(){K&&(A?setTimeout(W):W())},onDidRemoveLastListener(){Y&&Y.dispose(),Y=null}});return z&&z.add(B),B.event}r.buffer=w;function c(O,A){return(U,z,K)=>{let Y=A(new l);return O(function(W){let B=Y.evaluate(W);B!==h&&U.call(z,B)},void 0,K)}}r.chain=c;let h=Symbol("HaltChainable");class l{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push(U=>(A(U),U)),this}filter(A){return this.steps.push(U=>A(U)?U:h),this}reduce(A,U){let z=U;return this.steps.push(K=>(z=A(z,K),z)),this}latch(A=(U,z)=>U===z){let U=!0,z;return this.steps.push(K=>{let Y=U||!A(K,z);return U=!1,z=K,Y?K:h}),this}evaluate(A){for(let U of this.steps)if(A=U(A),A===h)break;return A}}function u(O,A,U=z=>z){let z=(...B)=>W.fire(U(...B)),K=()=>O.on(A,z),Y=()=>O.removeListener(A,z),W=new Oi({onWillAddFirstListener:K,onDidRemoveLastListener:Y});return W.event}r.fromNodeEventEmitter=u;function g(O,A,U=z=>z){let z=(...B)=>W.fire(U(...B)),K=()=>O.addEventListener(A,z),Y=()=>O.removeEventListener(A,z),W=new Oi({onWillAddFirstListener:K,onDidRemoveLastListener:Y});return W.event}r.fromDOMEventEmitter=g;function C(O){return new Promise(A=>n(O)(A))}r.toPromise=C;function k(O){let A=new Oi;return O.then(U=>{A.fire(U)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}r.fromPromise=k;function D(O,A){return O(U=>A.fire(U))}r.forward=D;function E(O,A,U){return A(U),O(z=>A(z))}r.runAndSubscribe=E;class N{constructor(A,U){this._observable=A,this._counter=0,this._hasChanged=!1;let z={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new Oi(z),U&&U.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,U){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function V(O,A){return new N(O,A).emitter.event}r.fromObservable=V;function q(O){return(A,U,z)=>{let K=0,Y=!1,W={beginUpdate(){K++},endUpdate(){K--,K===0&&(O.reportChanges(),Y&&(Y=!1,A.call(U)))},handlePossibleChange(){},handleChange(){Y=!0}};O.addObserver(W),O.reportChanges();let B={dispose(){O.removeObserver(W)}};return z instanceof Yc?z.add(B):Array.isArray(z)&&z.push(B),B}}r.fromObservableLight=q})(d1||(d1={}));var Fc=class Hc{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${Hc._idPool++}`,Hc.all.add(this)}start(i){this._stopWatch=new u1,this.listenerCount=i}stop(){if(this._stopWatch){let i=this._stopWatch.elapsed();this.durations.push(i),this.elapsedOverall+=i,this.invocationCount+=1,this._stopWatch=void 0}}};Fc.all=new Set,Fc._idPool=0;var f1=Fc,p1=-1,Cp=class xp{constructor(i,n,_=(xp._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=n,this.name=_,this._warnCountdown=0}dispose(){var i;(i=this._stacks)==null||i.clear()}check(i,n){let _=this.threshold;if(_<=0||n<_)return;this._stacks||(this._stacks=new Map);let p=this._stacks.get(i.value)||0;if(this._stacks.set(i.value,p+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=_*.5;let[L,R]=this.getMostFrequentStack(),o=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${R}):`;console.warn(o),console.warn(L);let d=new g1(o,L);this._errorHandler(d)}return()=>{let L=this._stacks.get(i.value)||0;this._stacks.set(i.value,L-1)}}getMostFrequentStack(){if(!this._stacks)return;let i,n=0;for(let[_,p]of this._stacks)(!i||n<p)&&(i=[_,p],n=p);return i}};Cp._idPool=1;var _1=Cp,v1=class bp{constructor(i){this.value=i}static create(){let i=new Error;return new bp(i.stack??"")}print(){console.warn(this.value.split(`
86
+ `).slice(2).join(`
87
+ `))}},g1=class extends Error{constructor(i,n){super(i),this.name="ListenerLeakError",this.stack=n}},m1=class extends Error{constructor(i,n){super(i),this.name="ListenerRefusalError",this.stack=n}},y1=0,pc=class{constructor(r){this.value=r,this.id=y1++}},w1=2,S1,Oi=class{constructor(i){var n,_,p,L;this._size=0,this._options=i,this._leakageMon=(n=this._options)!=null&&n.leakWarningThreshold?new _1((i==null?void 0:i.onListenerError)??fc,((_=this._options)==null?void 0:_.leakWarningThreshold)??p1):void 0,this._perfMon=(p=this._options)!=null&&p._profName?new f1(this._options._profName):void 0,this._deliveryQueue=(L=this._options)==null?void 0:L.deliveryQueue}dispose(){var i,n,_,p;this._disposed||(this._disposed=!0,((i=this._deliveryQueue)==null?void 0:i.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(_=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||_.call(n),(p=this._leakageMon)==null||p.dispose())}get event(){return this._event??(this._event=(i,n,_)=>{var o,d,v,y,f;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let S=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(S);let x=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],T=new m1(`${S}. HINT: Stack shows most frequent listener (${x[1]}-times)`,x[0]);return(((o=this._options)==null?void 0:o.onListenerError)||fc)(T),la.None}if(this._disposed)return la.None;n&&(i=i.bind(n));let p=new pc(i),L;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(p.stack=v1.create(),L=this._leakageMon.check(p.stack,this._size+1)),this._listeners?this._listeners instanceof pc?(this._deliveryQueue??(this._deliveryQueue=new C1),this._listeners=[this._listeners,p]):this._listeners.push(p):((v=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||v.call(d,this),this._listeners=p,(f=(y=this._options)==null?void 0:y.onDidAddFirstListener)==null||f.call(y,this)),this._size++;let R=mp(()=>{L==null||L(),this._removeListener(p)});return _ instanceof Yc?_.add(R):Array.isArray(_)&&_.push(R),R}),this._event}_removeListener(i){var L,R,o,d;if((R=(L=this._options)==null?void 0:L.onWillRemoveListener)==null||R.call(L,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||d.call(o,this),this._size=0;return}let n=this._listeners,_=n.indexOf(i);if(_===-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--,n[_]=void 0;let p=this._deliveryQueue.current===this;if(this._size*w1<=n.length){let v=0;for(let y=0;y<n.length;y++)n[y]?n[v++]=n[y]:p&&(this._deliveryQueue.end--,v<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=v}}_deliver(i,n){var p;if(!i)return;let _=((p=this._options)==null?void 0:p.onListenerError)||fc;if(!_){i.value(n);return}try{i.value(n)}catch(L){_(L)}}_deliverQueue(i){let n=i.current._listeners;for(;i.i<i.end;)this._deliver(n[i.i++],i.value);i.reset()}fire(i){var n,_,p,L;if((n=this._deliveryQueue)!=null&&n.current&&(this._deliverQueue(this._deliveryQueue),(_=this._perfMon)==null||_.stop()),(p=this._perfMon)==null||p.start(this._size),this._listeners)if(this._listeners instanceof pc)this._deliver(this._listeners,i);else{let R=this._deliveryQueue;R.enqueue(this,i,this._listeners.length),this._deliverQueue(R)}(L=this._perfMon)==null||L.stop()}hasListeners(){return this._size>0}},C1=class{constructor(){this.i=-1,this.end=0}enqueue(r,i,n){this.i=0,this.end=n,this.current=r,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ca=class ea{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Oi,this.onChange=this._onChange.event;let i=new r1;this.register(i),this._active=i.version,this._activeProvider=i}static extractShouldJoin(i){return(i&1)!==0}static extractWidth(i){return i>>1&3}static extractCharKind(i){return i>>3}static createPropertyValue(i,n,_=!1){return(i&16777215)<<3|(n&3)<<1|(_?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(i){if(!this._providers[i])throw new Error(`unknown Unicode version "${i}"`);this._active=i,this._activeProvider=this._providers[i],this._onChange.fire(i)}register(i){this._providers[i.version]=i}wcwidth(i){return this._activeProvider.wcwidth(i)}getStringCellWidth(i){let n=0,_=0,p=i.length;for(let L=0;L<p;++L){let R=i.charCodeAt(L);if(55296<=R&&R<=56319){if(++L>=p)return n+this.wcwidth(R);let v=i.charCodeAt(L);56320<=v&&v<=57343?R=(R-55296)*1024+v-56320+65536:n+=this.wcwidth(v)}let o=this.charProperties(R,_),d=ea.extractWidth(o);ea.extractShouldJoin(o)&&(d-=ea.extractWidth(_)),n+=d,_=o}return n}charProperties(i,n){return this._activeProvider.charProperties(i,n)}},_c=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],x1=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],vc=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],b1=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],li;function Jd(r,i){let n=0,_=i.length-1,p;if(r<i[0][0]||r>i[_][1])return!1;for(;_>=n;)if(p=n+_>>1,r>i[p][1])n=p+1;else if(r<i[p][0])_=p-1;else return!0;return!1}var E1=class{constructor(){if(this.version="11",!li){li=new Uint8Array(65536),li.fill(1),li[0]=0,li.fill(0,1,32),li.fill(0,127,160);for(let r=0;r<_c.length;++r)li.fill(0,_c[r][0],_c[r][1]+1);for(let r=0;r<vc.length;++r)li.fill(2,vc[r][0],vc[r][1]+1)}}wcwidth(r){return r<32?0:r<127?1:r<65536?li[r]:Jd(r,x1)?0:Jd(r,b1)?2:1}charProperties(r,i){let n=this.wcwidth(r),_=n===0&&i!==0;if(_){let p=ca.extractWidth(i);p===0?_=!1:p>n&&(n=p)}return ca.createPropertyValue(0,n,_)}},k1=class{activate(r){r.unicode.register(new E1)}dispose(){}};/**
88
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
89
+ * @license MIT
90
+ *
91
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
92
+ * @license MIT
93
+ *
94
+ * Originally forked from (with the author's permission):
95
+ * Fabrice Bellard's javascript vt100 for jslinux:
96
+ * http://bellard.org/jslinux/
97
+ * Copyright (c) 2011 Fabrice Bellard
98
+ */var L1=class{constructor(r,i,n,_={}){this._terminal=r,this._regex=i,this._handler=n,this._options=_}provideLinks(r,i){let n=T1.computeLink(r,this._regex,this._terminal,this._handler);i(this._addCallbacks(n))}_addCallbacks(r){return r.map(i=>(i.leave=this._options.leave,i.hover=(n,_)=>{if(this._options.hover){let{range:p}=i;this._options.hover(n,_,p)}},i))}};function R1(r){try{let i=new URL(r),n=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return r.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var T1=class ta{static computeLink(i,n,_,p){let L=new RegExp(n.source,(n.flags||"")+"g"),[R,o]=ta._getWindowedLineStrings(i-1,_),d=R.join(""),v,y=[];for(;v=L.exec(d);){let f=v[0];if(!R1(f))continue;let[S,x]=ta._mapStrIdx(_,o,0,v.index),[T,w]=ta._mapStrIdx(_,S,x,f.length);if(S===-1||x===-1||T===-1||w===-1)continue;let c={start:{x:x+1,y:S+1},end:{x:w,y:T+1}};y.push({range:c,text:f,activate:p})}return y}static _getWindowedLineStrings(i,n){let _,p=i,L=i,R=0,o="",d=[];if(_=n.buffer.active.getLine(i)){let v=_.translateToString(!0);if(_.isWrapped&&v[0]!==" "){for(R=0;(_=n.buffer.active.getLine(--p))&&R<2048&&(o=_.translateToString(!0),R+=o.length,d.push(o),!(!_.isWrapped||o.indexOf(" ")!==-1)););d.reverse()}for(d.push(v),R=0;(_=n.buffer.active.getLine(++L))&&_.isWrapped&&R<2048&&(o=_.translateToString(!0),R+=o.length,d.push(o),o.indexOf(" ")===-1););}return[d,p]}static _mapStrIdx(i,n,_,p){let L=i.buffer.active,R=L.getNullCell(),o=_;for(;p;){let d=L.getLine(n);if(!d)return[-1,-1];for(let v=o;v<d.length;++v){d.getCell(v,R);let y=R.getChars();if(R.getWidth()&&(p-=y.length||1,v===d.length-1&&y==="")){let f=L.getLine(n+1);f&&f.isWrapped&&(f.getCell(0,R),R.getWidth()===2&&(p+=1))}if(p<0)return[n,v]}n++,o=0}return[n,o]}},M1=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function D1(r,i){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var A1=class{constructor(r=D1,i={}){this._handler=r,this._options=i}activate(r){this._terminal=r;let i=this._options,n=i.urlRegex||M1;this._linkProvider=this._terminal.registerLinkProvider(new L1(this._terminal,n,this._handler,i))}dispose(){var r;(r=this._linkProvider)==null||r.dispose()}};/**
99
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
100
+ * @license MIT
101
+ *
102
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
103
+ * @license MIT
104
+ *
105
+ * Originally forked from (with the author's permission):
106
+ * Fabrice Bellard's javascript vt100 for jslinux:
107
+ * http://bellard.org/jslinux/
108
+ * Copyright (c) 2011 Fabrice Bellard
109
+ */var B1=(r,i,n,_)=>{for(var p=i,L=r.length-1,R;L>=0;L--)(R=r[L])&&(p=R(p)||p);return p},P1=(r,i)=>(n,_)=>i(n,_,r),O1=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(r){setTimeout(()=>{throw r.stack?Qd.isErrorNoTelemetry(r)?new Qd(r.message+`
110
+
111
+ `+r.stack):new Error(r.message+`
112
+
113
+ `+r.stack):r},0)}}addListener(r){return this.listeners.push(r),()=>{this._removeListener(r)}}emit(r){this.listeners.forEach(i=>{i(r)})}_removeListener(r){this.listeners.splice(this.listeners.indexOf(r),1)}setUnexpectedErrorHandler(r){this.unexpectedErrorHandler=r}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(r){this.unexpectedErrorHandler(r),this.emit(r)}onUnexpectedExternalError(r){this.unexpectedErrorHandler(r)}},N1=new O1;function gc(r){I1(r)||N1.onUnexpectedError(r)}var $c="Canceled";function I1(r){return r instanceof j1?!0:r instanceof Error&&r.name===$c&&r.message===$c}var j1=class extends Error{constructor(){super($c),this.name=this.message}},Qd=class zc extends Error{constructor(i){super(i),this.name="CodeExpectedError"}static fromError(i){if(i instanceof zc)return i;let n=new zc;return n.message=i.message,n.stack=i.stack,n}static isErrorNoTelemetry(i){return i.name==="CodeExpectedError"}},F1;(r=>{function i(L){return L<0}r.isLessThan=i;function n(L){return L<=0}r.isLessThanOrEqual=n;function _(L){return L>0}r.isGreaterThan=_;function p(L){return L===0}r.isNeitherLessOrGreaterThan=p,r.greaterThan=1,r.lessThan=-1,r.neitherLessOrGreaterThan=0})(F1||(F1={}));function H1(r,i){let n=this,_=!1,p;return function(){return _||(_=!0,i||(p=r.apply(n,arguments))),p}}var Ep;(r=>{function i(g){return g&&typeof g=="object"&&typeof g[Symbol.iterator]=="function"}r.is=i;let n=Object.freeze([]);function _(){return n}r.empty=_;function*p(g){yield g}r.single=p;function L(g){return i(g)?g:p(g)}r.wrap=L;function R(g){return g||n}r.from=R;function*o(g){for(let C=g.length-1;C>=0;C--)yield g[C]}r.reverse=o;function d(g){return!g||g[Symbol.iterator]().next().done===!0}r.isEmpty=d;function v(g){return g[Symbol.iterator]().next().value}r.first=v;function y(g,C){let k=0;for(let D of g)if(C(D,k++))return!0;return!1}r.some=y;function f(g,C){for(let k of g)if(C(k))return k}r.find=f;function*S(g,C){for(let k of g)C(k)&&(yield k)}r.filter=S;function*x(g,C){let k=0;for(let D of g)yield C(D,k++)}r.map=x;function*T(g,C){let k=0;for(let D of g)yield*C(D,k++)}r.flatMap=T;function*w(...g){for(let C of g)yield*C}r.concat=w;function c(g,C,k){let D=k;for(let E of g)D=C(D,E);return D}r.reduce=c;function*h(g,C,k=g.length){for(C<0&&(C+=g.length),k<0?k+=g.length:k>g.length&&(k=g.length);C<k;C++)yield g[C]}r.slice=h;function l(g,C=Number.POSITIVE_INFINITY){let k=[];if(C===0)return[k,g];let D=g[Symbol.iterator]();for(let E=0;E<C;E++){let N=D.next();if(N.done)return[k,r.empty()];k.push(N.value)}return[k,{[Symbol.iterator](){return D}}]}r.consume=l;async function u(g){let C=[];for await(let k of g)C.push(k);return Promise.resolve(C)}r.asyncToArray=u})(Ep||(Ep={}));function kp(r){if(Ep.is(r)){let i=[];for(let n of r)if(n)try{n.dispose()}catch(_){i.push(_)}if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(r)?[]:r}else if(r)return r.dispose(),r}function Lp(...r){return ir(()=>kp(r))}function ir(r){return{dispose:H1(()=>{r()})}}var Rp=class Tp{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{kp(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Tp.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(i),i}delete(i){if(i){if(i===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(i),i.dispose()}}deleteAndLeak(i){i&&this._toDispose.has(i)&&(this._toDispose.delete(i),void 0)}};Rp.DISABLE_DISPOSED_WARNING=!1;var js=Rp,Ur=class{constructor(){this._store=new js,this._store}dispose(){this._store.dispose()}_register(r){if(r===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(r)}};Ur.None=Object.freeze({dispose(){}});var xn=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(r){var i;this._isDisposed||r===this._value||((i=this._value)==null||i.dispose(),this._value=r)}clear(){this.value=void 0}dispose(){var r;this._isDisposed=!0,(r=this._value)==null||r.dispose(),this._value=void 0}clearAndLeak(){let r=this._value;return this._value=void 0,r}},Xc=typeof process<"u"&&"title"in process,da=Xc?"node":navigator.userAgent,$1=Xc?"node":navigator.platform,z1=da.includes("Firefox"),U1=da.includes("Edge"),Mp=/^((?!chrome|android).)*safari/i.test(da);function W1(){if(!Mp)return 0;let r=da.match(/Version\/(\d+)/);return r===null||r.length<2?0:parseInt(r[1])}$1.indexOf("Linux")>=0;var V1="",$t=0,zt=0,Ut=0,wt=0,Dr={css:"#00000000",rgba:0},lr;(r=>{function i(p,L,R,o){return o!==void 0?`#${Zi(p)}${Zi(L)}${Zi(R)}${Zi(o)}`:`#${Zi(p)}${Zi(L)}${Zi(R)}`}r.toCss=i;function n(p,L,R,o=255){return(p<<24|L<<16|R<<8|o)>>>0}r.toRgba=n;function _(p,L,R,o){return{css:r.toCss(p,L,R,o),rgba:r.toRgba(p,L,R,o)}}r.toColor=_})(lr||(lr={}));var Rn;(r=>{function i(d,v){if(wt=(v.rgba&255)/255,wt===1)return{css:v.css,rgba:v.rgba};let y=v.rgba>>24&255,f=v.rgba>>16&255,S=v.rgba>>8&255,x=d.rgba>>24&255,T=d.rgba>>16&255,w=d.rgba>>8&255;$t=x+Math.round((y-x)*wt),zt=T+Math.round((f-T)*wt),Ut=w+Math.round((S-w)*wt);let c=lr.toCss($t,zt,Ut),h=lr.toRgba($t,zt,Ut);return{css:c,rgba:h}}r.blend=i;function n(d){return(d.rgba&255)===255}r.isOpaque=n;function _(d,v,y){let f=rs.ensureContrastRatio(d.rgba,v.rgba,y);if(f)return lr.toColor(f>>24&255,f>>16&255,f>>8&255)}r.ensureContrastRatio=_;function p(d){let v=(d.rgba|255)>>>0;return[$t,zt,Ut]=rs.toChannels(v),{css:lr.toCss($t,zt,Ut),rgba:v}}r.opaque=p;function L(d,v){return wt=Math.round(v*255),[$t,zt,Ut]=rs.toChannels(d.rgba),{css:lr.toCss($t,zt,Ut,wt),rgba:lr.toRgba($t,zt,Ut,wt)}}r.opacity=L;function R(d,v){return wt=d.rgba&255,L(d,wt*v/255)}r.multiplyOpacity=R;function o(d){return[d.rgba>>24&255,d.rgba>>16&255,d.rgba>>8&255]}r.toColorRGB=o})(Rn||(Rn={}));var K1;(r=>{let i,n;try{let p=document.createElement("canvas");p.width=1,p.height=1;let L=p.getContext("2d",{willReadFrequently:!0});L&&(i=L,i.globalCompositeOperation="copy",n=i.createLinearGradient(0,0,1,1))}catch{}function _(p){if(p.match(/#[\da-f]{3,8}/i))switch(p.length){case 4:return $t=parseInt(p.slice(1,2).repeat(2),16),zt=parseInt(p.slice(2,3).repeat(2),16),Ut=parseInt(p.slice(3,4).repeat(2),16),lr.toColor($t,zt,Ut);case 5:return $t=parseInt(p.slice(1,2).repeat(2),16),zt=parseInt(p.slice(2,3).repeat(2),16),Ut=parseInt(p.slice(3,4).repeat(2),16),wt=parseInt(p.slice(4,5).repeat(2),16),lr.toColor($t,zt,Ut,wt);case 7:return{css:p,rgba:(parseInt(p.slice(1),16)<<8|255)>>>0};case 9:return{css:p,rgba:parseInt(p.slice(1),16)>>>0}}let L=p.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(L)return $t=parseInt(L[1]),zt=parseInt(L[2]),Ut=parseInt(L[3]),wt=Math.round((L[5]===void 0?1:parseFloat(L[5]))*255),lr.toColor($t,zt,Ut,wt);if(!i||!n)throw new Error("css.toColor: Unsupported css format");if(i.fillStyle=n,i.fillStyle=p,typeof i.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(i.fillRect(0,0,1,1),[$t,zt,Ut,wt]=i.getImageData(0,0,1,1).data,wt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:lr.toRgba($t,zt,Ut,wt),css:p}}r.toColor=_})(K1||(K1={}));var ar;(r=>{function i(_){return n(_>>16&255,_>>8&255,_&255)}r.relativeLuminance=i;function n(_,p,L){let R=_/255,o=p/255,d=L/255,v=R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4),y=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),f=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4);return v*.2126+y*.7152+f*.0722}r.relativeLuminance2=n})(ar||(ar={}));var rs;(r=>{function i(R,o){if(wt=(o&255)/255,wt===1)return o;let d=o>>24&255,v=o>>16&255,y=o>>8&255,f=R>>24&255,S=R>>16&255,x=R>>8&255;return $t=f+Math.round((d-f)*wt),zt=S+Math.round((v-S)*wt),Ut=x+Math.round((y-x)*wt),lr.toRgba($t,zt,Ut)}r.blend=i;function n(R,o,d){let v=ar.relativeLuminance(R>>8),y=ar.relativeLuminance(o>>8);if(ci(v,y)<d){if(y<v){let x=_(R,o,d),T=ci(v,ar.relativeLuminance(x>>8));if(T<d){let w=p(R,o,d),c=ci(v,ar.relativeLuminance(w>>8));return T>c?x:w}return x}let f=p(R,o,d),S=ci(v,ar.relativeLuminance(f>>8));if(S<d){let x=_(R,o,d),T=ci(v,ar.relativeLuminance(x>>8));return S>T?f:x}return f}}r.ensureContrastRatio=n;function _(R,o,d){let v=R>>24&255,y=R>>16&255,f=R>>8&255,S=o>>24&255,x=o>>16&255,T=o>>8&255,w=ci(ar.relativeLuminance2(S,x,T),ar.relativeLuminance2(v,y,f));for(;w<d&&(S>0||x>0||T>0);)S-=Math.max(0,Math.ceil(S*.1)),x-=Math.max(0,Math.ceil(x*.1)),T-=Math.max(0,Math.ceil(T*.1)),w=ci(ar.relativeLuminance2(S,x,T),ar.relativeLuminance2(v,y,f));return(S<<24|x<<16|T<<8|255)>>>0}r.reduceLuminance=_;function p(R,o,d){let v=R>>24&255,y=R>>16&255,f=R>>8&255,S=o>>24&255,x=o>>16&255,T=o>>8&255,w=ci(ar.relativeLuminance2(S,x,T),ar.relativeLuminance2(v,y,f));for(;w<d&&(S<255||x<255||T<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),T=Math.min(255,T+Math.ceil((255-T)*.1)),w=ci(ar.relativeLuminance2(S,x,T),ar.relativeLuminance2(v,y,f));return(S<<24|x<<16|T<<8|255)>>>0}r.increaseLuminance=p;function L(R){return[R>>24&255,R>>16&255,R>>8&255,R&255]}r.toChannels=L})(rs||(rs={}));function Zi(r){let i=r.toString(16);return i.length<2?"0"+i:i}function ci(r,i){return r<i?(i+.05)/(r+.05):(r+.05)/(i+.05)}function Rt(r){if(!r)throw new Error("value must not be falsy");return r}function Jc(r){return 57508<=r&&r<=57558}function q1(r){return 57520<=r&&r<=57527}function G1(r){return 57344<=r&&r<=63743}function Y1(r){return 9472<=r&&r<=9631}function X1(r){return r>=128512&&r<=128591||r>=127744&&r<=128511||r>=128640&&r<=128767||r>=9728&&r<=9983||r>=9984&&r<=10175||r>=65024&&r<=65039||r>=129280&&r<=129535||r>=127462&&r<=127487}function J1(r,i,n,_){return i===1&&n>Math.ceil(_*1.5)&&r!==void 0&&r>255&&!X1(r)&&!Jc(r)&&!G1(r)}function Dp(r){return Jc(r)||Y1(r)}function Q1(){return{css:{canvas:Go(),cell:Go()},device:{canvas:Go(),cell:Go(),char:{width:0,height:0,left:0,top:0}}}}function Go(){return{width:0,height:0}}function Z1(r,i,n=0){return(r-(Math.round(i)*2-n))%(Math.round(i)*2)}var Gt=0,Ft=0,Xr=!1,hi=!1,Yo=!1,_r,mc=0,ey=class{constructor(r,i,n,_,p,L){this._terminal=r,this._optionService=i,this._selectionRenderModel=n,this._decorationService=_,this._coreBrowserService=p,this._themeService=L,this.result={fg:0,bg:0,ext:0}}resolve(r,i,n,_){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=r.bg&268435456?r.extended.ext:0,Ft=0,Gt=0,hi=!1,Xr=!1,Yo=!1,_r=this._themeService.colors,mc=0,r.getCode()!==0&&r.extended.underlineStyle===4){let p=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));mc=i*_%(Math.round(p)*2)}if(this._decorationService.forEachDecorationAtCell(i,n,"bottom",p=>{p.backgroundColorRGB&&(Ft=p.backgroundColorRGB.rgba>>8&16777215,hi=!0),p.foregroundColorRGB&&(Gt=p.foregroundColorRGB.rgba>>8&16777215,Xr=!0)}),Yo=this._selectionRenderModel.isCellSelected(this._terminal,i,n),Yo){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ft=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ft=(this.result.fg&16777215)<<8|255;break;case 0:default:Ft=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ft=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ft=(this.result.bg&16777215)<<8|255;break}Ft=rs.blend(Ft,(this._coreBrowserService.isFocused?_r.selectionBackgroundOpaque:_r.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ft=(this._coreBrowserService.isFocused?_r.selectionBackgroundOpaque:_r.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(hi=!0,_r.selectionForeground&&(Gt=_r.selectionForeground.rgba>>8&16777215,Xr=!0),Dp(r.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Gt=(this._coreBrowserService.isFocused?_r.selectionBackgroundOpaque:_r.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Gt=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Gt=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Gt=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Gt=(this.result.fg&16777215)<<8|255;break;case 0:default:Gt=this._themeService.colors.foreground.rgba}Gt=rs.blend(Gt,(this._coreBrowserService.isFocused?_r.selectionBackgroundOpaque:_r.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Xr=!0}}this._decorationService.forEachDecorationAtCell(i,n,"top",p=>{p.backgroundColorRGB&&(Ft=p.backgroundColorRGB.rgba>>8&16777215,hi=!0),p.foregroundColorRGB&&(Gt=p.foregroundColorRGB.rgba>>8&16777215,Xr=!0)}),hi&&(Yo?Ft=r.bg&-16777216&-134217729|Ft|50331648:Ft=r.bg&-16777216|Ft|50331648),Xr&&(Gt=r.fg&-16777216&-67108865|Gt|50331648),this.result.fg&67108864&&(hi&&!Xr&&((this.result.bg&50331648)===0?Gt=this.result.fg&-134217728|_r.background.rgba>>8&16777215&16777215|50331648:Gt=this.result.fg&-134217728|this.result.bg&67108863,Xr=!0),!hi&&Xr&&((this.result.fg&50331648)===0?Ft=this.result.bg&-67108864|_r.foreground.rgba>>8&16777215&16777215|50331648:Ft=this.result.bg&-67108864|this.result.fg&67108863,hi=!0)),_r=void 0,this.result.bg=hi?Ft:this.result.bg,this.result.fg=Xr?Gt:this.result.fg,this.result.ext&=536870911,this.result.ext|=mc<<29&3758096384}},ty=.5,Ap=z1||U1?"bottom":"ideographic",ry={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},iy={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},sy={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(r,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"║":{1:(r,i)=>`M${.5-r},0 L${.5-r},1 M${.5+r},0 L${.5+r},1`},"╒":{1:(r,i)=>`M.5,1 L.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╓":{1:(r,i)=>`M${.5-r},1 L${.5-r},.5 L1,.5 M${.5+r},.5 L${.5+r},1`},"╔":{1:(r,i)=>`M1,${.5-i} L${.5-r},${.5-i} L${.5-r},1 M1,${.5+i} L${.5+r},${.5+i} L${.5+r},1`},"╕":{1:(r,i)=>`M0,${.5-i} L.5,${.5-i} L.5,1 M0,${.5+i} L.5,${.5+i}`},"╖":{1:(r,i)=>`M${.5+r},1 L${.5+r},.5 L0,.5 M${.5-r},.5 L${.5-r},1`},"╗":{1:(r,i)=>`M0,${.5+i} L${.5-r},${.5+i} L${.5-r},1 M0,${.5-i} L${.5+r},${.5-i} L${.5+r},1`},"╘":{1:(r,i)=>`M.5,0 L.5,${.5+i} L1,${.5+i} M.5,${.5-i} L1,${.5-i}`},"╙":{1:(r,i)=>`M1,.5 L${.5-r},.5 L${.5-r},0 M${.5+r},.5 L${.5+r},0`},"╚":{1:(r,i)=>`M1,${.5-i} L${.5+r},${.5-i} L${.5+r},0 M1,${.5+i} L${.5-r},${.5+i} L${.5-r},0`},"╛":{1:(r,i)=>`M0,${.5+i} L.5,${.5+i} L.5,0 M0,${.5-i} L.5,${.5-i}`},"╜":{1:(r,i)=>`M0,.5 L${.5+r},.5 L${.5+r},0 M${.5-r},.5 L${.5-r},0`},"╝":{1:(r,i)=>`M0,${.5-i} L${.5-r},${.5-i} L${.5-r},0 M0,${.5+i} L${.5+r},${.5+i} L${.5+r},0`},"╞":{1:(r,i)=>`M.5,0 L.5,1 M.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╟":{1:(r,i)=>`M${.5-r},0 L${.5-r},1 M${.5+r},0 L${.5+r},1 M${.5+r},.5 L1,.5`},"╠":{1:(r,i)=>`M${.5-r},0 L${.5-r},1 M1,${.5+i} L${.5+r},${.5+i} L${.5+r},1 M1,${.5-i} L${.5+r},${.5-i} L${.5+r},0`},"╡":{1:(r,i)=>`M.5,0 L.5,1 M0,${.5-i} L.5,${.5-i} M0,${.5+i} L.5,${.5+i}`},"╢":{1:(r,i)=>`M0,.5 L${.5-r},.5 M${.5-r},0 L${.5-r},1 M${.5+r},0 L${.5+r},1`},"╣":{1:(r,i)=>`M${.5+r},0 L${.5+r},1 M0,${.5+i} L${.5-r},${.5+i} L${.5-r},1 M0,${.5-i} L${.5-r},${.5-i} L${.5-r},0`},"╤":{1:(r,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i} M.5,${.5+i} L.5,1`},"╥":{1:(r,i)=>`M0,.5 L1,.5 M${.5-r},.5 L${.5-r},1 M${.5+r},.5 L${.5+r},1`},"╦":{1:(r,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L${.5-r},${.5+i} L${.5-r},1 M1,${.5+i} L${.5+r},${.5+i} L${.5+r},1`},"╧":{1:(r,i)=>`M.5,0 L.5,${.5-i} M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╨":{1:(r,i)=>`M0,.5 L1,.5 M${.5-r},.5 L${.5-r},0 M${.5+r},.5 L${.5+r},0`},"╩":{1:(r,i)=>`M0,${.5+i} L1,${.5+i} M0,${.5-i} L${.5-r},${.5-i} L${.5-r},0 M1,${.5-i} L${.5+r},${.5-i} L${.5+r},0`},"╪":{1:(r,i)=>`M.5,0 L.5,1 M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╫":{1:(r,i)=>`M0,.5 L1,.5 M${.5-r},0 L${.5-r},1 M${.5+r},0 L${.5+r},1`},"╬":{1:(r,i)=>`M0,${.5+i} L${.5-r},${.5+i} L${.5-r},1 M1,${.5+i} L${.5+r},${.5+i} L${.5+r},1 M0,${.5-i} L${.5-r},${.5-i} L${.5-r},0 M1,${.5-i} L${.5+r},${.5-i} L${.5+r},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(r,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,1,.5`},"╮":{1:(r,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,0,.5`},"╯":{1:(r,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,0,.5`},"╰":{1:(r,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,1,.5`}},Bn={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Bn[""]=Bn[""];Bn[""]=Bn[""];function ny(r,i,n,_,p,L,R,o){let d=ry[i];if(d)return oy(r,d,n,_,p,L),!0;let v=iy[i];if(v)return ay(r,v,n,_,p,L),!0;let y=sy[i];if(y)return ly(r,y,n,_,p,L,o),!0;let f=Bn[i];return f?(cy(r,f,n,_,p,L,R,o),!0):!1}function oy(r,i,n,_,p,L){for(let R=0;R<i.length;R++){let o=i[R],d=p/8,v=L/8;r.fillRect(n+o.x*d,_+o.y*v,o.w*d,o.h*v)}}var Zd=new Map;function ay(r,i,n,_,p,L){let R=Zd.get(i);R||(R=new Map,Zd.set(i,R));let o=r.fillStyle;if(typeof o!="string")throw new Error(`Unexpected fillStyle type "${o}"`);let d=R.get(o);if(!d){let v=i[0].length,y=i.length,f=r.canvas.ownerDocument.createElement("canvas");f.width=v,f.height=y;let S=Rt(f.getContext("2d")),x=new ImageData(v,y),T,w,c,h;if(o.startsWith("#"))T=parseInt(o.slice(1,3),16),w=parseInt(o.slice(3,5),16),c=parseInt(o.slice(5,7),16),h=o.length>7&&parseInt(o.slice(7,9),16)||1;else if(o.startsWith("rgba"))[T,w,c,h]=o.substring(5,o.length-1).split(",").map(l=>parseFloat(l));else throw new Error(`Unexpected fillStyle color format "${o}" when drawing pattern glyph`);for(let l=0;l<y;l++)for(let u=0;u<v;u++)x.data[(l*v+u)*4]=T,x.data[(l*v+u)*4+1]=w,x.data[(l*v+u)*4+2]=c,x.data[(l*v+u)*4+3]=i[l][u]*(h*255);S.putImageData(x,0,0),d=Rt(r.createPattern(f,null)),R.set(o,d)}r.fillStyle=d,r.fillRect(n,_,p,L)}function ly(r,i,n,_,p,L,R){r.strokeStyle=r.fillStyle;for(let[o,d]of Object.entries(i)){r.beginPath(),r.lineWidth=R*Number.parseInt(o);let v;if(typeof d=="function"){let y=.15/L*p;v=d(.15,y)}else v=d;for(let y of v.split(" ")){let f=y[0],S=Bp[f];if(!S){console.error(`Could not find drawing instructions for "${f}"`);continue}let x=y.substring(1).split(",");!x[0]||!x[1]||S(r,Pp(x,p,L,n,_,!0,R))}r.stroke(),r.closePath()}}function cy(r,i,n,_,p,L,R,o){let d=new Path2D;d.rect(n,_,p,L),r.clip(d),r.beginPath();let v=R/12;r.lineWidth=o*v;for(let y of i.d.split(" ")){let f=y[0],S=Bp[f];if(!S){console.error(`Could not find drawing instructions for "${f}"`);continue}let x=y.substring(1).split(",");!x[0]||!x[1]||S(r,Pp(x,p,L,n,_,!1,o,(i.leftPadding??0)*(v/2),(i.rightPadding??0)*(v/2)))}i.type===1?(r.strokeStyle=r.fillStyle,r.stroke()):r.fill(),r.closePath()}function ef(r,i,n=0){return Math.max(Math.min(r,i),n)}var Bp={C:(r,i)=>r.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]),L:(r,i)=>r.lineTo(i[0],i[1]),M:(r,i)=>r.moveTo(i[0],i[1])};function Pp(r,i,n,_,p,L,R,o=0,d=0){let v=r.map(y=>parseFloat(y)||parseInt(y));if(v.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<v.length;y+=2)v[y]*=i-o*R-d*R,L&&v[y]!==0&&(v[y]=ef(Math.round(v[y]+.5)-.5,i,0)),v[y]+=_+o*R;for(let y=1;y<v.length;y+=2)v[y]*=n,L&&v[y]!==0&&(v[y]=ef(Math.round(v[y]+.5)-.5,n,0)),v[y]+=p;return v}var tf=class{constructor(){this._data={}}set(r,i,n){this._data[r]||(this._data[r]={}),this._data[r][i]=n}get(r,i){return this._data[r]?this._data[r][i]:void 0}clear(){this._data={}}},rf=class{constructor(){this._data=new tf}set(r,i,n,_,p){this._data.get(r,i)||this._data.set(r,i,new tf),this._data.get(r,i).set(n,_,p)}get(r,i,n,_){var p;return(p=this._data.get(r,i))==null?void 0:p.get(n,_)}clear(){this._data.clear()}},Op=class{constructor(){this._tasks=[],this._i=0}enqueue(r){this._tasks.push(r),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(r){this._idleCallback=void 0;let i=0,n=0,_=r.timeRemaining(),p=0;for(;this._i<this._tasks.length;){if(i=performance.now(),this._tasks[this._i]()||this._i++,i=Math.max(1,performance.now()-i),n=Math.max(i,n),p=r.timeRemaining(),n*1.5>p){_-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(_-i))}ms`),this._start();return}_=p}this.clear()}},hy=class extends Op{_requestCallback(r){return setTimeout(()=>r(this._createDeadline(16)))}_cancelCallback(r){clearTimeout(r)}_createDeadline(r){let i=performance.now()+r;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},uy=class extends Op{_requestCallback(r){return requestIdleCallback(r)}_cancelCallback(r){cancelIdleCallback(r)}},dy=!Xc&&"requestIdleCallback"in window?uy:hy,Ns=class Np{constructor(){this.fg=0,this.bg=0,this.extended=new Ip}static toColorRGB(i){return[i>>>16&255,i>>>8&255,i&255]}static fromColorRGB(i){return(i[0]&255)<<16|(i[1]&255)<<8|i[2]&255}clone(){let i=new Np;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}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}},Ip=class jp{constructor(i=0,n=0){this._ext=0,this._urlId=0,this._ext=i,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(i){this._ext=i}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(i){this._ext&=-469762049,this._ext|=i<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(i){this._ext&=-67108864,this._ext|=i&67108863}get urlId(){return this._urlId}set urlId(i){this._urlId=i}get underlineVariantOffset(){let i=(this._ext&3758096384)>>29;return i<0?i^4294967288:i}set underlineVariantOffset(i){this._ext&=536870911,this._ext|=i<<29&3758096384}clone(){return new jp(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},fy=globalThis.performance&&typeof globalThis.performance.now=="function",py=class Fp{static create(i){return new Fp(i)}constructor(i){this._now=fy&&i===!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}},fi;(r=>{r.None=()=>Ur.None;function i(O,A){return f(O,()=>{},0,void 0,!0,void 0,A)}r.defer=i;function n(O){return(A,U=null,z)=>{let K=!1,Y;return Y=O(W=>{if(!K)return Y?Y.dispose():K=!0,A.call(U,W)},null,z),K&&Y.dispose(),Y}}r.once=n;function _(O,A,U){return v((z,K=null,Y)=>O(W=>z.call(K,A(W)),null,Y),U)}r.map=_;function p(O,A,U){return v((z,K=null,Y)=>O(W=>{A(W),z.call(K,W)},null,Y),U)}r.forEach=p;function L(O,A,U){return v((z,K=null,Y)=>O(W=>A(W)&&z.call(K,W),null,Y),U)}r.filter=L;function R(O){return O}r.signal=R;function o(...O){return(A,U=null,z)=>{let K=Lp(...O.map(Y=>Y(W=>A.call(U,W))));return y(K,z)}}r.any=o;function d(O,A,U,z){let K=U;return _(O,Y=>(K=A(K,Y),K),z)}r.reduce=d;function v(O,A){let U,z={onWillAddFirstListener(){U=O(K.fire,K)},onDidRemoveLastListener(){U==null||U.dispose()}},K=new ot(z);return A==null||A.add(K),K.event}function y(O,A){return A instanceof Array?A.push(O):A&&A.add(O),O}function f(O,A,U=100,z=!1,K=!1,Y,W){let B,I,P,H=0,J,se={leakWarningThreshold:Y,onWillAddFirstListener(){B=O(de=>{H++,I=A(I,de),z&&!P&&(le.fire(I),I=void 0),J=()=>{let X=I;I=void 0,P=void 0,(!z||H>1)&&le.fire(X),H=0},typeof U=="number"?(clearTimeout(P),P=setTimeout(J,U)):P===void 0&&(P=0,queueMicrotask(J))})},onWillRemoveListener(){K&&H>0&&(J==null||J())},onDidRemoveLastListener(){J=void 0,B.dispose()}},le=new ot(se);return W==null||W.add(le),le.event}r.debounce=f;function S(O,A=0,U){return r.debounce(O,(z,K)=>z?(z.push(K),z):[K],A,void 0,!0,void 0,U)}r.accumulate=S;function x(O,A=(z,K)=>z===K,U){let z=!0,K;return L(O,Y=>{let W=z||!A(Y,K);return z=!1,K=Y,W},U)}r.latch=x;function T(O,A,U){return[r.filter(O,A,U),r.filter(O,z=>!A(z),U)]}r.split=T;function w(O,A=!1,U=[],z){let K=U.slice(),Y=O(I=>{K?K.push(I):B.fire(I)});z&&z.add(Y);let W=()=>{K==null||K.forEach(I=>B.fire(I)),K=null},B=new ot({onWillAddFirstListener(){Y||(Y=O(I=>B.fire(I)),z&&z.add(Y))},onDidAddFirstListener(){K&&(A?setTimeout(W):W())},onDidRemoveLastListener(){Y&&Y.dispose(),Y=null}});return z&&z.add(B),B.event}r.buffer=w;function c(O,A){return(U,z,K)=>{let Y=A(new l);return O(function(W){let B=Y.evaluate(W);B!==h&&U.call(z,B)},void 0,K)}}r.chain=c;let h=Symbol("HaltChainable");class l{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push(U=>(A(U),U)),this}filter(A){return this.steps.push(U=>A(U)?U:h),this}reduce(A,U){let z=U;return this.steps.push(K=>(z=A(z,K),z)),this}latch(A=(U,z)=>U===z){let U=!0,z;return this.steps.push(K=>{let Y=U||!A(K,z);return U=!1,z=K,Y?K:h}),this}evaluate(A){for(let U of this.steps)if(A=U(A),A===h)break;return A}}function u(O,A,U=z=>z){let z=(...B)=>W.fire(U(...B)),K=()=>O.on(A,z),Y=()=>O.removeListener(A,z),W=new ot({onWillAddFirstListener:K,onDidRemoveLastListener:Y});return W.event}r.fromNodeEventEmitter=u;function g(O,A,U=z=>z){let z=(...B)=>W.fire(U(...B)),K=()=>O.addEventListener(A,z),Y=()=>O.removeEventListener(A,z),W=new ot({onWillAddFirstListener:K,onDidRemoveLastListener:Y});return W.event}r.fromDOMEventEmitter=g;function C(O){return new Promise(A=>n(O)(A))}r.toPromise=C;function k(O){let A=new ot;return O.then(U=>{A.fire(U)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}r.fromPromise=k;function D(O,A){return O(U=>A.fire(U))}r.forward=D;function E(O,A,U){return A(U),O(z=>A(z))}r.runAndSubscribe=E;class N{constructor(A,U){this._observable=A,this._counter=0,this._hasChanged=!1;let z={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new ot(z),U&&U.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,U){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function V(O,A){return new N(O,A).emitter.event}r.fromObservable=V;function q(O){return(A,U,z)=>{let K=0,Y=!1,W={beginUpdate(){K++},endUpdate(){K--,K===0&&(O.reportChanges(),Y&&(Y=!1,A.call(U)))},handlePossibleChange(){},handleChange(){Y=!0}};O.addObserver(W),O.reportChanges();let B={dispose(){O.removeObserver(W)}};return z instanceof js?z.add(B):Array.isArray(z)&&z.push(B),B}}r.fromObservableLight=q})(fi||(fi={}));var Uc=class Wc{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${Wc._idPool++}`,Wc.all.add(this)}start(i){this._stopWatch=new py,this.listenerCount=i}stop(){if(this._stopWatch){let i=this._stopWatch.elapsed();this.durations.push(i),this.elapsedOverall+=i,this.invocationCount+=1,this._stopWatch=void 0}}};Uc.all=new Set,Uc._idPool=0;var _y=Uc,vy=-1,Hp=class $p{constructor(i,n,_=($p._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=n,this.name=_,this._warnCountdown=0}dispose(){var i;(i=this._stacks)==null||i.clear()}check(i,n){let _=this.threshold;if(_<=0||n<_)return;this._stacks||(this._stacks=new Map);let p=this._stacks.get(i.value)||0;if(this._stacks.set(i.value,p+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=_*.5;let[L,R]=this.getMostFrequentStack(),o=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${R}):`;console.warn(o),console.warn(L);let d=new yy(o,L);this._errorHandler(d)}return()=>{let L=this._stacks.get(i.value)||0;this._stacks.set(i.value,L-1)}}getMostFrequentStack(){if(!this._stacks)return;let i,n=0;for(let[_,p]of this._stacks)(!i||n<p)&&(i=[_,p],n=p);return i}};Hp._idPool=1;var gy=Hp,my=class zp{constructor(i){this.value=i}static create(){let i=new Error;return new zp(i.stack??"")}print(){console.warn(this.value.split(`
114
+ `).slice(2).join(`
115
+ `))}},yy=class extends Error{constructor(r,i){super(r),this.name="ListenerLeakError",this.stack=i}},wy=class extends Error{constructor(r,i){super(r),this.name="ListenerRefusalError",this.stack=i}},Sy=0,yc=class{constructor(r){this.value=r,this.id=Sy++}},Cy=2,xy,ot=class{constructor(r){var i,n,_,p;this._size=0,this._options=r,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new gy((r==null?void 0:r.onListenerError)??gc,((n=this._options)==null?void 0:n.leakWarningThreshold)??vy):void 0,this._perfMon=(_=this._options)!=null&&_._profName?new _y(this._options._profName):void 0,this._deliveryQueue=(p=this._options)==null?void 0:p.deliveryQueue}dispose(){var r,i,n,_;this._disposed||(this._disposed=!0,((r=this._deliveryQueue)==null?void 0:r.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||n.call(i),(_=this._leakageMon)==null||_.dispose())}get event(){return this._event??(this._event=(r,i,n)=>{var R,o,d,v,y;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let f=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(f);let S=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],x=new wy(`${f}. HINT: Stack shows most frequent listener (${S[1]}-times)`,S[0]);return(((R=this._options)==null?void 0:R.onListenerError)||gc)(x),Ur.None}if(this._disposed)return Ur.None;i&&(r=r.bind(i));let _=new yc(r),p;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(_.stack=my.create(),p=this._leakageMon.check(_.stack,this._size+1)),this._listeners?this._listeners instanceof yc?(this._deliveryQueue??(this._deliveryQueue=new by),this._listeners=[this._listeners,_]):this._listeners.push(_):((d=(o=this._options)==null?void 0:o.onWillAddFirstListener)==null||d.call(o,this),this._listeners=_,(y=(v=this._options)==null?void 0:v.onDidAddFirstListener)==null||y.call(v,this)),this._size++;let L=ir(()=>{p==null||p(),this._removeListener(_)});return n instanceof js?n.add(L):Array.isArray(n)&&n.push(L),L}),this._event}_removeListener(r){var p,L,R,o;if((L=(p=this._options)==null?void 0:p.onWillRemoveListener)==null||L.call(p,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(o=(R=this._options)==null?void 0:R.onDidRemoveLastListener)==null||o.call(R,this),this._size=0;return}let i=this._listeners,n=i.indexOf(r);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[n]=void 0;let _=this._deliveryQueue.current===this;if(this._size*Cy<=i.length){let d=0;for(let v=0;v<i.length;v++)i[v]?i[d++]=i[v]:_&&(this._deliveryQueue.end--,d<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=d}}_deliver(r,i){var _;if(!r)return;let n=((_=this._options)==null?void 0:_.onListenerError)||gc;if(!n){r.value(i);return}try{r.value(i)}catch(p){n(p)}}_deliverQueue(r){let i=r.current._listeners;for(;r.i<r.end;)this._deliver(i[r.i++],r.value);r.reset()}fire(r){var i,n,_,p;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(_=this._perfMon)==null||_.start(this._size),this._listeners)if(this._listeners instanceof yc)this._deliver(this._listeners,r);else{let L=this._deliveryQueue;L.enqueue(this,r,this._listeners.length),this._deliverQueue(L)}(p=this._perfMon)==null||p.stop()}hasListeners(){return this._size>0}},by=class{constructor(){this.i=-1,this.end=0}enqueue(r,i,n){this.i=0,this.end=n,this.current=r,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},sf={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},bn=2,En,Ni=class Ps{constructor(i,n,_){this._document=i,this._config=n,this._unicodeService=_,this._didWarmUp=!1,this._cacheMap=new rf,this._cacheMapCombined=new rf,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ns,this._textureSize=512,this._onAddTextureAtlasCanvas=new ot,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ot,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Up(i,this._config.deviceCellWidth*4+bn*2,this._config.deviceCellHeight+bn*2),this._tmpCtx=Rt(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let i of this.pages)i.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let i=new dy;for(let n=33;n<126;n++)i.enqueue(()=>{if(!this._cacheMap.get(n,0,0,0)){let _=this._drawToCache(n,0,0,0,!1,void 0);this._cacheMap.set(n,0,0,0,_)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let i of this._pages)i.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Ps.maxAtlasPages&&this._pages.length>=Math.max(4,Ps.maxAtlasPages)){let n=this._pages.filter(v=>v.canvas.width*2<=(Ps.maxTextureSize||4096)).sort((v,y)=>y.canvas.width!==v.canvas.width?y.canvas.width-v.canvas.width:y.percentageUsed-v.percentageUsed),_=-1,p=0;for(let v=0;v<n.length;v++)if(n[v].canvas.width!==p)_=v,p=n[v].canvas.width;else if(v-_===3)break;let L=n.slice(_,_+4),R=L.map(v=>v.glyphs[0].texturePage).sort((v,y)=>v>y?1:-1),o=this.pages.length-L.length,d=this._mergePages(L,o);d.version++;for(let v=R.length-1;v>=0;v--)this._deletePage(R[v]);this.pages.push(d),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(d.canvas)}let i=new wc(this._document,this._textureSize);return this._pages.push(i),this._activePages.push(i),this._onAddTextureAtlasCanvas.fire(i.canvas),i}_mergePages(i,n){let _=i[0].canvas.width*2,p=new wc(this._document,_,i);for(let[L,R]of i.entries()){let o=L*R.canvas.width%_,d=Math.floor(L/2)*R.canvas.height;p.ctx.drawImage(R.canvas,o,d);for(let y of R.glyphs)y.texturePage=n,y.sizeClipSpace.x=y.size.x/_,y.sizeClipSpace.y=y.size.y/_,y.texturePosition.x+=o,y.texturePosition.y+=d,y.texturePositionClipSpace.x=y.texturePosition.x/_,y.texturePositionClipSpace.y=y.texturePosition.y/_;this._onRemoveTextureAtlasCanvas.fire(R.canvas);let v=this._activePages.indexOf(R);v!==-1&&this._activePages.splice(v,1)}return p}_deletePage(i){this._pages.splice(i,1);for(let n=i;n<this._pages.length;n++){let _=this._pages[n];for(let p of _.glyphs)p.texturePage--;_.version++}}getRasterizedGlyphCombinedChar(i,n,_,p,L,R){return this._getFromCacheMap(this._cacheMapCombined,i,n,_,p,L,R)}getRasterizedGlyph(i,n,_,p,L,R){return this._getFromCacheMap(this._cacheMap,i,n,_,p,L,R)}_getFromCacheMap(i,n,_,p,L,R,o){return En=i.get(n,_,p,L),En||(En=this._drawToCache(n,_,p,L,R,o),i.set(n,_,p,L,En)),En}_getColorFromAnsiIndex(i){if(i>=this._config.colors.ansi.length)throw new Error("No color found for idx "+i);return this._config.colors.ansi[i]}_getBackgroundColor(i,n,_,p){if(this._config.allowTransparency)return Dr;let L;switch(i){case 16777216:case 33554432:L=this._getColorFromAnsiIndex(n);break;case 50331648:let R=Ns.toColorRGB(n);L=lr.toColor(R[0],R[1],R[2]);break;case 0:default:_?L=Rn.opaque(this._config.colors.foreground):L=this._config.colors.background;break}return this._config.allowTransparency||(L=Rn.opaque(L)),L}_getForegroundColor(i,n,_,p,L,R,o,d,v,y){let f=this._getMinimumContrastColor(i,n,_,p,L,R,o,v,d,y);if(f)return f;let S;switch(L){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&v&&R<8&&(R+=8),S=this._getColorFromAnsiIndex(R);break;case 50331648:let x=Ns.toColorRGB(R);S=lr.toColor(x[0],x[1],x[2]);break;case 0:default:o?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=Rn.opaque(S)),d&&(S=Rn.multiplyOpacity(S,ty)),S}_resolveBackgroundRgba(i,n,_){switch(i){case 16777216:case 33554432:return this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;case 0:default:return _?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(i,n,_,p){switch(i){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&p&&n<8&&(n+=8),this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;case 0:default:return _?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(i,n,_,p,L,R,o,d,v,y){if(this._config.minimumContrastRatio===1||y)return;let f=this._getContrastCache(v),S=f.getColor(i,p);if(S!==void 0)return S||void 0;let x=this._resolveBackgroundRgba(n,_,o),T=this._resolveForegroundRgba(L,R,o,d),w=rs.ensureContrastRatio(x,T,this._config.minimumContrastRatio/(v?2:1));if(!w){f.setColor(i,p,null);return}let c=lr.toColor(w>>24&255,w>>16&255,w>>8&255);return f.setColor(i,p,c),c}_getContrastCache(i){return i?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(i,n,_,p,L,R){let o=typeof i=="number"?String.fromCharCode(i):i;R&&this._tmpCanvas.parentElement!==R&&(this._tmpCanvas.style.display="none",R.append(this._tmpCanvas));let d=Math.min(this._config.deviceCellWidth*Math.max(o.length,2)+bn*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<d&&(this._tmpCanvas.width=d);let v=Math.min(this._config.deviceCellHeight+bn*4,this._textureSize);if(this._tmpCanvas.height<v&&(this._tmpCanvas.height=v),this._tmpCtx.save(),this._workAttributeData.fg=_,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=p,!!this._workAttributeData.isInvisible())return sf;let y=!!this._workAttributeData.isBold(),f=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),x=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),w=!!this._workAttributeData.isStrikethrough(),c=!!this._workAttributeData.isOverline(),h=this._workAttributeData.getFgColor(),l=this._workAttributeData.getFgColorMode(),u=this._workAttributeData.getBgColor(),g=this._workAttributeData.getBgColorMode();if(f){let I=h;h=u,u=I;let P=l;l=g,g=P}let C=this._getBackgroundColor(g,u,f,S);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=C.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let k=y?this._config.fontWeightBold:this._config.fontWeight,D=x?"italic":"";this._tmpCtx.font=`${D} ${k} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Ap;let E=o.length===1&&Jc(o.charCodeAt(0)),N=o.length===1&&q1(o.charCodeAt(0)),V=this._getForegroundColor(n,g,u,_,l,h,f,S,y,Dp(o.charCodeAt(0)));this._tmpCtx.fillStyle=V.css;let q=N?0:bn*2,O=!1;this._config.customGlyphs!==!1&&(O=ny(this._tmpCtx,o,q,q,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let A=!E,U;if(typeof i=="number"?U=this._unicodeService.wcwidth(i):U=this._unicodeService.getStringCellWidth(i),T){this._tmpCtx.save();let I=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),P=I%2===1?.5:0;if(this._tmpCtx.lineWidth=I,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())A=!1,this._tmpCtx.strokeStyle=`rgb(${Ns.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{A=!1;let X=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&X<8&&(X+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(X).css}this._tmpCtx.beginPath();let H=q,J=Math.ceil(q+this._config.deviceCharHeight)-P-(L?I*2:0),se=J+I,le=J+I*2,de=this._workAttributeData.getUnderlineVariantOffset();for(let X=0;X<U;X++){this._tmpCtx.save();let j=H+X*this._config.deviceCellWidth,ne=H+(X+1)*this._config.deviceCellWidth,ee=j+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(j,J),this._tmpCtx.lineTo(ne,J),this._tmpCtx.moveTo(j,le),this._tmpCtx.lineTo(ne,le);break;case 3:let ce=I<=1?le:Math.ceil(q+this._config.deviceCharHeight-I/2)-P,ve=I<=1?J:Math.ceil(q+this._config.deviceCharHeight+I/2)-P,ie=new Path2D;ie.rect(j,J,this._config.deviceCellWidth,le-J),this._tmpCtx.clip(ie),this._tmpCtx.moveTo(j-this._config.deviceCellWidth/2,se),this._tmpCtx.bezierCurveTo(j-this._config.deviceCellWidth/2,ve,j,ve,j,se),this._tmpCtx.bezierCurveTo(j,ce,ee,ce,ee,se),this._tmpCtx.bezierCurveTo(ee,ve,ne,ve,ne,se),this._tmpCtx.bezierCurveTo(ne,ce,ne+this._config.deviceCellWidth/2,ce,ne+this._config.deviceCellWidth/2,se);break;case 4:let pe=de===0?0:de>=I?I*2-de:I-de;de>=I||pe===0?(this._tmpCtx.setLineDash([Math.round(I),Math.round(I)]),this._tmpCtx.moveTo(j+pe,J),this._tmpCtx.lineTo(ne,J)):(this._tmpCtx.setLineDash([Math.round(I),Math.round(I)]),this._tmpCtx.moveTo(j,J),this._tmpCtx.lineTo(j+pe,J),this._tmpCtx.moveTo(j+pe+I,J),this._tmpCtx.lineTo(ne,J)),de=Z1(ne-j,I,de);break;case 5:let Re=.6,Te=.3,ye=ne-j,Je=Math.floor(Re*ye),kt=Math.floor(Te*ye),Ct=ye-Je-kt;this._tmpCtx.setLineDash([Je,kt,Ct]),this._tmpCtx.moveTo(j,J),this._tmpCtx.lineTo(ne,J);break;case 1:default:this._tmpCtx.moveTo(j,J),this._tmpCtx.lineTo(ne,J);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!O&&this._config.fontSize>=12&&!this._config.allowTransparency&&o!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let X=this._tmpCtx.measureText(o);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in X&&X.actualBoundingBoxDescent>0){this._tmpCtx.save();let j=new Path2D;j.rect(H,J-Math.ceil(I/2),this._config.deviceCellWidth*U,le-J+Math.ceil(I/2)),this._tmpCtx.clip(j),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=C.css,this._tmpCtx.strokeText(o,q,q+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(c){let I=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),P=I%2===1?.5:0;this._tmpCtx.lineWidth=I,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+P),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*U,q+P),this._tmpCtx.stroke()}if(O||this._tmpCtx.fillText(o,q,q+this._config.deviceCharHeight),o==="_"&&!this._config.allowTransparency){let I=Sc(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),C,V,A);if(I)for(let P=1;P<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=C.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(o,q,q+this._config.deviceCharHeight-P),I=Sc(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),C,V,A),!!I);P++);}if(w){let I=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),P=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=I,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+Math.floor(this._config.deviceCharHeight/2)-P),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*U,q+Math.floor(this._config.deviceCharHeight/2)-P),this._tmpCtx.stroke()}this._tmpCtx.restore();let z=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),K;if(this._config.allowTransparency?K=Ey(z):K=Sc(z,C,V,A),K)return sf;let Y=this._findGlyphBoundingBox(z,this._workBoundingBox,d,N,O,q),W,B;for(;;){if(this._activePages.length===0){let I=this._createNewPage();W=I,B=I.currentRow,B.height=Y.size.y;break}W=this._activePages[this._activePages.length-1],B=W.currentRow;for(let I of this._activePages)Y.size.y<=I.currentRow.height&&(W=I,B=I.currentRow);for(let I=this._activePages.length-1;I>=0;I--)for(let P of this._activePages[I].fixedRows)P.height<=B.height&&Y.size.y<=P.height&&(W=this._activePages[I],B=P);if(Y.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new wc(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),W=this._overflowSizePage,B=this._overflowSizePage.currentRow,B.x+Y.size.x>=W.canvas.width&&(B.x=0,B.y+=B.height,B.height=0);break}if(B.y+Y.size.y>=W.canvas.height||B.height>Y.size.y+2){let I=!1;if(W.currentRow.y+W.currentRow.height+Y.size.y>=W.canvas.height){let P;for(let H of this._activePages)if(H.currentRow.y+H.currentRow.height+Y.size.y<H.canvas.height){P=H;break}if(P)W=P;else if(Ps.maxAtlasPages&&this._pages.length>=Ps.maxAtlasPages&&B.y+Y.size.y<=W.canvas.height&&B.height>=Y.size.y&&B.x+Y.size.x<=W.canvas.width)I=!0;else{let H=this._createNewPage();W=H,B=H.currentRow,B.height=Y.size.y,I=!0}}I||(W.currentRow.height>0&&W.fixedRows.push(W.currentRow),B={x:0,y:W.currentRow.y+W.currentRow.height,height:Y.size.y},W.fixedRows.push(B),W.currentRow={x:0,y:B.y+B.height,height:0})}if(B.x+Y.size.x<=W.canvas.width)break;B===W.currentRow?(B.x=0,B.y+=B.height,B.height=0):W.fixedRows.splice(W.fixedRows.indexOf(B),1)}return Y.texturePage=this._pages.indexOf(W),Y.texturePosition.x=B.x,Y.texturePosition.y=B.y,Y.texturePositionClipSpace.x=B.x/W.canvas.width,Y.texturePositionClipSpace.y=B.y/W.canvas.height,Y.sizeClipSpace.x/=W.canvas.width,Y.sizeClipSpace.y/=W.canvas.height,B.height=Math.max(B.height,Y.size.y),B.x+=Y.size.x,W.ctx.putImageData(z,Y.texturePosition.x-this._workBoundingBox.left,Y.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,Y.size.x,Y.size.y),W.addGlyph(Y),W.version++,Y}_findGlyphBoundingBox(i,n,_,p,L,R){n.top=0;let o=p?this._config.deviceCellHeight:this._tmpCanvas.height,d=p?this._config.deviceCellWidth:_,v=!1;for(let y=0;y<o;y++){for(let f=0;f<d;f++){let S=y*this._tmpCanvas.width*4+f*4+3;if(i.data[S]!==0){n.top=y,v=!0;break}}if(v)break}n.left=0,v=!1;for(let y=0;y<R+d;y++){for(let f=0;f<o;f++){let S=f*this._tmpCanvas.width*4+y*4+3;if(i.data[S]!==0){n.left=y,v=!0;break}}if(v)break}n.right=d,v=!1;for(let y=R+d-1;y>=R;y--){for(let f=0;f<o;f++){let S=f*this._tmpCanvas.width*4+y*4+3;if(i.data[S]!==0){n.right=y,v=!0;break}}if(v)break}n.bottom=o,v=!1;for(let y=o-1;y>=0;y--){for(let f=0;f<d;f++){let S=y*this._tmpCanvas.width*4+f*4+3;if(i.data[S]!==0){n.bottom=y,v=!0;break}}if(v)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:n.right-n.left+1,y:n.bottom-n.top+1},sizeClipSpace:{x:n.right-n.left+1,y:n.bottom-n.top+1},offset:{x:-n.left+R+(p||L?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-n.top+R+(p||L?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},wc=class{constructor(r,i,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let _ of n)this._glyphs.push(..._.glyphs),this._usedPixels+=_._usedPixels;this.canvas=Up(r,i,i),this.ctx=Rt(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(r){this._glyphs.push(r),this._usedPixels+=r.size.x*r.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Sc(r,i,n,_){let p=i.rgba>>>24,L=i.rgba>>>16&255,R=i.rgba>>>8&255,o=n.rgba>>>24,d=n.rgba>>>16&255,v=n.rgba>>>8&255,y=Math.floor((Math.abs(p-o)+Math.abs(L-d)+Math.abs(R-v))/12),f=!0;for(let S=0;S<r.data.length;S+=4)r.data[S]===p&&r.data[S+1]===L&&r.data[S+2]===R||_&&Math.abs(r.data[S]-p)+Math.abs(r.data[S+1]-L)+Math.abs(r.data[S+2]-R)<y?r.data[S+3]=0:f=!1;return f}function Ey(r){for(let i=0;i<r.data.length;i+=4)if(r.data[i+3]>0)return!1;return!0}function Up(r,i,n){let _=r.createElement("canvas");return _.width=i,_.height=n,_}function ky(r,i,n,_,p,L,R,o){let d={foreground:L.foreground,background:L.background,cursor:Dr,cursorAccent:Dr,selectionForeground:Dr,selectionBackgroundTransparent:Dr,selectionBackgroundOpaque:Dr,selectionInactiveBackgroundTransparent:Dr,selectionInactiveBackgroundOpaque:Dr,overviewRulerBorder:Dr,scrollbarSliderBackground:Dr,scrollbarSliderHoverBackground:Dr,scrollbarSliderActiveBackground:Dr,ansi:L.ansi.slice(),contrastCache:L.contrastCache,halfContrastCache:L.halfContrastCache};return{customGlyphs:p.customGlyphs,devicePixelRatio:R,deviceMaxTextureSize:o,letterSpacing:p.letterSpacing,lineHeight:p.lineHeight,deviceCellWidth:r,deviceCellHeight:i,deviceCharWidth:n,deviceCharHeight:_,fontFamily:p.fontFamily,fontSize:p.fontSize,fontWeight:p.fontWeight,fontWeightBold:p.fontWeightBold,allowTransparency:p.allowTransparency,drawBoldTextInBrightColors:p.drawBoldTextInBrightColors,minimumContrastRatio:p.minimumContrastRatio,colors:d}}function nf(r,i){for(let n=0;n<r.colors.ansi.length;n++)if(r.colors.ansi[n].rgba!==i.colors.ansi[n].rgba)return!1;return r.devicePixelRatio===i.devicePixelRatio&&r.customGlyphs===i.customGlyphs&&r.lineHeight===i.lineHeight&&r.letterSpacing===i.letterSpacing&&r.fontFamily===i.fontFamily&&r.fontSize===i.fontSize&&r.fontWeight===i.fontWeight&&r.fontWeightBold===i.fontWeightBold&&r.allowTransparency===i.allowTransparency&&r.deviceCharWidth===i.deviceCharWidth&&r.deviceCharHeight===i.deviceCharHeight&&r.drawBoldTextInBrightColors===i.drawBoldTextInBrightColors&&r.minimumContrastRatio===i.minimumContrastRatio&&r.colors.foreground.rgba===i.colors.foreground.rgba&&r.colors.background.rgba===i.colors.background.rgba}function Ly(r){return(r&50331648)===16777216||(r&50331648)===33554432}var Br=[];function Wp(r,i,n,_,p,L,R,o,d){let v=ky(_,p,L,R,i,n,o,d);for(let S=0;S<Br.length;S++){let x=Br[S],T=x.ownedBy.indexOf(r);if(T>=0){if(nf(x.config,v))return x.atlas;x.ownedBy.length===1?(x.atlas.dispose(),Br.splice(S,1)):x.ownedBy.splice(T,1);break}}for(let S=0;S<Br.length;S++){let x=Br[S];if(nf(x.config,v))return x.ownedBy.push(r),x.atlas}let y=r._core,f={atlas:new Ni(document,v,y.unicodeService),config:v,ownedBy:[r]};return Br.push(f),f.atlas}function of(r){for(let i=0;i<Br.length;i++){let n=Br[i].ownedBy.indexOf(r);if(n!==-1){Br[i].ownedBy.length===1?(Br[i].atlas.dispose(),Br.splice(i,1)):Br[i].ownedBy.splice(n,1);break}}}var Xo=600,Ry=class{constructor(r,i){this._renderCallback=r,this._coreBrowserService=i,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(r=Xo){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let i=Xo-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,i>0){this._restartInterval(i);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let i=Xo-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(i);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Xo)},r)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function af(r,i,n){let _=new i.ResizeObserver(p=>{let L=p.find(d=>d.target===r);if(!L)return;if(!("devicePixelContentBoxSize"in L)){_==null||_.disconnect(),_=void 0;return}let R=L.devicePixelContentBoxSize[0].inlineSize,o=L.devicePixelContentBoxSize[0].blockSize;R>0&&o>0&&n(R,o)});try{_.observe(r,{box:["device-pixel-content-box"]})}catch{_.disconnect(),_=void 0}return ir(()=>_==null?void 0:_.disconnect())}function Ty(r){return r>65535?(r-=65536,String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):String.fromCharCode(r)}var lf=class Vp extends Ns{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ip,this.combinedData=""}static fromCharData(i){let n=new Vp;return n.setFromCharData(i),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ty(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(i){this.fg=i[0],this.bg=0;let n=!1;if(i[1].length>2)n=!0;else if(i[1].length===2){let _=i[1].charCodeAt(0);if(55296<=_&&_<=56319){let p=i[1].charCodeAt(1);56320<=p&&p<=57343?this.content=(_-55296)*1024+p-56320+65536|i[2]<<22:n=!0}else n=!0}else this.content=i[1].charCodeAt(0)|i[2]<<22;n&&(this.combinedData=i[1],this.content=2097152|i[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Kp=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function qp(r,i,n){let _=Rt(r.createProgram());if(r.attachShader(_,Rt(cf(r,r.VERTEX_SHADER,i))),r.attachShader(_,Rt(cf(r,r.FRAGMENT_SHADER,n))),r.linkProgram(_),r.getProgramParameter(_,r.LINK_STATUS))return _;console.error(r.getProgramInfoLog(_)),r.deleteProgram(_)}function cf(r,i,n){let _=Rt(r.createShader(i));if(r.shaderSource(_,n),r.compileShader(_),r.getShaderParameter(_,r.COMPILE_STATUS))return _;console.error(r.getShaderInfoLog(_)),r.deleteShader(_)}function My(r,i){let n=Math.min(r.length*2,i),_=new Float32Array(n);for(let p=0;p<r.length;p++)_[p]=r[p];return _}var Dy=class{constructor(r){this.texture=r,this.version=-1}},Ay=`#version 300 es
116
+ layout (location = 0) in vec2 a_unitquad;
117
+ layout (location = 1) in vec2 a_cellpos;
118
+ layout (location = 2) in vec2 a_offset;
119
+ layout (location = 3) in vec2 a_size;
120
+ layout (location = 4) in float a_texpage;
121
+ layout (location = 5) in vec2 a_texcoord;
122
+ layout (location = 6) in vec2 a_texsize;
123
+
124
+ uniform mat4 u_projection;
125
+ uniform vec2 u_resolution;
126
+
127
+ out vec2 v_texcoord;
128
+ flat out int v_texpage;
129
+
130
+ void main() {
131
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
132
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
133
+ v_texpage = int(a_texpage);
134
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
135
+ }`;function By(r){let i="";for(let n=1;n<r;n++)i+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
136
+ precision lowp float;
137
+
138
+ in vec2 v_texcoord;
139
+ flat in int v_texpage;
140
+
141
+ uniform sampler2D u_texture[${r}];
142
+
143
+ out vec4 outColor;
144
+
145
+ void main() {
146
+ if (v_texpage == 0) {
147
+ outColor = texture(u_texture[0], v_texcoord);
148
+ } ${i}
149
+ }`}var Ii=11,Ds=Ii*Float32Array.BYTES_PER_ELEMENT,Py=2,yt=0,nt,Cc=0,kn=0,Oy=class extends Ur{constructor(r,i,n,_){super(),this._terminal=r,this._gl=i,this._dimensions=n,this._optionsService=_,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let p=this._gl;Ni.maxAtlasPages===void 0&&(Ni.maxAtlasPages=Math.min(32,Rt(p.getParameter(p.MAX_TEXTURE_IMAGE_UNITS))),Ni.maxTextureSize=Rt(p.getParameter(p.MAX_TEXTURE_SIZE))),this._program=Rt(qp(p,Ay,By(Ni.maxAtlasPages))),this._register(ir(()=>p.deleteProgram(this._program))),this._projectionLocation=Rt(p.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Rt(p.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Rt(p.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=p.createVertexArray(),p.bindVertexArray(this._vertexArrayObject);let L=new Float32Array([0,0,1,0,0,1,1,1]),R=p.createBuffer();this._register(ir(()=>p.deleteBuffer(R))),p.bindBuffer(p.ARRAY_BUFFER,R),p.bufferData(p.ARRAY_BUFFER,L,p.STATIC_DRAW),p.enableVertexAttribArray(0),p.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let o=new Uint8Array([0,1,2,3]),d=p.createBuffer();this._register(ir(()=>p.deleteBuffer(d))),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,d),p.bufferData(p.ELEMENT_ARRAY_BUFFER,o,p.STATIC_DRAW),this._attributesBuffer=Rt(p.createBuffer()),this._register(ir(()=>p.deleteBuffer(this._attributesBuffer))),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.enableVertexAttribArray(2),p.vertexAttribPointer(2,2,p.FLOAT,!1,Ds,0),p.vertexAttribDivisor(2,1),p.enableVertexAttribArray(3),p.vertexAttribPointer(3,2,p.FLOAT,!1,Ds,2*Float32Array.BYTES_PER_ELEMENT),p.vertexAttribDivisor(3,1),p.enableVertexAttribArray(4),p.vertexAttribPointer(4,1,p.FLOAT,!1,Ds,4*Float32Array.BYTES_PER_ELEMENT),p.vertexAttribDivisor(4,1),p.enableVertexAttribArray(5),p.vertexAttribPointer(5,2,p.FLOAT,!1,Ds,5*Float32Array.BYTES_PER_ELEMENT),p.vertexAttribDivisor(5,1),p.enableVertexAttribArray(6),p.vertexAttribPointer(6,2,p.FLOAT,!1,Ds,7*Float32Array.BYTES_PER_ELEMENT),p.vertexAttribDivisor(6,1),p.enableVertexAttribArray(1),p.vertexAttribPointer(1,2,p.FLOAT,!1,Ds,9*Float32Array.BYTES_PER_ELEMENT),p.vertexAttribDivisor(1,1),p.useProgram(this._program);let v=new Int32Array(Ni.maxAtlasPages);for(let y=0;y<Ni.maxAtlasPages;y++)v[y]=y;p.uniform1iv(this._textureLocation,v),p.uniformMatrix4fv(this._projectionLocation,!1,Kp),this._atlasTextures=[];for(let y=0;y<Ni.maxAtlasPages;y++){let f=new Dy(Rt(p.createTexture()));this._register(ir(()=>p.deleteTexture(f.texture))),p.activeTexture(p.TEXTURE0+y),p.bindTexture(p.TEXTURE_2D,f.texture),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,1,1,0,p.RGBA,p.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[y]=f}p.enable(p.BLEND),p.blendFunc(p.SRC_ALPHA,p.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(r,i,n,_,p,L,R,o,d){this._updateCell(this._vertices.attributes,r,i,n,_,p,L,R,o,d)}_updateCell(r,i,n,_,p,L,R,o,d,v){if(yt=(n*this._terminal.cols+i)*Ii,_===0||_===void 0){r.fill(0,yt,yt+Ii-1-Py);return}this._atlas&&(o&&o.length>1?nt=this._atlas.getRasterizedGlyphCombinedChar(o,p,L,R,!1,this._terminal.element):nt=this._atlas.getRasterizedGlyph(_,p,L,R,!1,this._terminal.element),Cc=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),p!==v&&nt.offset.x>Cc?(kn=nt.offset.x-Cc,r[yt]=-(nt.offset.x-kn)+this._dimensions.device.char.left,r[yt+1]=-nt.offset.y+this._dimensions.device.char.top,r[yt+2]=(nt.size.x-kn)/this._dimensions.device.canvas.width,r[yt+3]=nt.size.y/this._dimensions.device.canvas.height,r[yt+4]=nt.texturePage,r[yt+5]=nt.texturePositionClipSpace.x+kn/this._atlas.pages[nt.texturePage].canvas.width,r[yt+6]=nt.texturePositionClipSpace.y,r[yt+7]=nt.sizeClipSpace.x-kn/this._atlas.pages[nt.texturePage].canvas.width,r[yt+8]=nt.sizeClipSpace.y):(r[yt]=-nt.offset.x+this._dimensions.device.char.left,r[yt+1]=-nt.offset.y+this._dimensions.device.char.top,r[yt+2]=nt.size.x/this._dimensions.device.canvas.width,r[yt+3]=nt.size.y/this._dimensions.device.canvas.height,r[yt+4]=nt.texturePage,r[yt+5]=nt.texturePositionClipSpace.x,r[yt+6]=nt.texturePositionClipSpace.y,r[yt+7]=nt.sizeClipSpace.x,r[yt+8]=nt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&J1(_,d,nt.size.x,this._dimensions.device.cell.width)&&(r[yt+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let r=this._terminal,i=r.cols*r.rows*Ii;this._vertices.count!==i?this._vertices.attributes=new Float32Array(i):this._vertices.attributes.fill(0);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count!==i?this._vertices.attributesBuffers[n]=new Float32Array(i):this._vertices.attributesBuffers[n].fill(0);this._vertices.count=i,n=0;for(let _=0;_<r.rows;_++)for(let p=0;p<r.cols;p++)this._vertices.attributes[n+9]=p/r.cols,this._vertices.attributes[n+10]=_/r.rows,n+=Ii}handleResize(){let r=this._gl;r.useProgram(this._program),r.viewport(0,0,r.canvas.width,r.canvas.height),r.uniform2f(this._resolutionLocation,r.canvas.width,r.canvas.height),this.clear()}render(r){if(!this._atlas)return;let i=this._gl;i.useProgram(this._program),i.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let n=this._vertices.attributesBuffers[this._activeBuffer],_=0;for(let p=0;p<r.lineLengths.length;p++){let L=p*this._terminal.cols*Ii,R=this._vertices.attributes.subarray(L,L+r.lineLengths[p]*Ii);n.set(R,_),_+=R.length}i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.bufferData(i.ARRAY_BUFFER,n.subarray(0,_),i.STREAM_DRAW);for(let p=0;p<this._atlas.pages.length;p++)this._atlas.pages[p].version!==this._atlasTextures[p].version&&this._bindAtlasPageTexture(i,this._atlas,p);i.drawElementsInstanced(i.TRIANGLE_STRIP,4,i.UNSIGNED_BYTE,0,_/Ii)}setAtlas(r){this._atlas=r;for(let i of this._atlasTextures)i.version=-1}_bindAtlasPageTexture(r,i,n){r.activeTexture(r.TEXTURE0+n),r.bindTexture(r.TEXTURE_2D,this._atlasTextures[n].texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i.pages[n].canvas),r.generateMipmap(r.TEXTURE_2D),this._atlasTextures[n].version=i.pages[n].version}setDimensions(r){this._dimensions=r}},Ny=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(r,i,n,_=!1){if(this.selectionStart=i,this.selectionEnd=n,!i||!n||i[0]===n[0]&&i[1]===n[1]){this.clear();return}let p=r.buffers.active.ydisp,L=i[1]-p,R=n[1]-p,o=Math.max(L,0),d=Math.min(R,r.rows-1);if(o>=r.rows||d<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=L,this.viewportEndRow=R,this.viewportCappedStartRow=o,this.viewportCappedEndRow=d,this.startCol=i[0],this.endCol=n[0]}isCellSelected(r,i,n){return this.hasSelection?(n-=r.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&n>=this.viewportCappedStartRow&&i<this.endCol&&n<=this.viewportCappedEndRow:i<this.startCol&&n>=this.viewportCappedStartRow&&i>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol):!1}};function Iy(){return new Ny}var ha=4,ra=1,ia=2,xc=3,jy=2147483648,Fy=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Iy()}resize(r,i){let n=r*i*ha;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(i))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Hy=`#version 300 es
150
+ layout (location = 0) in vec2 a_position;
151
+ layout (location = 1) in vec2 a_size;
152
+ layout (location = 2) in vec4 a_color;
153
+ layout (location = 3) in vec2 a_unitquad;
154
+
155
+ uniform mat4 u_projection;
156
+
157
+ out vec4 v_color;
158
+
159
+ void main() {
160
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
161
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
162
+ v_color = a_color;
163
+ }`,$y=`#version 300 es
164
+ precision lowp float;
165
+
166
+ in vec4 v_color;
167
+
168
+ out vec4 outColor;
169
+
170
+ void main() {
171
+ outColor = v_color;
172
+ }`,di=8,bc=di*Float32Array.BYTES_PER_ELEMENT,zy=20*di,hf=class{constructor(){this.attributes=new Float32Array(zy),this.count=0}},ui=0,uf=0,df=0,ff=0,pf=0,_f=0,vf=0,Uy=class extends Ur{constructor(r,i,n,_){super(),this._terminal=r,this._gl=i,this._dimensions=n,this._themeService=_,this._vertices=new hf,this._verticesCursor=new hf;let p=this._gl;this._program=Rt(qp(p,Hy,$y)),this._register(ir(()=>p.deleteProgram(this._program))),this._projectionLocation=Rt(p.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=p.createVertexArray(),p.bindVertexArray(this._vertexArrayObject);let L=new Float32Array([0,0,1,0,0,1,1,1]),R=p.createBuffer();this._register(ir(()=>p.deleteBuffer(R))),p.bindBuffer(p.ARRAY_BUFFER,R),p.bufferData(p.ARRAY_BUFFER,L,p.STATIC_DRAW),p.enableVertexAttribArray(3),p.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let o=new Uint8Array([0,1,2,3]),d=p.createBuffer();this._register(ir(()=>p.deleteBuffer(d))),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,d),p.bufferData(p.ELEMENT_ARRAY_BUFFER,o,p.STATIC_DRAW),this._attributesBuffer=Rt(p.createBuffer()),this._register(ir(()=>p.deleteBuffer(this._attributesBuffer))),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.enableVertexAttribArray(0),p.vertexAttribPointer(0,2,p.FLOAT,!1,bc,0),p.vertexAttribDivisor(0,1),p.enableVertexAttribArray(1),p.vertexAttribPointer(1,2,p.FLOAT,!1,bc,2*Float32Array.BYTES_PER_ELEMENT),p.vertexAttribDivisor(1,1),p.enableVertexAttribArray(2),p.vertexAttribPointer(2,4,p.FLOAT,!1,bc,4*Float32Array.BYTES_PER_ELEMENT),p.vertexAttribDivisor(2,1),this._updateCachedColors(_.colors),this._register(this._themeService.onChangeColors(v=>{this._updateCachedColors(v),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(r){let i=this._gl;i.useProgram(this._program),i.bindVertexArray(this._vertexArrayObject),i.uniformMatrix4fv(this._projectionLocation,!1,Kp),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.bufferData(i.ARRAY_BUFFER,r.attributes,i.DYNAMIC_DRAW),i.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,i.UNSIGNED_BYTE,0,r.count)}handleResize(){this._updateViewportRectangle()}setDimensions(r){this._dimensions=r}_updateCachedColors(r){this._bgFloat=this._colorToFloat32Array(r.background),this._cursorFloat=this._colorToFloat32Array(r.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(r){let i=this._terminal,n=this._vertices,_=1,p,L,R,o,d,v,y,f,S,x,T;for(p=0;p<i.rows;p++){for(R=-1,o=0,d=0,v=!1,L=0;L<i.cols;L++)y=(p*i.cols+L)*ha,f=r.cells[y+ra],S=r.cells[y+ia],x=!!(S&67108864),(f!==o||S!==d&&(v||x))&&((o!==0||v&&d!==0)&&(T=_++*di,this._updateRectangle(n,T,d,o,R,L,p)),R=L,o=f,d=S,v=x);(o!==0||v&&d!==0)&&(T=_++*di,this._updateRectangle(n,T,d,o,R,i.cols,p))}n.count=_}updateCursor(r){let i=this._verticesCursor,n=r.cursor;if(!n||n.style==="block"){i.count=0;return}let _,p=0;(n.style==="bar"||n.style==="outline")&&(_=p++*di,this._addRectangleFloat(i.attributes,_,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(_=p++*di,this._addRectangleFloat(i.attributes,_,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(_=p++*di,this._addRectangleFloat(i.attributes,_,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),_=p++*di,this._addRectangleFloat(i.attributes,_,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),i.count=p}_updateRectangle(r,i,n,_,p,L,R){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:ui=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:ui=(n&16777215)<<8;break;case 0:default:ui=this._themeService.colors.foreground.rgba}else switch(_&50331648){case 16777216:case 33554432:ui=this._themeService.colors.ansi[_&255].rgba;break;case 50331648:ui=(_&16777215)<<8;break;case 0:default:ui=this._themeService.colors.background.rgba}r.attributes.length<i+4&&(r.attributes=My(r.attributes,this._terminal.rows*this._terminal.cols*di)),uf=p*this._dimensions.device.cell.width,df=R*this._dimensions.device.cell.height,ff=(ui>>24&255)/255,pf=(ui>>16&255)/255,_f=(ui>>8&255)/255,vf=1,this._addRectangle(r.attributes,i,uf,df,(L-p)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,ff,pf,_f,vf)}_addRectangle(r,i,n,_,p,L,R,o,d,v){r[i]=n/this._dimensions.device.canvas.width,r[i+1]=_/this._dimensions.device.canvas.height,r[i+2]=p/this._dimensions.device.canvas.width,r[i+3]=L/this._dimensions.device.canvas.height,r[i+4]=R,r[i+5]=o,r[i+6]=d,r[i+7]=v}_addRectangleFloat(r,i,n,_,p,L,R){r[i]=n/this._dimensions.device.canvas.width,r[i+1]=_/this._dimensions.device.canvas.height,r[i+2]=p/this._dimensions.device.canvas.width,r[i+3]=L/this._dimensions.device.canvas.height,r[i+4]=R[0],r[i+5]=R[1],r[i+6]=R[2],r[i+7]=R[3]}_colorToFloat32Array(r){return new Float32Array([(r.rgba>>24&255)/255,(r.rgba>>16&255)/255,(r.rgba>>8&255)/255,(r.rgba&255)/255])}},Wy=class extends Ur{constructor(r,i,n,_,p,L,R,o){super(),this._container=i,this._alpha=p,this._coreBrowserService=L,this._optionsService=R,this._themeService=o,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=_.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(d=>{this._refreshCharAtlas(r,d),this.reset(r)})),this._register(ir(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Rt(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(r){}handleFocus(r){}handleCursorMove(r){}handleGridChanged(r,i,n){}handleSelectionChanged(r,i,n,_=!1){}_setTransparency(r,i){if(i===this._alpha)return;let n=this._canvas;this._alpha=i,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(r,this._themeService.colors),this.handleGridChanged(r,0,r.rows-1)}_refreshCharAtlas(r,i){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Wp(r,this._optionsService.rawOptions,i,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(r,i){this._deviceCellWidth=i.device.cell.width,this._deviceCellHeight=i.device.cell.height,this._deviceCharWidth=i.device.char.width,this._deviceCharHeight=i.device.char.height,this._deviceCharLeft=i.device.char.left,this._deviceCharTop=i.device.char.top,this._canvas.width=i.device.canvas.width,this._canvas.height=i.device.canvas.height,this._canvas.style.width=`${i.css.canvas.width}px`,this._canvas.style.height=`${i.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(r,this._themeService.colors)}_fillBottomLineAtCells(r,i,n=1){this._ctx.fillRect(r*this._deviceCellWidth,(i+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(r,i,n,_){this._alpha?this._ctx.clearRect(r*this._deviceCellWidth,i*this._deviceCellHeight,n*this._deviceCellWidth,_*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(r*this._deviceCellWidth,i*this._deviceCellHeight,n*this._deviceCellWidth,_*this._deviceCellHeight))}_fillCharTrueColor(r,i,n,_){this._ctx.font=this._getFont(r,!1,!1),this._ctx.textBaseline=Ap,this._clipCell(n,_,i.getWidth()),this._ctx.fillText(i.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,_*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(r,i,n){this._ctx.beginPath(),this._ctx.rect(r*this._deviceCellWidth,i*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(r,i,n){let _=i?r.options.fontWeightBold:r.options.fontWeight;return`${n?"italic":""} ${_} ${r.options.fontSize*this._coreBrowserService.dpr}px ${r.options.fontFamily}`}},Vy=class extends Wy{constructor(r,i,n,_,p,L,R){super(n,r,"link",i,!0,p,L,R),this._register(_.onShowLinkUnderline(o=>this._handleShowLinkUnderline(o))),this._register(_.onHideLinkUnderline(o=>this._handleHideLinkUnderline(o)))}resize(r,i){super.resize(r,i),this._state=void 0}reset(r){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let r=this._state.y2-this._state.y1-1;r>0&&this._clearCells(0,this._state.y1+1,this._state.cols,r),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(r){if(r.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:r.fg!==void 0&&Ly(r.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[r.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,r.y1===r.y2)this._fillBottomLineAtCells(r.x1,r.y1,r.x2-r.x1);else{this._fillBottomLineAtCells(r.x1,r.y1,r.cols-r.x1);for(let i=r.y1+1;i<r.y2;i++)this._fillBottomLineAtCells(0,i,r.cols);this._fillBottomLineAtCells(0,r.y2,r.x2)}this._state=r}_handleHideLinkUnderline(r){this._clearCurrentLink()}},es=typeof window=="object"?window:globalThis,Vc=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ot,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ot,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(i){return this.mapWindowIdToZoomLevel.get(this.getWindowId(i))??0}setZoomLevel(i,n){if(this.getZoomLevel(n)===i)return;let _=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(_,i),this._onDidChangeZoomLevel.fire(_)}getZoomFactor(i){return this.mapWindowIdToZoomFactor.get(this.getWindowId(i))??1}setZoomFactor(i,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),i)}setFullscreen(i,n){if(this.isFullscreen(n)===i)return;let _=this.getWindowId(n);this.mapWindowIdToFullScreen.set(_,i),this._onDidChangeFullscreen.fire(_)}isFullscreen(i){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(i))}getWindowId(i){return i.vscodeWindowId}};Vc.INSTANCE=new Vc;var Gp=Vc;function Ky(r,i,n){typeof i=="string"&&(i=r.matchMedia(i)),i.addEventListener("change",n)}Gp.INSTANCE.onDidChangeZoomLevel;Gp.INSTANCE.onDidChangeFullscreen;var Fs=typeof navigator=="object"?navigator.userAgent:"";Fs.indexOf("Firefox")>=0;Fs.indexOf("AppleWebKit")>=0;var qy=Fs.indexOf("Chrome")>=0;!qy&&Fs.indexOf("Safari")>=0;Fs.indexOf("Electron/")>=0;Fs.indexOf("Android")>=0;var Ec=!1;if(typeof es.matchMedia=="function"){let r=es.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=es.matchMedia("(display-mode: fullscreen)");Ec=r.matches,Ky(es,r,({matches:n})=>{Ec&&i.matches||(Ec=n)})}var Is="en",kc=!1,Yp=!1,Jo,sa=Is,gf=Is,Gy,zr,is=globalThis,Yt,Bf;typeof is.vscode<"u"&&typeof is.vscode.process<"u"?Yt=is.vscode.process:typeof process<"u"&&typeof((Bf=process==null?void 0:process.versions)==null?void 0:Bf.node)=="string"&&(Yt=process);var Pf,Yy=typeof((Pf=Yt==null?void 0:Yt.versions)==null?void 0:Pf.electron)=="string",Xy=Yy&&(Yt==null?void 0:Yt.type)==="renderer",Of;if(typeof Yt=="object"){Yt.platform,Yt.platform,kc=Yt.platform==="linux",kc&&Yt.env.SNAP&&Yt.env.SNAP_REVISION,Yt.env.CI||Yt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Jo=Is,sa=Is;let r=Yt.env.VSCODE_NLS_CONFIG;if(r)try{let i=JSON.parse(r);Jo=i.userLocale,gf=i.osLocale,sa=i.resolvedLanguage||Is,Gy=(Of=i.languagePack)==null?void 0:Of.translationsConfigFile}catch{}Yp=!0}else typeof navigator=="object"&&!Xy?(zr=navigator.userAgent,zr.indexOf("Windows")>=0,zr.indexOf("Macintosh")>=0,(zr.indexOf("Macintosh")>=0||zr.indexOf("iPad")>=0||zr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,kc=zr.indexOf("Linux")>=0,(zr==null?void 0:zr.indexOf("Mobi"))>=0,sa=globalThis._VSCODE_NLS_LANGUAGE||Is,Jo=navigator.language.toLowerCase(),gf=Jo):console.error("Unable to resolve platform.");var mf=Yp,Jr=zr,Pi=sa,Jy;(r=>{function i(){return Pi}r.value=i;function n(){return Pi.length===2?Pi==="en":Pi.length>=3?Pi[0]==="e"&&Pi[1]==="n"&&Pi[2]==="-":!1}r.isDefaultVariant=n;function _(){return Pi==="en"}r.isDefault=_})(Jy||(Jy={}));var Qy=typeof is.postMessage=="function"&&!is.importScripts;(()=>{if(Qy){let r=[];is.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let _=0,p=r.length;_<p;_++){let L=r[_];if(L.id===n.data.vscodeScheduleAsyncWork){r.splice(_,1),L.callback();return}}});let i=0;return n=>{let _=++i;r.push({id:_,callback:n}),is.postMessage({vscodeScheduleAsyncWork:_},"*")}}return r=>setTimeout(r)})();var Zy=!!(Jr&&Jr.indexOf("Chrome")>=0);Jr&&Jr.indexOf("Firefox")>=0;!Zy&&Jr&&Jr.indexOf("Safari")>=0;Jr&&Jr.indexOf("Edg/")>=0;Jr&&Jr.indexOf("Android")>=0;var As=typeof navigator=="object"?navigator:{};mf||document.queryCommandSupported&&document.queryCommandSupported("copy")||As&&As.clipboard&&As.clipboard.writeText,mf||As&&As.clipboard&&As.clipboard.readText;var Qc=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(r,i){this._keyCodeToStr[r]=i,this._strToKeyCode[i.toLowerCase()]=r}keyCodeToStr(r){return this._keyCodeToStr[r]}strToKeyCode(r){return this._strToKeyCode[r.toLowerCase()]||0}},Lc=new Qc,yf=new Qc,wf=new Qc;new Array(230);var ew;(r=>{function i(o){return Lc.keyCodeToStr(o)}r.toString=i;function n(o){return Lc.strToKeyCode(o)}r.fromString=n;function _(o){return yf.keyCodeToStr(o)}r.toUserSettingsUS=_;function p(o){return wf.keyCodeToStr(o)}r.toUserSettingsGeneral=p;function L(o){return yf.strToKeyCode(o)||wf.strToKeyCode(o)}r.fromUserSettings=L;function R(o){if(o>=98&&o<=113)return null;switch(o){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Lc.keyCodeToStr(o)}r.toElectronAccelerator=R})(ew||(ew={}));var Xp=Object.freeze(function(r,i){let n=setTimeout(r.bind(i),0);return{dispose(){clearTimeout(n)}}}),tw;(r=>{function i(n){return n===r.None||n===r.Cancelled||n instanceof rw?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}r.isCancellationToken=i,r.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:fi.None}),r.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Xp})})(tw||(tw={}));var rw=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?Xp:(this._emitter||(this._emitter=new ot),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},iw;(r=>{async function i(_){let p,L=await Promise.all(_.map(R=>R.then(o=>o,o=>{p||(p=o)})));if(typeof p<"u")throw p;return L}r.settled=i;function n(_){return new Promise(async(p,L)=>{try{await _(p,L)}catch(R){L(R)}})}r.withAsyncBody=n})(iw||(iw={}));var Sf=class Ar{static fromArray(i){return new Ar(n=>{n.emitMany(i)})}static fromPromise(i){return new Ar(async n=>{n.emitMany(await i)})}static fromPromises(i){return new Ar(async n=>{await Promise.all(i.map(async _=>n.emitOne(await _)))})}static merge(i){return new Ar(async n=>{await Promise.all(i.map(async _=>{for await(let p of _)n.emitOne(p)}))})}constructor(i,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ot,queueMicrotask(async()=>{let _={emitOne:p=>this.emitOne(p),emitMany:p=>this.emitMany(p),reject:p=>this.reject(p)};try{await Promise.resolve(i(_)),this.resolve()}catch(p){this.reject(p)}finally{_.emitOne=void 0,_.emitMany=void 0,_.reject=void 0}})}[Symbol.asyncIterator](){let i=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(i<this._results.length)return{done:!1,value:this._results[i++]};if(this._state===1)return{done:!0,value:void 0};await fi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(i,n){return new Ar(async _=>{for await(let p of i)_.emitOne(n(p))})}map(i){return Ar.map(this,i)}static filter(i,n){return new Ar(async _=>{for await(let p of i)n(p)&&_.emitOne(p)})}filter(i){return Ar.filter(this,i)}static coalesce(i){return Ar.filter(i,n=>!!n)}coalesce(){return Ar.coalesce(this)}static async toPromise(i){let n=[];for await(let _ of i)n.push(_);return n}toPromise(){return Ar.toPromise(this)}emitOne(i){this._state===0&&(this._results.push(i),this._onStateChanged.fire())}emitMany(i){this._state===0&&(this._results=this._results.concat(i),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(i){this._state===0&&(this._state=2,this._error=i,this._onStateChanged.fire())}};Sf.EMPTY=Sf.fromArray([]);var{getWindow:sw}=(function(){let r=new Map,i={window:es,disposables:new js};r.set(es.vscodeWindowId,i);let n=new ot,_=new ot,p=new ot;function L(R,o){return(typeof R=="number"?r.get(R):void 0)??(o?i:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:p.event,onDidUnregisterWindow:_.event,registerWindow(R){if(r.has(R.vscodeWindowId))return Ur.None;let o=new js,d={window:R,disposables:o.add(new js)};return r.set(R.vscodeWindowId,d),o.add(ir(()=>{r.delete(R.vscodeWindowId),_.fire(R)})),o.add(Kc(R,ow.BEFORE_UNLOAD,()=>{p.fire(R)})),n.fire(d),o},getWindows(){return r.values()},getWindowsCount(){return r.size},getWindowId(R){return R.vscodeWindowId},hasWindow(R){return r.has(R)},getWindowById:L,getWindow(R){var v;let o=R;if((v=o==null?void 0:o.ownerDocument)!=null&&v.defaultView)return o.ownerDocument.defaultView.window;let d=R;return d!=null&&d.view?d.view.window:es},getDocument(R){return sw(R).document}}})(),nw=class{constructor(r,i,n,_){this._node=r,this._type=i,this._handler=n,this._options=_||!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 Kc(r,i,n,_){return new nw(r,i,n,_)}var ow={BEFORE_UNLOAD:"beforeunload"},aw=class extends Ur{constructor(r,i,n,_,p,L,R,o,d){super(),this._terminal=r,this._characterJoinerService=i,this._charSizeService=n,this._coreBrowserService=_,this._coreService=p,this._decorationService=L,this._optionsService=R,this._themeService=o,this._cursorBlinkStateManager=new xn,this._charAtlasDisposable=this._register(new xn),this._observerDisposable=this._register(new xn),this._model=new Fy,this._workCell=new lf,this._workCell2=new lf,this._rectangleRenderer=this._register(new xn),this._glyphRenderer=this._register(new xn),this._onChangeTextureAtlas=this._register(new ot),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ot),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ot),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ot),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ot),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let v={antialias:!1,depth:!1,preserveDrawingBuffer:d};if(this._gl=this._canvas.getContext("webgl2",v),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new ey(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Vy(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,R,this._themeService)],this.dimensions=Q1(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(R.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Kc(this._canvas,"webglcontextlost",y=>{console.log("webglcontextlost event received"),y.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(y)},3e3)})),this._register(Kc(this._canvas,"webglcontextrestored",y=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,of(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=af(this._canvas,this._coreBrowserService.window,(y,f)=>this._setCanvasDevicePixelDimensions(y,f)),this._register(this._coreBrowserService.onWindowChange(y=>{this._observerDisposable.value=af(this._canvas,y,(f,S)=>this._setCanvasDevicePixelDimensions(f,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ir(()=>{var y;for(let f of this._renderLayers)f.dispose();(y=this._canvas.parentElement)==null||y.removeChild(this._canvas),of(this._terminal)}))}get textureAtlas(){var r;return(r=this._charAtlas)==null?void 0:r.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(r,i){var n,_,p,L;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let R of this._renderLayers)R.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(n=this._rectangleRenderer.value)==null||n.setDimensions(this.dimensions),(_=this._rectangleRenderer.value)==null||_.handleResize(),(p=this._glyphRenderer.value)==null||p.setDimensions(this.dimensions),(L=this._glyphRenderer.value)==null||L.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var r;for(let i of this._renderLayers)i.handleBlur(this._terminal);(r=this._cursorBlinkStateManager.value)==null||r.pause(),this._requestRedrawViewport()}handleFocus(){var r;for(let i of this._renderLayers)i.handleFocus(this._terminal);(r=this._cursorBlinkStateManager.value)==null||r.resume(),this._requestRedrawViewport()}handleSelectionChanged(r,i,n){for(let _ of this._renderLayers)_.handleSelectionChanged(this._terminal,r,i,n);this._model.selection.update(this._core,r,i,n),this._requestRedrawViewport()}handleCursorMove(){var r;for(let i of this._renderLayers)i.handleCursorMove(this._terminal);(r=this._cursorBlinkStateManager.value)==null||r.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Uy(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Oy(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var i;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let r=Wp(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==r&&(this._onChangeTextureAtlas.fire(r.pages[0].canvas),this._charAtlasDisposable.value=Lp(fi.forward(r.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),fi.forward(r.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=r,this._charAtlas.warmUp(),(i=this._glyphRenderer.value)==null||i.setAtlas(this._charAtlas)}_clearModel(r){var i;this._model.clear(),r&&((i=this._glyphRenderer.value)==null||i.clear())}clearTextureAtlas(){var r;(r=this._charAtlas)==null||r.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var r;this._clearModel(!0);for(let i of this._renderLayers)i.reset(this._terminal);(r=this._cursorBlinkStateManager.value)==null||r.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(r,i){var n;if(!this._isAttached)if((n=this._core.screenElement)!=null&&n.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let _ of this._renderLayers)_.handleGridChanged(this._terminal,r,i);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(r,i),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Ry(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(r,i){let n=this._core,_=this._workCell,p,L,R,o,d,v,y=0,f=!0,S,x,T,w,c,h,l,u,g;r=Cf(r,n.rows-1,0),i=Cf(i,n.rows-1,0);let C=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??"block",k=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,D=k-n.buffer.ydisp,E=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),N=-1,V=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let q=!1;for(L=r;L<=i;L++)for(R=L+n.buffer.ydisp,o=n.buffer.lines.get(R),this._model.lineLengths[L]=0,T=k===R,y=0,d=this._characterJoinerService.getJoinedCharacters(R),u=0;u<n.cols;u++){if(p=this._cellColorResolver.result.bg,o.loadCell(u,_),u===0&&(p=this._cellColorResolver.result.bg),v=!1,f=u>=y,S=u,d.length>0&&u===d[0][0]&&f){x=d.shift();let O=this._model.selection.isCellSelected(this._terminal,x[0],R);for(l=x[0]+1;l<x[1];l++)f&&(f=O===this._model.selection.isCellSelected(this._terminal,l,R));f&&(f=!T||E<x[0]||E>=x[1]),f?(v=!0,_=new lw(_,o.translateToString(!0,x[0],x[1]),x[1]-x[0]),S=x[1]-1):y=x[1]}if(w=_.getChars(),c=_.getCode(),l=(L*n.cols+u)*ha,this._cellColorResolver.resolve(_,u,R,this.dimensions.device.cell.width),V&&R===k&&(u===E&&(this._model.cursor={x:E,y:D,width:_.getWidth(),style:this._coreBrowserService.isFocused?C:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},N=E+_.getWidth()-1),u>=E&&u<=N&&(this._coreBrowserService.isFocused&&C==="block"||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),c!==0&&(this._model.lineLengths[L]=u+1),!(this._model.cells[l]===c&&this._model.cells[l+ra]===this._cellColorResolver.result.bg&&this._model.cells[l+ia]===this._cellColorResolver.result.fg&&this._model.cells[l+xc]===this._cellColorResolver.result.ext)&&(q=!0,w.length>1&&(c|=jy),this._model.cells[l]=c,this._model.cells[l+ra]=this._cellColorResolver.result.bg,this._model.cells[l+ia]=this._cellColorResolver.result.fg,this._model.cells[l+xc]=this._cellColorResolver.result.ext,h=_.getWidth(),this._glyphRenderer.value.updateCell(u,L,c,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,w,h,p),v)){for(_=this._workCell,u++;u<=S;u++)g=(L*n.cols+u)*ha,this._glyphRenderer.value.updateCell(u,L,0,0,0,0,V1,0,0),this._model.cells[g]=0,this._model.cells[g+ra]=this._cellColorResolver.result.bg,this._model.cells[g+ia]=this._cellColorResolver.result.fg,this._model.cells[g+xc]=this._cellColorResolver.result.ext;u--}}q&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(r,i){this._canvas.width===r&&this._canvas.height===i||(this._canvas.width=r,this._canvas.height=i,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let r=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:r,end:r})}},lw=class extends Ns{constructor(r,i,n){super(),this.content=0,this.combinedData="",this.fg=r.fg,this.bg=r.bg,this.combinedData=i,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(r){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Cf(r,i,n=0){return Math.max(Math.min(r,i),n)}var xf="di$target",bf="di$dependencies",Rc=new Map;function Qr(r){if(Rc.has(r))return Rc.get(r);let i=function(n,_,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");cw(i,n,p)};return i._id=r,Rc.set(r,i),i}function cw(r,i,n){i[xf]===i?i[bf].push({id:r,index:n}):(i[bf]=[{id:r,index:n}],i[xf]=i)}Qr("BufferService");Qr("CoreMouseService");Qr("CoreService");Qr("CharsetService");Qr("InstantiationService");Qr("LogService");var hw=Qr("OptionsService");Qr("OscLinkService");Qr("UnicodeService");Qr("DecorationService");var uw={trace:0,debug:1,info:2,warn:3,error:4,off:5},dw="xterm.js: ",Ef=class extends Ur{constructor(r){super(),this._optionsService=r,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=uw[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(r){for(let i=0;i<r.length;i++)typeof r[i]=="function"&&(r[i]=r[i]())}_log(r,i,n){this._evalLazyOptionalParams(n),r.call(console,(this._optionsService.options.logger?"":dw)+i,...n)}trace(r,...i){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,r,i)}debug(r,...i){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,r,i)}info(r,...i){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,r,i)}warn(r,...i){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,r,i)}error(r,...i){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,r,i)}};Ef=B1([P1(0,hw)],Ef);var fw=class extends Ur{constructor(r){if(Mp&&W1()<16){let i={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",i))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=r,this._onChangeTextureAtlas=this._register(new ot),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ot),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ot),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ot),this.onContextLoss=this._onContextLoss.event}activate(r){let i=r._core;if(!r.element){this._register(i.onWillOpen(()=>this.activate(r)));return}this._terminal=r;let n=i.coreService,_=i.optionsService,p=i,L=p._renderService,R=p._characterJoinerService,o=p._charSizeService,d=p._coreBrowserService,v=p._decorationService;p._logService;let y=p._themeService;this._renderer=this._register(new aw(r,R,o,d,n,v,_,y,this._preserveDrawingBuffer)),this._register(fi.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(fi.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(fi.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(fi.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),L.setRenderer(this._renderer),this._register(ir(()=>{if(this._terminal._core._store._isDisposed)return;let f=this._terminal._core._renderService;f.setRenderer(this._terminal._core._createRenderer()),f.handleResize(r.cols,r.rows)}))}get textureAtlas(){var r;return(r=this._renderer)==null?void 0:r.textureAtlas}clearTextureAtlas(){var r;(r=this._renderer)==null||r.clearTextureAtlas()}};function Tc(r){return(r*257).toString(16).padStart(4,"0")}function Mc(r){const i=parseInt(r.slice(1,3),16),n=parseInt(r.slice(3,5),16),_=parseInt(r.slice(5,7),16);return`${Tc(i)}/${Tc(n)}/${Tc(_)}`}function pw(r,i){r.parser.registerCsiHandler({final:"n"},n=>{const _=n.length>0?n[0]:0;if(_===6){const p=r.buffer.active,L=p.cursorY+1,R=p.cursorX+1;return i(`\x1B[${L};${R}R`),!0}else if(_===5)return i("\x1B[0n"),!0;return!1}),r.parser.registerCsiHandler({final:"c"},()=>(i("\x1B[?62;1;6;22c"),!0)),r.parser.registerCsiHandler({prefix:">",final:"c"},()=>(i("\x1B[>1;500;0c"),!0)),r.parser.registerCsiHandler({prefix:"?",final:"p",intermediates:"$"},n=>{const _=n[0]||0,p=r.modes;let L=0;return _===1?L=p.applicationCursorKeysMode?1:2:_===25?L=1:_===1e3?L=p.mouseTrackingMode==="x10"?1:2:_===1002?L=p.mouseTrackingMode==="drag"?1:2:_===1003?L=p.mouseTrackingMode==="any"?1:2:_===1004?L=p.sendFocusMode?1:2:_===1006?L=p.mouseTrackingMode!=="none"?1:2:_===1049?L=r.buffer.active.type==="alternate"?1:2:_===2004?L=p.bracketedPasteMode?1:2:_===2026&&(L=2),i(`\x1B[?${_};${L}$y`),!0}),r.parser.registerOscHandler(10,n=>n==="?"?(i(`\x1B]10;rgb:${Mc(Wf)}\x07`),!0):!1),r.parser.registerOscHandler(11,n=>n==="?"?(i(`\x1B]11;rgb:${Mc(Bc)}\x07`),!0):!1),r.parser.registerOscHandler(12,n=>n==="?"?(i("\x1B]12;rgb:ffff/ffff/ffff\x07"),!0):!1),r.parser.registerOscHandler(4,n=>{const _=n.match(/^(\d+);?\?$/);if(_){const p=parseInt(_[1]),L=p>=0&&p<Pt.length?Pt[p]:Pt[0];return i(`\x1B]4;${p};rgb:${Mc(L)}\x07`),!0}return!1}),r.parser.registerOscHandler(52,n=>!!n.includes("?")),r.parser.registerCsiHandler({prefix:">",final:"q"},()=>(i("\x1BP>|xterm.js(5.5.0)\x1B\\"),!0)),r.parser.registerCsiHandler({prefix:"?",final:"u"},()=>!0),r.parser.registerCsiHandler({prefix:"?",final:"m"},n=>n[0]===4?(i("\x1B[>4;0m"),!0):!1),r.parser.registerCsiHandler({final:"t"},n=>{const _=n[0];return _===19?(i(`\x1B[9;${r.rows};${r.cols}t`),!0):_===20?(i("\x1B]LTerminal\x1B\\"),!0):_===21?(i("\x1B]lTerminal\x1B\\"),!0):!1}),r.parser.registerCsiHandler({prefix:"?",final:"S"},()=>!0),r.parser.registerDcsHandler({intermediates:"$",final:"q"},n=>n==="m"?(i("\x1BP1$rm\x1B\\"),!0):n==='"p'?(i('\x1BP1$r62;1"p\x1B\\'),!0):n==="r"?(i(`\x1BP1$r1;${r.rows}r\x1B\\`),!0):(i("\x1BP0$r\x1B\\"),!0)),r.parser.registerDcsHandler({intermediates:"+",final:"q"},n=>{try{const p=(n.match(/.{2}/g)||[]).map(R=>String.fromCharCode(parseInt(R,16))).join(""),L={TN:"xterm-256color",Co:"256",RGB:"",Tc:"",colors:"256",setrgbf:"\x1B[38;2;%p1%d;%p2%d;%p3%dm",setrgbb:"\x1B[48;2;%p1%d;%p2%d;%p3%dm"};if(p in L){const o=L[p].split("").map(d=>d.charCodeAt(0).toString(16).padStart(2,"0")).join("");return i(`\x1BP1+r${o}\x1B\\`),!0}}catch(_){console.error("[XTGETTCAP] Failed to decode:",_)}return i("\x1BP0+r\x1B\\"),!0}),r.parser.registerCsiHandler({final:"b"},n=>{const _=n[0]||1;return _>65535?(console.warn(`[REP] Large repeat count ${_} clamped to 65535 for security`),!0):!1})}const _w=new Set(["w","t","n","r","s","p","j"]),Dc=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent||"");function vw(r,i){const n=()=>{if(!r.hasSelection())return!1;try{const p=navigator==null?void 0:navigator.clipboard;if(p&&typeof p.writeText=="function")return p.writeText(r.getSelection()).catch(()=>{}),!0}catch{}return!1},_=()=>{try{const p=navigator==null?void 0:navigator.clipboard;if(p&&typeof p.readText=="function")return p.readText().then(L=>{!i()&&L&&r.paste(L)}).catch(()=>{}),!0}catch{}return!1};r.attachCustomKeyEventHandler(p=>{if(p.type!=="keydown"||p.isComposing||p.keyCode===229)return!0;const L=p.key.length===1?p.key.toLowerCase():p.key;return(p.ctrlKey&&p.shiftKey&&L==="c"||p.ctrlKey&&!p.shiftKey&&p.key==="Insert"||Dc&&p.metaKey&&!p.ctrlKey&&L==="c")&&r.hasSelection()&&n()||(p.ctrlKey&&p.shiftKey&&L==="v"||p.shiftKey&&!p.ctrlKey&&p.key==="Insert"||Dc&&p.metaKey&&!p.ctrlKey&&L==="v")&&_()?(p.preventDefault(),!1):((p.ctrlKey||p.metaKey)&&(p.key==="+"||p.key==="-"||p.key==="="||p.key==="0")||!Dc&&p.ctrlKey&&!p.shiftKey&&!p.altKey&&!p.metaKey&&_w.has(L)&&p.preventDefault(),!0)})}const gw="接続が終了しました。",kf=5,Lf=1e3,mw=new Set(["Deck deleted","Terminal deleted","Terminal exited","Terminal not found"]),Rf=new TextEncoder,Ac=48*1024;function yw(r){const i=new Uint8Array(r.length);for(let n=0;n<r.length;n++)i[n]=r.charCodeAt(n)&255;return i}function ww({session:r,wsUrl:i,onDelete:n,onExit:_,onTitle:p}){const L=$.useRef(null),R=$.useRef(null),o=$.useRef(null),d=$.useRef(null),v=$.useRef(0),y=$.useRef(_),f=$.useRef(p),[S,x]=$.useState(null);return $.useEffect(()=>{y.current=_},[_]),$.useEffect(()=>{f.current=p},[p]),$.useEffect(()=>{var T;x(null),(T=f.current)==null||T.call(f,null)},[r.id]),$.useEffect(()=>{var ze,Pr;if(!R.current)return;v.current=0,R.current.innerHTML="";const T=new X0.Terminal({cursorBlink:!0,cursorInactiveStyle:"outline",fontFamily:Yv,fontSize:Xv,allowProposedApi:!0,scrollback:1e4,scrollSensitivity:3,fastScrollModifier:"alt",macOptionIsMeta:!0,convertEol:!1,windowsMode:!1,rightClickSelectsWord:!0,theme:{background:Bc,foreground:Wf,cursor:Jv,cursorAccent:Bc,selectionBackground:Qv,black:Pt[0],red:Pt[1],green:Pt[2],yellow:Pt[3],blue:Pt[4],magenta:Pt[5],cyan:Pt[6],white:Pt[7],brightBlack:Pt[8],brightRed:Pt[9],brightGreen:Pt[10],brightYellow:Pt[11],brightBlue:Pt[12],brightMagenta:Pt[13],brightCyan:Pt[14],brightWhite:Pt[15]},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),w=new Z0,c=new k1,h=new A1;T.loadAddon(w),T.loadAddon(c),T.loadAddon(h),T.unicode.activeVersion="11",o.current=w,T.open(R.current);let l=null,u=!1;const g=()=>{if(!(u||Qe||l)){u=!0;try{const xe=new fw;xe.onContextLoss(()=>{xe.dispose(),l===xe&&(l=null)}),T.loadAddon(xe),l=xe}catch(xe){if(console.warn("[Terminal] WebGL renderer unavailable, falling back to DOM:",xe),l){try{l.dispose()}catch{}l=null}}}},C=new IntersectionObserver(xe=>{for(const Me of xe)Me.isIntersecting&&Me.intersectionRatio>0&&(g(),ve(!0))});C.observe(R.current),vw(T,()=>Qe);const k=T.onTitleChange(xe=>{var Me;x(xe),(Me=f.current)==null||Me.call(f,xe)});let D=null;const E=T.onBell(()=>{var Me;const xe=L.current??((Me=R.current)==null?void 0:Me.closest(".terminal-tile"));xe&&(xe.classList.add("bell-flash"),D&&clearTimeout(D),D=setTimeout(()=>{D=null,xe.classList.remove("bell-flash")},150))});let N=!0,V=!1,q=0,O=!0,A=!1,U=!0;const z=()=>{N=!1,A&&(A=!1,ve(!0)),U&&window.requestAnimationFrame(()=>{T.scrollToBottom()})},K=xe=>{const Me=d.current;Me&&Me.readyState===WebSocket.OPEN&&Me.send(JSON.stringify(xe))};pw(T,xe=>{if(N||!O)return;const Me=d.current;Me&&Me.readyState===WebSocket.OPEN&&Me.send(Rf.encode(xe))});let W=0,B=0,I=null,P=T.cols,H=T.rows,J=0,se=0,le=((ze=window.visualViewport)==null?void 0:ze.scale)??1;const de=(xe,Me)=>{T.cols>0&&(J=xe/T.cols),T.rows>0&&(se=Me/T.rows)},X=R.current.querySelector(".xterm-helper-textarea");X instanceof HTMLTextAreaElement&&(X.setAttribute("spellcheck","false"),X.setAttribute("autocapitalize","off"),X.setAttribute("autocomplete","off"),X.setAttribute("autocorrect","off"));const j=()=>{const xe=T.cols,Me=T.rows;!xe||!Me||xe===P&&Me===H||(P=xe,H=Me,K({type:"resize",cols:xe,rows:Me}))},ne=()=>{K({type:"claim"})},ee=xe=>{const Me=d.current;if(!(!Me||Me.readyState!==WebSocket.OPEN)){if(xe.byteLength<=Ac){Me.send(xe);return}for(let Ve=0;Ve<xe.byteLength;Ve+=Ac){const Ge=Math.min(Ve+Ac,xe.byteLength);Me.send(xe.subarray(Ve,Ge))}}},ce=(xe=!1)=>{var He;if(A)return;const Me=R.current;if(!Me)return;const Ve=Me.clientWidth,Ge=Me.clientHeight;if(!Ve||!Ge||!xe&&Ve===W&&Ge===B)return;const Mt=((He=window.visualViewport)==null?void 0:He.scale)??1;if(!xe&&J>0&&se>0){const vt=Math.max(2,Math.floor(Ve/J)),Ye=Math.max(1,Math.floor(Ge/se)),oe=Math.abs(Ve-W),ue=Math.abs(Ge-B),be=Math.max(J*.75,2),Oe=Math.max(se*.75,2),Ke=Math.abs(Mt-le)>.001;if(vt===P&&Ye===H){W=Ve,B=Ge,le=Mt;return}if(Ke&&oe<be&&ue<Oe){W=Ve,B=Ge,le=Mt;return}}W=Ve,B=Ge,w.fit(),de(Ve,Ge),le=Mt,j()},ve=(xe=!1)=>{if(I!==null){if(!xe)return;cancelAnimationFrame(I)}I=window.requestAnimationFrame(()=>{I=null,ce(xe)})},ie=new ResizeObserver(()=>{ve()});ie.observe(R.current),ve();const pe=typeof document<"u"?document.fonts:null,Re=()=>{Qe||ve(!0)};pe==null||pe.ready.then(Re).catch(()=>{}),(Pr=pe==null?void 0:pe.addEventListener)==null||Pr.call(pe,"loadingdone",Re);let Te=null,ye=null,Je=null,kt=null,Ct=null,Qe=!1,Ze=0,et=null,Vt=!1;const xt=()=>{var Me;const xe=(Me=R.current)==null?void 0:Me.querySelector(".xterm-helper-textarea");if(xe instanceof HTMLTextAreaElement)try{xe.focus({preventScroll:!0})}catch{xe.focus()}},at=()=>{Qe||xt()},bt=()=>{Qe||xt()};R.current.addEventListener("pointerdown",at,{passive:!0,capture:!0}),R.current.addEventListener("mousedown",at,{passive:!0,capture:!0}),R.current.addEventListener("touchstart",at,{passive:!0,capture:!0}),R.current.addEventListener("focusin",bt,!0),Ct=()=>{var xe,Me,Ve,Ge;(xe=R.current)==null||xe.removeEventListener("pointerdown",at,!0),(Me=R.current)==null||Me.removeEventListener("mousedown",at,!0),(Ve=R.current)==null||Ve.removeEventListener("touchstart",at,!0),(Ge=R.current)==null||Ge.removeEventListener("focusin",bt,!0)};const ht=async(xe=!1)=>{if(!Qe){N=!0,V=!1,q=0;try{const{token:Me,authEnabled:Ve}=await Zo();if(Qe)return;const Ge=Ve?`${i}?token=${Me}`:i;let Mt=Ge;if(xe&&v.current>0){const He=Ge.includes("?")?"&":"?";Mt=`${Ge}${He}bufferOffset=${v.current}`}if(xe){const He=Mt.includes("?")?"&":"?";Mt=`${Mt}${He}reconnect=1`}if(Te=new WebSocket(Mt),Te.binaryType="arraybuffer",d.current=Te,Te.addEventListener("open",()=>{var He;Ze=0,W=0,B=0,J=0,se=0,P=-1,H=-1,le=((He=window.visualViewport)==null?void 0:He.scale)??1,ve(),T.textarea&&document.activeElement===T.textarea&&ne()}),Te.addEventListener("message",He=>{if(typeof He.data=="string"){let Ye=null;try{Ye=JSON.parse(He.data)}catch{return}if((Ye==null?void 0:Ye.type)==="sync"){const oe=T.buffer.active;U=Ye.reset||oe.viewportY>=oe.baseY,N=!0,V=!1,q=0,A=!1,v.current=Ye.offsetBase,Ye.reset&&T.reset(),ce(!0),A=!0;return}if((Ye==null?void 0:Ye.type)==="ready"){V=!0,q===0&&z();return}if((Ye==null?void 0:Ye.type)==="primary"){O=Ye.value;return}return}if(He.data instanceof Blob){He.data.arrayBuffer().then(oe=>{if(Qe)return;const ue=new Uint8Array(oe);q++,T.write(ue,()=>{v.current+=ue.byteLength,q=Math.max(0,q-1),V&&q===0&&z()})});return}const vt=new Uint8Array(He.data);q++,T.write(vt,()=>{v.current+=vt.byteLength,q=Math.max(0,q-1),V&&q===0&&z()})}),Te.addEventListener("close",He=>{if(!(Qe||Vt)&&d.current===Te){if(He.code===1e3&&mw.has(He.reason)){y.current();return}if(Ze<kf){Ze++;const vt=Lf*Math.pow(2,Ze-1);et=setTimeout(()=>ht(!0),vt)}else T.write(`\r
173
+ \x1B[31m${gw}\x1B[0m\r
174
+ `)}}),Te.addEventListener("error",()=>{}),ye&&ye.dispose(),ye=T.onData(He=>{N||Te&&Te.readyState===WebSocket.OPEN&&ee(Rf.encode(He))}),Je&&Je.dispose(),Je=T.onBinary(He=>{N||Te&&Te.readyState===WebSocket.OPEN&&ee(yw(He))}),!kt&&T.textarea){const He=()=>{ne()};T.textarea.addEventListener("focus",He),kt=()=>{var vt;(vt=T.textarea)==null||vt.removeEventListener("focus",He)}}}catch(Me){if(console.error("[Terminal] Failed to connect:",Me),Ze<kf){Ze++;const Ve=Lf*Math.pow(2,Ze-1);et=setTimeout(()=>ht(!0),Ve)}else T.write(`\r
175
+ \x1B[31m接続エラー: ${Me instanceof Error?Me.message:"Unknown error"}\x1B[0m\r
176
+ `)}}};ht();const sr=()=>{if(Qe||Vt)return;const xe=d.current;xe&&(xe.readyState===WebSocket.OPEN||xe.readyState===WebSocket.CONNECTING)||(Ze=0,!(xe&&xe.readyState===WebSocket.CLOSING)&&(et&&(clearTimeout(et),et=null),ht(!0)))},_t=()=>sr(),Tt=()=>{document.visibilityState==="visible"&&sr()};return window.addEventListener("online",_t),document.addEventListener("visibilitychange",Tt),()=>{var xe;if(Qe=!0,Vt=!0,window.removeEventListener("online",_t),document.removeEventListener("visibilitychange",Tt),et&&clearTimeout(et),I!==null&&cancelAnimationFrame(I),ie.disconnect(),C.disconnect(),(xe=pe==null?void 0:pe.removeEventListener)==null||xe.call(pe,"loadingdone",Re),ye&&ye.dispose(),Je&&Je.dispose(),kt&&kt(),Ct&&Ct(),k.dispose(),E.dispose(),D&&(clearTimeout(D),D=null),Te&&Te.close(),d.current=null,l){try{l.dispose()}catch{}l=null}o.current=null,T.dispose()}},[r.id,i]),M.jsxs("div",{className:"terminal-tile",ref:L,children:[M.jsxs("div",{className:"terminal-tile-header",children:[M.jsx("span",{children:S||r.title}),M.jsx("button",{type:"button",className:"terminal-close-btn",onClick:()=>{window.confirm("このターミナルを閉じますか?")&&n()},"aria-label":"ターミナルを閉じる",children:"×"})]}),M.jsx("div",{className:"terminal-tile-body",ref:R})]})}function Sw(r){if(r<=1)return{cols:1,rows:1};const i=Math.ceil(Math.sqrt(r)),n=Math.ceil(r/i);return{cols:i,rows:n}}function Cw({terminals:r,wsBase:i,activeTerminalId:n,onDeleteTerminal:_,onExitTerminal:p,onTerminalTitle:L}){const{cols:R,rows:o}=Sw(r.length),[d,v]=$.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 720px)").matches);$.useEffect(()=>{const f=window.matchMedia("(max-width: 720px)");v(f.matches);const S=()=>v(f.matches);return f.addEventListener("change",S),()=>f.removeEventListener("change",S)},[]);const y=sp(r,n);return M.jsx("section",{className:"terminal-pane",children:r.length===0?M.jsx("div",{className:"terminal-empty",children:M.jsx("span",{className:"terminal-empty-text",children:"ターミナルを追加"})}):M.jsx("div",{className:St("terminal-grid",d&&"terminal-grid-mobile"),style:d?void 0:{gridTemplateColumns:`repeat(${R}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${o}, minmax(0, 1fr))`},children:r.map(f=>M.jsx("div",{className:St("terminal-tile-slot",d&&(f.id===y?"terminal-tile-slot-mobile-active":"terminal-tile-slot-mobile-hidden")),children:M.jsx(ww,{session:f,wsUrl:`${i}/api/terminals/${f.id}`,onDelete:()=>_(f.id),onExit:()=>p(f.id),onTitle:S=>L==null?void 0:L(f.id,S)})},f.id))})})}function xw({terminals:r,liveTitles:i,value:n,onChange:_}){const[p,L]=$.useState(null),R=$.useCallback(()=>{const d={};for(const v of r)d[v.id]=i[v.id]||v.title;L(d)},[r,i]),o=d=>(p?p[d.id]:i[d.id]||d.title)||d.title;return M.jsx("select",{className:"terminal-switcher",value:n,onPointerDown:R,onFocus:R,onKeyDown:R,onChange:d=>{_(d.target.value),L(null)},onBlur:()=>L(null),"aria-label":"ターミナルを切り替え",children:r.map(d=>M.jsx("option",{value:d.id,children:o(d)},d.id))})}function Jp({deck:r,deckState:i,wsBase:n,liveTitles:_,showName:p,onNewTerminal:L,onNewClaude:R,onNewCodex:o,onSetActiveTerminal:d,onDeleteTerminal:v,onExitTerminal:y,onTerminalTitle:f}){return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b border-border bg-sidebar gap-2 min-h-[28px]",children:[p&&M.jsx("span",{className:"deck-pane-name flex-1 min-w-0 text-[11px] font-semibold text-ink-muted overflow-hidden text-ellipsis whitespace-nowrap",children:r.name}),i.terminals.length>0&&M.jsx(xw,{terminals:i.terminals,liveTitles:_,value:sp(i.terminals,i.activeTerminalId)??"",onChange:S=>d(r.id,S)}),M.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[M.jsx("button",{type:"button",className:"topbar-btn-sm",onClick:()=>L(r.id),title:"ターミナル追加",children:"+"}),M.jsx("button",{type:"button",className:"topbar-btn-sm topbar-btn-claude",onClick:()=>R(r.id),title:"Claude",children:"C"}),M.jsx("button",{type:"button",className:"topbar-btn-sm topbar-btn-codex",onClick:()=>o(r.id),title:"Codex",children:"X"})]})]}),M.jsx(Cw,{terminals:i.terminals,wsBase:n,activeTerminalId:i.activeTerminalId??null,onDeleteTerminal:S=>v(r.id,S),onExitTerminal:S=>y(r.id,S),onTerminalTitle:f})]})}function Qp(){const[r,i]=$.useState(Xg);$.useEffect(()=>{if(!(typeof document>"u")){document.documentElement.dataset.theme=r;try{window.localStorage.setItem(Vf,r)}catch{}}},[r]);const n=$.useCallback(()=>{i(_=>_==="dark"?"light":"dark")},[]);return{theme:r,handleToggleTheme:n}}const Zp=()=>{const[r,i]=$.useState({}),n=$.useCallback((p,L)=>{i(R=>{const o=R[p]||Dn();return{...R,[p]:L(o)}})},[]),_=$.useCallback(p=>{i(L=>{const R={...L};return p.forEach(o=>{R[o]||(R[o]=Dn())}),R})},[]);return{deckStates:r,setDeckStates:i,updateDeckState:n,initializeDeckStates:_}},e_=({setStatusMessage:r,initializeDeckStates:i,updateDeckState:n,setDeckStates:_,initialDeckIds:p})=>{const[L,R]=$.useState([]),[o,d]=$.useState(p??[]);$.useEffect(()=>{let w=!0;return sg().then(c=>{w&&(R(c),i(c.map(h=>h.id)),c.forEach(h=>{pg(h.id).then(l=>{w&&n(h.id,u=>{var g;return{...u,terminals:l,activeTerminalId:u.activeTerminalId&&l.some(C=>C.id===u.activeTerminalId)?u.activeTerminalId:((g=l[0])==null?void 0:g.id)??null}})}).catch(()=>{})}))}).catch(c=>{w&&r(`デッキを取得できませんでした: ${Ht(c)}`)}),()=>{w=!1}},[r,i,n]),$.useEffect(()=>{if(L.length===0)return;const w=o.filter(c=>L.some(h=>h.id===c));w.length===o.length&&w.length>0||(w.length>0?d(w):L[0]&&d([L[0].id]))},[L,o]);const v=$.useCallback(async(w,c)=>{try{const h=await ng(w,c);return R(l=>[...l,h]),d(l=>[...l.filter(u=>u!==h.id),h.id]),_(l=>({...l,[h.id]:Dn()})),h}catch(h){return r(`デッキの作成に失敗しました: ${Ht(h)}`),null}},[r,_]),y=$.useCallback(async w=>{try{await og(w),R(c=>c.filter(h=>h.id!==w)),d(c=>c.filter(h=>h!==w)),_(c=>{const h={...c};return delete h[w],h})}catch(c){r(`デッキの削除に失敗しました: ${Ht(c)}`)}},[r,_]),f=$.useCallback(w=>{R(c=>{const h=w(c);return ag(h.map(l=>l.id)).catch(()=>{}),h})},[]),S=$.useCallback(async(w,c,h,l)=>{try{const u=await fg(w,l,h);n(w,g=>({...g,terminals:[...g.terminals,{id:u.id,title:u.title}],activeTerminalId:u.id}))}catch(u){r(`ターミナルを起動できませんでした: ${Ht(u)}`)}},[n,r]),x=$.useCallback(async(w,c)=>{try{await _g(c),n(w,h=>{var g;const l=h.terminals.filter(C=>C.id!==c),u=h.activeTerminalId===c?((g=l[l.length-1])==null?void 0:g.id)??null:h.activeTerminalId;return{...h,terminals:l,activeTerminalId:u}})}catch(h){r(`ターミナルを削除できませんでした: ${Ht(h)}`)}},[n,r]),T=$.useCallback((w,c)=>{n(w,h=>{var g;const l=h.terminals.filter(C=>C.id!==c),u=h.activeTerminalId===c?((g=l[l.length-1])==null?void 0:g.id)??null:h.activeTerminalId;return{...h,terminals:l,activeTerminalId:u}})},[n]);return{decks:L,activeDeckIds:o,setActiveDeckIds:d,handleCreateDeck:v,handleDeleteDeck:y,handleReorderDecks:f,handleCreateTerminal:S,handleDeleteTerminal:x,handleRemoveTerminalLocal:T}};function bw(r){const i=r.lastIndexOf("/");return i<=0?"":r.slice(0,i)}function Tf(r,i){return r?`${r}/${i}`:i}function Mf(r){var n;if(r.type==="dir")return"📁";const i=((n=r.name.split(".").pop())==null?void 0:n.toLowerCase())??"";return["png","jpg","jpeg","gif","webp","svg","ico"].includes(i)?"🖼️":["md","txt","rst"].includes(i)?"📄":["ts","tsx","js","jsx","json","py","go","rs","c","cpp","java","sh"].includes(i)?"📜":["zip","tar","gz","tgz"].includes(i)?"🗜️":"📄"}function Ew({workspaceId:r,workspacePath:i,onOpenInEditor:n,onStatus:_}){const[p,L]=$.useState(""),[R,o]=$.useState([]),[d,v]=$.useState(!1),[y,f]=$.useState(null),[S,x]=$.useState("grid"),[T,w]=$.useState(""),[c,h]=$.useState(!1),l=$.useRef(null),u=$.useCallback(async O=>{v(!0),f(null);try{const A=await Pc(r,O);o(A)}catch(A){f(A instanceof Error?A.message:"Failed to list files")}finally{v(!1)}},[r]);$.useEffect(()=>{u(p)},[u,p]);const g=$.useMemo(()=>{const O=p?p.split("/"):[],A=[{label:"/",path:""}];let U="";for(const z of O)U=U?`${U}/${z}`:z,A.push({label:z,path:U});return A},[p]),C=$.useMemo(()=>{const O=T.trim().toLowerCase();return O?R.filter(U=>U.name.toLowerCase().includes(O)):R},[R,T]),k=$.useCallback(O=>{O.type==="dir"?L(O.path):n(O.path)},[n]),D=$.useCallback(async()=>{const O=window.prompt("新しいフォルダ名");if(O)try{await Yf(r,Tf(p,O)),_==null||_(`フォルダを作成しました: ${O}`),u(p)}catch(A){f(A instanceof Error?A.message:"Failed to create folder")}},[r,p,u,_]),E=$.useCallback(async O=>{const A=window.prompt("新しい名前",O.name);if(!(!A||A===O.name))try{await ug(r,O.path,Tf(bw(O.path),A)),_==null||_(`名前を変更しました: ${O.name} → ${A}`),u(p)}catch(U){f(U instanceof Error?U.message:"Failed to rename")}},[r,p,u,_]),N=$.useCallback(async O=>{if(window.confirm(`「${O.name}」を削除しますか?`))try{O.type==="dir"?await Xf(r,O.path):await Gf(r,O.path),_==null||_(`削除しました: ${O.name}`),u(p)}catch(A){f(A instanceof Error?A.message:"Failed to delete")}},[r,p,u,_]),V=$.useCallback(async O=>{if(O.length!==0)try{const A=await dg(r,p,O);_==null||_(`${A.uploaded.length} 件アップロードしました`),u(p)}catch(A){f(A instanceof Error?A.message:"Upload failed")}},[r,p,u,_]),q=$.useCallback(O=>{O.preventDefault(),h(!1);const A=Array.from(O.dataTransfer.files||[]);V(A)},[V]);return M.jsxs("div",{className:"drive-browser flex flex-col h-full min-h-0",children:[M.jsxs("div",{className:"drive-toolbar flex items-center gap-2 px-3 py-2 border-b border-border flex-wrap",children:[M.jsx("nav",{className:"flex items-center gap-1 text-[13px] min-w-0 overflow-hidden",children:g.map((O,A)=>M.jsxs("span",{className:"flex items-center gap-1 min-w-0",children:[A>0&&M.jsx("span",{className:"text-muted",children:"/"}),M.jsx("button",{type:"button",className:"px-1 py-0.5 rounded hover:bg-list-hover text-ink-muted hover:text-ink truncate max-w-[160px]",onClick:()=>L(O.path),title:O.label,children:A===0?i.split("/").pop()||"/":O.label})]},O.path))}),M.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[M.jsx("input",{className:"browser-address-input max-w-[180px]",value:T,onChange:O=>w(O.target.value),placeholder:"検索",spellCheck:!1}),M.jsx("button",{type:"button",className:"topbar-btn-sm",title:"表示切替",onClick:()=>x(O=>O==="grid"?"list":"grid"),children:S==="grid"?"≣":"▦"}),M.jsx("button",{type:"button",className:"topbar-btn-sm",title:"再読み込み",onClick:()=>void u(p),children:"⟳"}),M.jsx("button",{type:"button",className:"topbar-btn-sm",title:"新しいフォルダ",onClick:D,children:"+"}),M.jsx("button",{type:"button",className:"topbar-btn-sm",title:"アップロード",onClick:()=>{var O;return(O=l.current)==null?void 0:O.click()},children:"⤓"}),M.jsx("button",{type:"button",className:"topbar-btn-sm topbar-btn-claude",title:"VS Codeで開く",onClick:()=>n(),children:"</>"}),M.jsx("input",{ref:l,type:"file",multiple:!0,className:"hidden",onChange:O=>{V(Array.from(O.target.files||[])),O.target.value=""}})]})]}),y&&M.jsx("div",{className:"browser-error",children:y}),M.jsx("div",{className:St("drive-body flex-1 min-h-0 overflow-auto p-3",c&&"drive-drag-active"),onDragOver:O=>{O.preventDefault(),h(!0)},onDragLeave:O=>{O.currentTarget.contains(O.relatedTarget)||h(!1)},onDrop:q,children:d?M.jsx("div",{className:"text-muted text-[13px] p-4",children:"読み込み中…"}):C.length===0?M.jsx("div",{className:"text-muted text-[13px] p-4",children:T?"一致するものがありません":"このフォルダは空です(ファイルをドロップでアップロード)"}):S==="grid"?M.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(120px, 1fr))"},children:C.map(O=>M.jsxs("div",{className:"drive-card flex flex-col items-center gap-1 p-3 rounded border border-border hover:bg-list-hover cursor-pointer relative group",onDoubleClick:()=>k(O),title:O.name,children:[M.jsx("div",{className:"text-[32px] leading-none",children:Mf(O)}),M.jsx("div",{className:"text-[12px] text-ink text-center truncate w-full",children:O.name}),M.jsxs("div",{className:"absolute top-1 right-1 hidden group-hover:flex gap-0.5",children:[M.jsx("button",{type:"button",className:"drive-mini-btn",title:"名前変更",onClick:A=>{A.stopPropagation(),E(O)},children:"✎"}),M.jsx("button",{type:"button",className:"drive-mini-btn",title:"削除",onClick:A=>{A.stopPropagation(),N(O)},children:"🗑"})]})]},O.path))}):M.jsx("div",{className:"flex flex-col",children:C.map(O=>M.jsxs("div",{className:"drive-row flex items-center gap-2 px-2 py-1.5 rounded hover:bg-list-hover cursor-pointer group",onDoubleClick:()=>k(O),children:[M.jsx("span",{className:"text-[16px]",children:Mf(O)}),M.jsx("span",{className:"text-[13px] text-ink flex-1 truncate",children:O.name}),M.jsx("span",{className:"text-[11px] text-muted",children:O.type==="dir"?"フォルダ":"ファイル"}),M.jsxs("span",{className:"hidden group-hover:flex gap-1",children:[M.jsx("button",{type:"button",className:"drive-mini-btn",title:"名前変更",onClick:A=>{A.stopPropagation(),E(O)},children:"✎"}),M.jsx("button",{type:"button",className:"drive-mini-btn",title:"削除",onClick:A=>{A.stopPropagation(),N(O)},children:"🗑"})]})]},O.path))})})]})}function kw(r){const[i,n]=$.useState(null);return $.useEffect(()=>{if(!r){n(null);return}let _=!0,p=null;const L=()=>{fetch(`/codeserver/status?wsId=${encodeURIComponent(r)}`,{credentials:"include"}).then(R=>R.ok?R.json():null).then(R=>{!_||!R||(n(R),R.acquired||(p=setTimeout(L,2e3)))}).catch(()=>{_&&(p=setTimeout(L,2e3))})};return L(),()=>{_=!1,p&&clearTimeout(p)}},[r]),i}function Lw({wsId:r,folderPath:i}){const n=kw(r),_=$.useRef(!1),p=$.useMemo(()=>`/codeserver/${r}/?folder=${encodeURIComponent(i)}`,[r,i]);return $.useEffect(()=>{n&&!n.acquired&&!_.current&&(_.current=!0,fetch("/codeserver/install",{method:"POST",credentials:"include"}).catch(()=>{}))},[n]),n===null?M.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-center p-6 text-muted",children:[M.jsx("div",{className:"browser-spinner","aria-hidden":"true"}),M.jsx("div",{className:"text-[13px]",children:"接続中…"})]}):n.acquired?M.jsx("iframe",{className:"code-server-frame",src:p,title:"VS Code",style:{width:"100%",height:"100%",border:0,display:"block",background:"#1e1e1e"},allow:"clipboard-read; clipboard-write"}):M.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-center p-6 text-muted",children:[M.jsx("div",{className:"browser-spinner","aria-hidden":"true"}),M.jsx("div",{className:"text-[15px] font-semibold text-ink",children:"VS Code (code-server) を準備中…"}),M.jsx("div",{className:"text-[13px]",children:"初回のみエディタ本体(~160MB)をダウンロードします。少々お待ちください。"})]})}function Rw({wsBase:r}){var ve;const{theme:i,handleToggleTheme:n}=Qp(),[_,p]=$.useState([]),[L,R]=$.useState(null),[o,d]=$.useState([]),[v,y]=$.useState([]),[f,S]=$.useState(!1),[x,T]=$.useState("drive"),[w,c]=$.useState(!1),[h,l]=$.useState(""),[u,g]=$.useState({}),C=$.useMemo(()=>Dn(),[]),{deckStates:k,setDeckStates:D,updateDeckState:E,initializeDeckStates:N}=Zp(),{decks:V,handleCreateDeck:q,handleDeleteDeck:O,handleCreateTerminal:A,handleDeleteTerminal:U,handleRemoveTerminalLocal:z}=e_({setStatusMessage:l,initializeDeckStates:N,updateDeckState:E,setDeckStates:D});$.useEffect(()=>{let ie=!0;return qf().then(pe=>{ie&&(p(pe),R(Re=>{var Te;return Re??((Te=pe[0])==null?void 0:Te.id)??null}))}).catch(()=>{}),()=>{ie=!1}},[]);const K=$.useMemo(()=>_.find(ie=>ie.id===L)??null,[_,L]),Y=$.useMemo(()=>new Map(_.map(ie=>[ie.id,ie])),[_]),W=$.useMemo(()=>new Map(V.map(ie=>[ie.id,ie])),[V]),B=$.useMemo(()=>V.filter(ie=>ie.workspaceId===L),[V,L]),I=$.useCallback((ie,pe)=>{g(Re=>Re[ie]===pe?Re:{...Re,[ie]:pe})},[]),P=$.useCallback(()=>{L&&(d(ie=>ie.includes(L)?ie:[...ie,L]),T(`code:${L}`),c(!1))},[L]),H=$.useCallback(ie=>{d(pe=>pe.filter(Re=>Re!==ie)),T(pe=>pe===`code:${ie}`?"drive":pe),fetch(`/codeserver/stop?wsId=${encodeURIComponent(ie)}`,{method:"POST",credentials:"include"}).catch(()=>{})},[]),J=$.useCallback(ie=>{y(pe=>pe.includes(ie)?pe:[...pe,ie]),T(`deck:${ie}`),c(!1)},[]),se=$.useCallback(ie=>{y(pe=>pe.filter(Re=>Re!==ie)),T(pe=>pe===`deck:${ie}`?"drive":pe)},[]),le=$.useCallback(async()=>{if(!L)return;const ie=window.prompt("新しいデッキ名",`deck-${B.length+1}`);if(!ie)return;const pe=await q(ie,L);pe&&J(pe.id)},[L,B.length,q,J]),de=$.useCallback(ie=>{A(ie,(k[ie]??C).terminals.length)},[A,k,C]),X=$.useCallback(ie=>{A(ie,(k[ie]??C).terminals.length,"claude","Claude Code")},[A,k,C]),j=$.useCallback(ie=>{A(ie,(k[ie]??C).terminals.length,"codex","Codex")},[A,k,C]),ne=$.useCallback(ie=>{R(ie),T("drive"),c(!1)},[]),ee=$.useMemo(()=>{var pe,Re;const ie=[{id:"drive",label:K?K.name:"Drive",closeable:!1}];for(const Te of v)ie.push({id:`deck:${Te}`,label:`⌗ ${((pe=W.get(Te))==null?void 0:pe.name)??Te}`,closeable:!0});for(const Te of o)ie.push({id:`code:${Te}`,label:`</> ${((Re=Y.get(Te))==null?void 0:Re.name)??Te}`,closeable:!0});return f&&ie.push({id:"browser",label:"◷ Browser",closeable:!0}),ie},[K,v,o,f,Y,W]),ce=$.useCallback(ie=>{ie.startsWith("deck:")?se(ie.slice(5)):ie.startsWith("code:")?H(ie.slice(5)):ie==="browser"&&(S(!1),T("drive"))},[se,H]);return M.jsxs("div",{className:"drive-shell flex h-full min-h-0","data-theme":i,children:[M.jsxs("aside",{className:St("drive-rail flex flex-col w-[220px] flex-shrink-0 border-r border-border bg-sidebar min-h-0",w&&"is-open"),children:[M.jsx("div",{className:"px-3 py-2.5 text-[13px] font-semibold text-ink border-b border-border",children:"Deck Drive"}),M.jsxs("div",{className:"flex-1 min-h-0 overflow-auto py-2",children:[M.jsx("div",{className:"px-3 py-1 text-[11px] uppercase tracking-wide text-muted",children:"Workspaces"}),_.map(ie=>M.jsxs("div",{children:[M.jsxs("button",{type:"button",className:St("w-full text-left px-3 py-1.5 text-[13px] truncate hover:bg-list-hover",ie.id===L?"text-ink bg-list-hover font-medium":"text-ink-muted"),onClick:()=>ne(ie.id),title:ie.path,children:["📁 ",ie.name]}),ie.id===L&&M.jsxs("div",{className:"pl-3",children:[B.map(pe=>M.jsxs("button",{type:"button",className:"w-full text-left px-3 py-1 text-[12px] truncate text-ink-muted hover:text-ink hover:bg-list-hover",onClick:()=>J(pe.id),children:["⌗ ",pe.name]},pe.id)),M.jsx("button",{type:"button",className:"w-full text-left px-3 py-1 text-[12px] text-accent hover:bg-list-hover",onClick:le,children:"+ 新しいデッキ"})]})]},ie.id)),_.length===0&&M.jsx("div",{className:"px-3 py-2 text-[12px] text-muted",children:"ワークスペースがありません"}),M.jsx("div",{className:"px-3 py-1 mt-3 text-[11px] uppercase tracking-wide text-muted",children:"Open Items"}),v.map(ie=>{var pe;return M.jsxs("div",{className:"flex items-center px-3 py-1 text-[12px] text-ink-muted",children:[M.jsxs("button",{type:"button",className:"flex-1 text-left truncate hover:text-ink",onClick:()=>T(`deck:${ie}`),children:["⌗ ",((pe=W.get(ie))==null?void 0:pe.name)??ie]}),M.jsx("button",{type:"button",className:"drive-mini-btn",title:"閉じる",onClick:()=>se(ie),children:"×"}),M.jsx("button",{type:"button",className:"drive-mini-btn",title:"デッキを削除",onClick:()=>{window.confirm("このデッキを削除しますか?端末も終了します。")&&(O(ie),se(ie))},children:"🗑"})]},ie)}),o.map(ie=>{var pe;return M.jsxs("div",{className:"flex items-center px-3 py-1 text-[12px] text-ink-muted",children:[M.jsxs("button",{type:"button",className:"flex-1 text-left truncate hover:text-ink",onClick:()=>T(`code:${ie}`),children:["</>"," ",((pe=Y.get(ie))==null?void 0:pe.name)??ie]}),M.jsx("button",{type:"button",className:"drive-mini-btn",title:"停止",onClick:()=>H(ie),children:"×"})]},ie)}),M.jsx("button",{type:"button",className:St("w-full text-left px-3 py-1 text-[12px] hover:text-ink",f?"text-ink":"text-ink-muted"),onClick:()=>{S(!0),T("browser")},children:"◷ Agent Browser"})]}),M.jsx("div",{className:"border-t border-border px-3 py-2 flex items-center gap-2",children:M.jsx("button",{type:"button",className:"topbar-btn-sm",title:"テーマ切替",onClick:n,children:"◐"})})]}),w&&M.jsx("div",{className:"drive-rail-backdrop",onClick:()=>c(!1)}),M.jsxs("main",{className:"flex flex-col flex-1 min-h-0",children:[M.jsxs("div",{className:"drive-mobilebar",children:[M.jsx("button",{type:"button",className:"topbar-btn-sm",onClick:()=>c(!0),"aria-label":"メニュー",children:"☰"}),M.jsx("span",{className:"text-[13px] font-semibold text-ink truncate",children:((ve=ee.find(ie=>ie.id===x))==null?void 0:ve.label)??"Deck Drive"})]}),M.jsx("div",{className:"drive-tabstrip flex items-center gap-1 px-2 border-b border-border bg-sidebar overflow-x-auto flex-shrink-0 min-h-[36px]",children:ee.map(ie=>M.jsxs("button",{type:"button",className:St("drive-tab flex items-center gap-1 px-3 py-1.5 text-[13px] whitespace-nowrap",x===ie.id?"text-ink border-b-2 border-accent":"text-ink-muted"),onClick:()=>T(ie.id),children:[M.jsx("span",{className:"truncate max-w-[160px]",children:ie.label}),ie.closeable&&M.jsx("span",{role:"button","aria-label":"閉じる",className:"ml-1 text-muted hover:text-ink",onClick:pe=>{pe.stopPropagation(),ce(ie.id)},children:"×"})]},ie.id))}),M.jsxs("div",{className:"flex-1 min-h-0 relative",children:[M.jsx("div",{className:"absolute inset-0",style:{display:x==="drive"?"block":"none"},children:K?M.jsx(Ew,{workspaceId:K.id,workspacePath:K.path,onOpenInEditor:P,onStatus:l},K.id):M.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px]",children:"左でワークスペースを選択してください"})}),v.map(ie=>{const pe=W.get(ie);return pe?M.jsx("div",{className:"absolute inset-0 flex flex-col",style:{display:x===`deck:${ie}`?"flex":"none"},children:M.jsx(Jp,{deck:pe,deckState:k[ie]??C,wsBase:r,liveTitles:u,onNewTerminal:de,onNewClaude:X,onNewCodex:j,onSetActiveTerminal:(Re,Te)=>E(Re,ye=>({...ye,activeTerminalId:Te})),onDeleteTerminal:U,onExitTerminal:z,onTerminalTitle:I})},ie):null}),o.map(ie=>{const pe=Y.get(ie);return pe?M.jsx("div",{className:"absolute inset-0",style:{display:x===`code:${ie}`?"block":"none"},children:M.jsx(Lw,{wsId:ie,folderPath:pe.path})},ie):null}),f&&M.jsx("div",{className:"absolute inset-0",style:{display:x==="browser"?"block":"none"},children:M.jsx(rp,{wsBase:r})})]})]}),M.jsx(Ff,{message:h})]})}const Tw="設定",Mw="サーバー設定",Dw="ポート番号",Aw="Basic認証",Bw="Basic認証を有効にする",Pw="ユーザー名",Ow="パスワード",Nw="※ 12文字以上推奨",Iw="キャンセル",jw="保存",Fw="※ 設定を保存すると、サーバーが再起動されます",Hw="WebSocket設定",$w="接続数上限 (IP毎)",zw="現在の接続数",Uw="全接続をクリア",Ww="適用",Qo="bg-panel border border-border rounded-[2px] px-2 py-1.5 text-[13px] font-mono text-ink focus:outline-none focus:border-focus";function Vw({isOpen:r,onClose:i,onSave:n}){const[_,p]=$.useState(8787),[L,R]=$.useState(!1),[o,d]=$.useState(""),[v,y]=$.useState(""),[f,S]=$.useState(!1),[x,T]=$.useState(1e3),[w,c]=$.useState(null),[h,l]=$.useState(!1),u=()=>{fetch("/api/ws/stats").then(D=>D.json()).then(D=>{c(D),T(D.limit)}).catch(D=>{console.error("Failed to load WS stats:",D)})};$.useEffect(()=>{if(!r)return;const D=E=>{E.key==="Escape"&&(E.preventDefault(),i())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[r,i]),$.useEffect(()=>{r&&(fetch("/api/settings").then(D=>D.json()).then(D=>{p(D.port),R(D.basicAuthEnabled),d(D.basicAuthUser),y(D.basicAuthPassword)}).catch(D=>{console.error("Failed to load settings:",D)}),u())},[r]);const g=async()=>{try{await fetch("/api/ws/limit",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:x})}),u()}catch(D){console.error("Failed to set WS limit:",D)}},C=async()=>{l(!0);try{await fetch("/api/ws/clear",{method:"POST"}),u()}catch(D){console.error("Failed to clear WS connections:",D)}finally{l(!1)}},k=async D=>{D.preventDefault(),S(!0);try{await n({port:_,basicAuthEnabled:L,basicAuthUser:o,basicAuthPassword:v}),i()}catch(E){console.error("Failed to save settings:",E),alert("設定の保存に失敗しました")}finally{S(!1)}};return r?M.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[500]",role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title",onClick:i,children:M.jsxs("div",{className:"modal w-[500px]",onClick:D=>D.stopPropagation(),children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"m-0 text-[14px] font-semibold",id:"settings-modal-title",children:Tw}),M.jsx("button",{type:"button",className:"modal-close-btn",onClick:i,"aria-label":"閉じる",children:"×"})]}),M.jsxs("form",{onSubmit:k,children:[M.jsxs("div",{className:"flex flex-col gap-4",children:[M.jsxs("section",{className:"flex flex-col gap-3",children:[M.jsx("h3",{className:"m-0 text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted border-b border-border pb-2",children:Mw}),M.jsxs("div",{className:"flex flex-col gap-1",children:[M.jsx("label",{htmlFor:"port",className:"text-xs text-ink-muted",children:Dw}),M.jsx("input",{type:"number",id:"port",className:Qo,value:_,onChange:D=>p(Number(D.target.value)),min:1024,max:65535,required:!0})]}),M.jsxs("div",{className:"flex flex-col gap-1",children:[M.jsx("h4",{className:"m-0 text-xs font-semibold text-ink-muted",children:Aw}),M.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[M.jsx("input",{type:"checkbox",checked:L,onChange:D=>R(D.target.checked)}),M.jsx("span",{children:Bw})]})]}),L&&M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex flex-col gap-1",children:[M.jsx("label",{htmlFor:"username",className:"text-xs text-ink-muted",children:Pw}),M.jsx("input",{type:"text",id:"username",className:Qo,value:o,onChange:D=>d(D.target.value),required:L,autoComplete:"username"})]}),M.jsxs("div",{className:"flex flex-col gap-1",children:[M.jsx("label",{htmlFor:"password",className:"text-xs text-ink-muted",children:Ow}),M.jsx("input",{type:"password",id:"password",className:Qo,value:v,onChange:D=>y(D.target.value),required:L,minLength:12,autoComplete:"new-password"}),M.jsx("p",{className:"m-0 text-[11px] text-muted",children:Nw})]})]})]}),M.jsxs("section",{className:"flex flex-col gap-3",children:[M.jsx("h3",{className:"m-0 text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted border-b border-border pb-2",children:Hw}),M.jsxs("div",{className:"flex flex-col gap-1",children:[M.jsx("label",{htmlFor:"wsLimit",className:"text-xs text-ink-muted",children:$w}),M.jsxs("div",{className:"flex gap-2 items-center",children:[M.jsx("input",{type:"number",id:"wsLimit",className:`flex-1 ${Qo}`,value:x,onChange:D=>T(Number(D.target.value)),min:1,max:1e4}),M.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:g,children:Ww})]})]}),M.jsxs("div",{className:"flex flex-col gap-1",children:[M.jsx("label",{className:"text-xs text-ink-muted",children:zw}),M.jsx("div",{className:"border border-border rounded-[2px] p-2 text-xs bg-bg min-h-[40px] flex flex-col gap-1",children:w&&w.connections.length>0?w.connections.map(({ip:D,count:E})=>M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"font-mono text-ink",children:D}),M.jsx("span",{className:"font-semibold text-ink-muted",children:E})]},D)):M.jsx("div",{className:"text-muted text-center",children:"接続なし"})})]}),M.jsx("div",{className:"flex flex-col gap-1",children:M.jsx("button",{type:"button",className:"bg-[#f14c4c] text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",onClick:C,disabled:h,children:h?"クリア中...":Uw})})]}),M.jsx("p",{className:"m-0 text-[11px] text-muted italic",children:Fw})]}),M.jsxs("div",{className:"flex justify-end gap-2 mt-4 border-t border-border pt-4",children:[M.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:i,disabled:f,children:Iw}),M.jsx("button",{type:"submit",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",disabled:f,children:f?"保存中...":jw})]})]})]})}):null}const Kw=()=>{const[r,i]=$.useState({}),n=$.useCallback((p,L)=>{i(R=>{const o=R[p]||na();return{...R,[p]:L(o)}})},[]),_=$.useCallback(p=>{i(L=>{const R={...L};return p.forEach(o=>{R[o]||(R[o]=na())}),R})},[]);return{workspaceStates:r,setWorkspaceStates:i,updateWorkspaceState:n,initializeWorkspaceStates:_}},qw=({setStatusMessage:r,defaultRoot:i,initializeWorkspaceStates:n,setWorkspaceStates:_})=>{const[p,L]=$.useState([]),[R,o]=$.useState(null);$.useEffect(()=>{let y=!0;return qf().then(f=>{y&&(L(f),o(S=>S&&f.some(x=>x.id===S)?S:null),n(f.map(S=>S.id)))}).catch(f=>{y&&r(`ワークスペースを取得できませんでした: ${Ht(f)}`)}),()=>{y=!1}},[r,n]);const d=$.useCallback(async y=>{const S=y.trim()||i;if(!S)return r("パスを入力してください。"),null;const x=Id(S);if(p.some(w=>Id(w.path)===x))return r("同じパスのワークスペースは追加できません。"),null;try{const w=await rg(S);return L(c=>[...c,w]),o(w.id),_(c=>({...c,[w.id]:na()})),w}catch(w){return r(`ワークスペースを追加できませんでした: ${Ht(w)}`),null}},[p,i,r,_]),v=$.useCallback(async y=>{try{await ig(y),L(f=>f.filter(S=>S.id!==y)),o(f=>f===y?null:f),_(f=>{const S={...f};return delete S[y],S})}catch(f){r(`ワークスペースを削除できませんでした: ${Ht(f)}`)}},[r,_]);return{workspaces:p,editorWorkspaceId:R,setEditorWorkspaceId:o,handleCreateWorkspace:d,handleDeleteWorkspace:v}},Gw=({editorWorkspaceId:r,activeWorkspaceState:i,updateWorkspaceState:n,setStatusMessage:_})=>{const[p,L]=$.useState(null),R=$.useCallback(()=>{r&&(n(r,c=>({...c,treeLoading:!0,treeError:null})),Xt(Pc(r,""),15e3).then(c=>{n(r,h=>({...h,tree:oa(c),treeLoading:!1}))}).catch(c=>{n(r,h=>({...h,treeLoading:!1,treeError:Ht(c)}))}))},[r,n]),o=$.useCallback(c=>{if(!(!r||c.type!=="dir")){if(c.expanded){n(r,h=>({...h,tree:Bs(h.tree,c.path,l=>({...l,expanded:!1}))}));return}if(c.children&&c.children.length>0){n(r,h=>({...h,tree:Bs(h.tree,c.path,l=>({...l,expanded:!0}))}));return}n(r,h=>({...h,tree:Bs(h.tree,c.path,l=>({...l,loading:!0}))})),Xt(Pc(r,c.path),15e3).then(h=>{n(r,l=>({...l,tree:Bs(l.tree,c.path,u=>({...u,expanded:!0,loading:!1,children:oa(h)}))}))}).catch(h=>{n(r,l=>({...l,treeError:Ht(h),tree:Bs(l.tree,c.path,u=>({...u,loading:!1}))}))})}},[r,n]),d=$.useCallback(c=>{if(!r||c.type!=="file")return;const h=i.files.find(g=>g.path===c.path);if(h){n(r,g=>({...g,activeFileId:h.id}));return}const l=crypto.randomUUID(),u={id:l,name:c.name,path:c.path,language:np(c.path),contents:"",dirty:!1};n(r,g=>({...g,files:[...g.files,{...u,contents:"読み込み中..."}],activeFileId:l})),Xt(lg(r,c.path),15e3).then(g=>{n(r,C=>({...C,files:C.files.map(k=>k.id===l?{...k,contents:g.contents}:k)}))}).catch(g=>{n(r,C=>({...C,files:C.files.filter(k=>k.id!==l),activeFileId:C.files.length>1?C.files[0].id:null})),_(`ファイルを開けませんでした: ${Ht(g)}`)})},[r,i.files,n,_]),v=$.useCallback((c,h)=>{r&&n(r,l=>({...l,files:l.files.map(u=>u.id===c?{...u,contents:h,dirty:!0}:u)}))},[r,n]),y=$.useCallback(async c=>{if(!r)return;const h=i.files.find(l=>l.id===c);if(h){L(c);try{await Xt(cg(r,h.path,h.contents),15e3),n(r,l=>({...l,files:l.files.map(u=>u.id===c?{...u,dirty:!1}:u)})),_($f)}catch(l){_(`保存に失敗しました: ${Ht(l)}`)}finally{L(null)}}},[r,i.files,n,_]),f=$.useCallback(c=>{r&&n(r,h=>{const l=h.files.findIndex(C=>C.id===c),u=h.files.filter(C=>C.id!==c);let g=h.activeFileId;return h.activeFileId===c&&(u.length===0?g=null:l>=u.length?g=u[u.length-1].id:g=u[l].id),{...h,files:u,activeFileId:g}})},[r,n]),S=$.useCallback(async(c,h)=>{if(!r)return;const l=c?`${c}/${h}`:h;try{await Xt(hg(r,l),15e3);const u={name:h,path:l,type:"file",expanded:!1,loading:!1};n(r,g=>({...g,tree:Oc(g.tree,c,u)})),_(`ファイルを作成しました: ${h}`)}catch(u){_(`ファイル作成に失敗しました: ${Ht(u)}`)}},[r,n,_]),x=$.useCallback(async(c,h)=>{if(!r)return;const l=c?`${c}/${h}`:h;try{await Xt(Yf(r,l),15e3);const u={name:h,path:l,type:"dir",expanded:!1,loading:!1,children:[]};n(r,g=>({...g,tree:Oc(g.tree,c,u)})),_(`フォルダを作成しました: ${h}`)}catch(u){_(`フォルダ作成に失敗しました: ${Ht(u)}`)}},[r,n,_]),T=$.useCallback(async c=>{if(r)try{await Xt(Gf(r,c),15e3),n(r,h=>{const l=h.files.filter(C=>C.path!==c);let u=h.activeFileId;const g=h.files.find(C=>C.path===c);return g&&h.activeFileId===g.id&&(u=l.length>0?l[0].id:null),{...h,files:l,activeFileId:u,tree:Nc(h.tree,c)}}),_("ファイルを削除しました")}catch(h){_(`ファイル削除に失敗しました: ${Ht(h)}`)}},[r,n,_]),w=$.useCallback(async c=>{if(r)try{await Xt(Xf(r,c),15e3),n(r,h=>{const l=h.files.filter(C=>!C.path.startsWith(c+"/")&&C.path!==c);let u=h.activeFileId;const g=h.files.find(C=>C.id===h.activeFileId);return g&&(g.path.startsWith(c+"/")||g.path===c)&&(u=l.length>0?l[0].id:null),{...h,files:l,activeFileId:u,tree:Nc(h.tree,c)}}),_("フォルダを削除しました")}catch(h){_(`フォルダ削除に失敗しました: ${Ht(h)}`)}},[r,n,_]);return{savingFileId:p,handleRefreshTree:R,handleToggleDir:o,handleOpenFile:d,handleFileChange:v,handleSaveFile:y,handleCloseFile:f,handleCreateFile:S,handleCreateDirectory:x,handleDeleteFile:T,handleDeleteDirectory:w}};async function Yw(r,i,n,_){if(!_.current[r]){_.current[r]=!0,i(r,p=>({...p,loading:!0,reposLoading:!0,error:null}));try{const L=(await Xt(wg(r)).catch(()=>({repos:[]}))).repos;i(r,f=>({...f,repos:L,reposLoading:!1,selectedRepoPath:f.selectedRepoPath??(L.length>0?L[0].path:null)}));const o=(n.current[r]||Tn()).selectedRepoPath??(L.length>0?L[0].path:void 0),[d,v,y]=await Promise.all([Xt(Jf(r,o||void 0)),Xt(ep(r,o||void 0)).catch(()=>({ahead:0,behind:0,hasUpstream:!1})),Xt(tp(r,o||void 0)).catch(()=>({hasRemote:!1,remotes:[]}))]);i(r,f=>({...f,status:d,branchStatus:v,hasRemote:y.hasRemote,loading:!1,error:null}))}catch(p){const L=p instanceof Error?p.message:"Failed to get git status";i(r,R=>({...R,status:null,loading:!1,reposLoading:!1,error:L}))}finally{_.current[r]=!1}}}async function Xw(r,i,n,_){n(r,p=>({...p,selectedRepoPath:i,loading:!0}));try{const[p,L,R]=await Promise.all([Xt(Jf(r,i||void 0)),Xt(ep(r,i||void 0)).catch(()=>({ahead:0,behind:0,hasUpstream:!1})),Xt(tp(r,i||void 0)).catch(()=>({hasRemote:!1,remotes:[]}))]);n(r,o=>({...o,status:p,branchStatus:L,hasRemote:R.hasRemote,loading:!1,branches:[],logs:[]}))}catch(p){const L=p instanceof Error?p.message:"Failed to get git status";_(L),n(r,R=>({...R,loading:!1}))}}async function Jw(r,i,n,_,p){try{await Qf(r,[i],n),await p()}catch(L){_(L instanceof Error?L.message:"Failed to stage file")}}async function Qw(r,i,n,_,p){try{await Zf(r,[i],n),await p()}catch(L){_(L instanceof Error?L.message:"Failed to unstage file")}}async function Zw(r,i,n,_,p){if(i.length!==0)try{await Qf(r,i,n),await p()}catch(L){_(L instanceof Error?L.message:"Failed to stage files")}}async function eS(r,i,n,_,p){if(i.length!==0)try{await Zf(r,i,n),await p()}catch(L){_(L instanceof Error?L.message:"Failed to unstage files")}}async function tS(r,i,n,_,p){try{const L=await Sg(r,i.trim(),n);_(`Committed: ${L.summary.changes} changes, +${L.summary.insertions} -${L.summary.deletions}`),await p()}catch(L){_(L instanceof Error?L.message:"Failed to commit")}}async function rS(r,i,n,_,p){try{await Cg(r,[i],n),await p()}catch(L){_(L instanceof Error?L.message:"Failed to discard changes")}}async function iS(r,i,n,_,p){_(r,L=>({...L,diffPath:i.path,diffLoading:!0,diff:null}));try{const L=await xg(r,i.path,i.staged,n);_(r,R=>({...R,diff:L,diffLoading:!1}))}catch(L){p(L instanceof Error?L.message:"Failed to get diff"),_(r,R=>({...R,diffPath:null,diff:null,diffLoading:!1}))}}async function sS(r,i,n,_,p){n(r,L=>({...L,pushing:!0}));try{const L=await bg(r,i);_(`Pushed to ${L.branch}`),await p()}catch(L){_(L instanceof Error?L.message:"Failed to push")}finally{n(r,L=>({...L,pushing:!1}))}}async function nS(r,i,n,_,p){n(r,L=>({...L,pulling:!0}));try{const L=await Eg(r,i);L.summary.changes>0?_(`Pulled: ${L.summary.changes} changes, +${L.summary.insertions} -${L.summary.deletions}`):_("Already up to date"),await p()}catch(L){_(L instanceof Error?L.message:"Failed to pull")}finally{n(r,L=>({...L,pulling:!1}))}}async function oS(r,i,n,_){try{await kg(r,i),n("Fetched from remote"),await _()}catch(p){n(p instanceof Error?p.message:"Failed to fetch")}}async function aS(r,i,n,_){n(r,p=>({...p,branchesLoading:!0}));try{const p=await Xt(Lg(r,i));n(r,L=>({...L,branches:p.branches,branchesLoading:!1}))}catch(p){_(p instanceof Error?p.message:"Failed to load branches"),n(r,L=>({...L,branchesLoading:!1}))}}async function lS(r,i,n,_,p,L){try{await Rg(r,i,n),_(`Switched to branch '${i}'`),await p(),await L()}catch(R){_(R instanceof Error?R.message:"Failed to checkout branch")}}async function cS(r,i,n,_,p,L,R){try{await Tg(r,i,n,_),p(`Created branch '${i}'${n?" and switched to it":""}`),await L(),await R()}catch(o){p(o instanceof Error?o.message:"Failed to create branch")}}async function hS(r,i,n,_,p){_(r,L=>({...L,logsLoading:!0}));try{const L=await Xt(Mg(r,i,n));_(r,R=>({...R,logs:L.logs,logsLoading:!1}))}catch(L){p(L instanceof Error?L.message:"Failed to load git log"),_(r,R=>({...R,logsLoading:!1}))}}const Tn=()=>({status:null,loading:!1,error:null,diffPath:null,diff:null,diffLoading:!1,branchStatus:null,hasRemote:!1,pushing:!1,pulling:!1,branches:[],branchesLoading:!1,logs:[],logsLoading:!1,repos:[],reposLoading:!1,selectedRepoPath:null}),uS=(r,i)=>{const[n,_]=$.useState({}),p=$.useRef({}),L=$.useRef(n);L.current=n;const R=r&&n[r]||Tn(),o=$.useCallback((O,A)=>{_(U=>({...U,[O]:A(U[O]||Tn())}))},[]),d=$.useCallback(async O=>{const A=O||r;A&&await Yw(A,o,L,p)},[r,o]),v=$.useCallback(async O=>{r&&await Xw(r,O,o,i)},[r,o,i]),y=$.useCallback(async()=>{const O=Object.keys(L.current);await Promise.all(O.map(A=>d(A)))},[d]),f=$.useCallback(()=>{if(!r)return;const O=L.current[r];return(O==null?void 0:O.selectedRepoPath)||void 0},[r]),S=$.useCallback(async O=>{r&&await Jw(r,O,f(),i,d)},[r,f,i,d]),x=$.useCallback(async O=>{r&&await Qw(r,O,f(),i,d)},[r,f,i,d]),T=$.useCallback(async()=>{if(!r||!R.status)return;const O=R.status.files.filter(A=>!A.staged).map(A=>A.path);await Zw(r,O,f(),i,d)},[r,R.status,f,i,d]),w=$.useCallback(async()=>{if(!r||!R.status)return;const O=R.status.files.filter(A=>A.staged).map(A=>A.path);await eS(r,O,f(),i,d)},[r,R.status,f,i,d]),c=$.useCallback(async O=>{!r||!O.trim()||await tS(r,O,f(),i,d)},[r,f,i,d]),h=$.useCallback(async O=>{r&&await rS(r,O,f(),i,d)},[r,f,i,d]),l=$.useCallback(async O=>{r&&await iS(r,O,f(),o,i)},[r,f,o,i]),u=$.useCallback(()=>{r&&o(r,O=>({...O,diffPath:null,diff:null,diffLoading:!1}))},[r,o]),g=$.useCallback(async()=>{r&&await sS(r,f(),o,i,d)},[r,f,o,i,d]),C=$.useCallback(async()=>{r&&await nS(r,f(),o,i,d)},[r,f,o,i,d]),k=$.useCallback(async()=>{r&&await oS(r,f(),i,d)},[r,f,i,d]),D=$.useCallback(async()=>{r&&await aS(r,f(),o,i)},[r,f,o,i]),E=$.useCallback(async O=>{r&&await lS(r,O,f(),i,d,D)},[r,f,i,d,D]),N=$.useCallback(async(O,A=!0)=>{r&&await cS(r,O,A,f(),i,d,D)},[r,f,i,d,D]),V=$.useCallback(async(O=50)=>{r&&await hS(r,O,f(),o,i)},[r,f,o,i]),q=$.useCallback(O=>n[O]||Tn(),[n]);return{gitState:R,gitStates:n,refreshGitStatus:d,refreshAllGitStatuses:y,getGitStateForWorkspace:q,handleSelectRepo:v,handleStageFile:S,handleUnstageFile:x,handleStageAll:T,handleUnstageAll:w,handleCommit:c,handleDiscardFile:h,handleShowDiff:l,handleCloseDiff:u,handlePush:g,handlePull:C,handleFetch:k,handleLoadBranches:D,handleCheckoutBranch:E,handleCreateBranch:N,handleLoadLogs:V}};function dS({view:r,editorWorkspaceId:i,activeDeckIds:n,workspaceMode:_,setView:p,setEditorWorkspaceId:L,setActiveDeckIds:R,setWorkspaceMode:o}){$.useEffect(()=>{const d=()=>{const v=op();p(v.view),L(v.workspaceId??null),R(v.deckIds),o(v.workspaceMode)};return window.addEventListener("popstate",d),()=>window.removeEventListener("popstate",d)},[p,L,R,o]),$.useEffect(()=>{const d=new URLSearchParams;d.set("view",r),r==="workspace"&&i&&d.set("workspace",i),n.length>0&&d.set("decks",n.join(",")),r==="workspace"&&_==="editor"&&i&&d.set("mode","editor");const v=d.toString(),y=v?`${window.location.pathname}?${v}`:window.location.pathname;window.history.replaceState(null,"",y)},[r,i,n,_])}function fS(){const[r,i]=$.useState(!1),[n,_]=$.useState(!1),[p,L]=$.useState(!1),R=$.useCallback(()=>i(!0),[]),o=$.useCallback(()=>i(!1),[]),d=$.useCallback(()=>_(!0),[]),v=$.useCallback(()=>_(!1),[]),y=$.useCallback(()=>L(!0),[]),f=$.useCallback(()=>L(!1),[]);return{isWorkspaceModalOpen:r,openWorkspaceModal:R,closeWorkspaceModal:o,isDeckModalOpen:n,openDeckModal:d,closeDeckModal:v,isSettingsModalOpen:p,openSettingsModal:y,closeSettingsModal:f}}const Df=3;function Af(r,i,n){const _=r.indexOf(i),p=r.indexOf(n);if(_<0||p<0||_===p)return r;const L=[...r];L.splice(_,1);const R=L.indexOf(n);return L.splice(R,0,i),L}function pS(){const r=op(),i=$.useRef(null),n=$.useRef(!1),[_,p]=$.useState(r.view),[L,R]=$.useState(r.workspaceMode),[o,d]=$.useState(Vv),[v,y]=$.useState(""),[f,S]=$.useState(null),[x,T]=$.useState(null),[w,c]=$.useState(!1),[h,l]=$.useState(!1),[u,g]=$.useState(null),{theme:C,handleToggleTheme:k}=Qp(),[D,E]=$.useState({}),N=$.useCallback((he,we)=>{E(je=>je[he]===we?je:{...je,[he]:we})},[]);$.useEffect(()=>{const he=window.visualViewport;if(!he)return;let we=he.height,je=!1;const We=document.documentElement,xr=()=>{je?(we=he.height,je=!1):he.height>we&&(we=he.height);const $s=we-he.height>150;We.style.setProperty("--viewport-height",`${he.height}px`),We.classList.toggle("keyboard-open",$s)},br=()=>{je=!0,window.setTimeout(xr,300)};return xr(),he.addEventListener("resize",xr),window.addEventListener("orientationchange",br),()=>{he.removeEventListener("resize",xr),window.removeEventListener("orientationchange",br),We.classList.remove("keyboard-open")}},[]);const{isWorkspaceModalOpen:V,openWorkspaceModal:q,closeWorkspaceModal:O,isDeckModalOpen:A,openDeckModal:U,closeDeckModal:z,isSettingsModalOpen:K,openSettingsModal:Y,closeSettingsModal:W}=fS(),{workspaceStates:B,setWorkspaceStates:I,updateWorkspaceState:P,initializeWorkspaceStates:H}=Kw(),{deckStates:J,setDeckStates:se,updateDeckState:le,initializeDeckStates:de}=Zp(),{workspaces:X,editorWorkspaceId:j,setEditorWorkspaceId:ne,handleCreateWorkspace:ee,handleDeleteWorkspace:ce}=qw({setStatusMessage:y,defaultRoot:o,initializeWorkspaceStates:H,setWorkspaceStates:I}),{decks:ve,activeDeckIds:ie,setActiveDeckIds:pe,handleCreateDeck:Re,handleDeleteDeck:Te,handleReorderDecks:ye,handleCreateTerminal:Je,handleDeleteTerminal:kt,handleRemoveTerminalLocal:Ct}=e_({setStatusMessage:y,initializeDeckStates:de,updateDeckState:le,setDeckStates:se,initialDeckIds:r.deckIds}),Qe=$.useMemo(()=>na(),[]),Ze=$.useMemo(()=>Dn(),[]),et=X.find(he=>he.id===j)||null,Vt=j&&B[j]||Qe,{savingFileId:xt,handleRefreshTree:at,handleToggleDir:bt,handleOpenFile:ht,handleFileChange:sr,handleSaveFile:_t,handleCloseFile:Tt,handleCreateFile:ze,handleCreateDirectory:Pr,handleDeleteFile:xe,handleDeleteDirectory:Me}=Gw({editorWorkspaceId:j,activeWorkspaceState:Vt,updateWorkspaceState:P,setStatusMessage:y}),{gitState:Ve,refreshGitStatus:Ge,handleSelectRepo:Mt,handleStageFile:He,handleUnstageFile:vt,handleStageAll:Ye,handleUnstageAll:oe,handleCommit:ue,handleDiscardFile:be,handleShowDiff:Oe,handleCloseDiff:Ke,handlePush:Fe,handlePull:Jt,handleLoadBranches:ut,handleCheckoutBranch:gt,handleCreateBranch:Xe,handleLoadLogs:Pe}=uS(j,y);dS({view:_,editorWorkspaceId:j,activeDeckIds:ie,workspaceMode:L,setView:p,setEditorWorkspaceId:ne,setActiveDeckIds:pe,setWorkspaceMode:R});const dt=eg(),rt=$.useMemo(()=>new Map(X.map(he=>[he.id,he])),[X]),Wr=ve;$.useEffect(()=>{let he=!0;return tg().then(we=>{he&&we!=null&&we.defaultRoot&&d(we.defaultRoot)}).catch(()=>{}),()=>{he=!1}},[]),$.useEffect(()=>{if(v!==$f)return;const he=setTimeout(()=>y(""),Gv);return()=>clearTimeout(he)},[v]),$.useEffect(()=>{L==="editor"&&!j&&R("list")},[L,j]),$.useEffect(()=>{if(typeof window>"u")return;const he=window.matchMedia("(pointer: fine) and (min-width: 721px)"),we=()=>l(he.matches);return we(),he.addEventListener("change",we),()=>he.removeEventListener("change",we)},[]);const Qt=$.useCallback(()=>{S(null),T(null),c(!1)},[]),Or=$.useCallback(()=>{n.current=!0,window.setTimeout(()=>{n.current=!1},100)},[]);$.useEffect(()=>{h||Qt()},[h,Qt]);const pi=$.useRef(null);$.useEffect(()=>{if(L!=="editor"||!j){pi.current=null;return}pi.current!==j&&(pi.current=j,at(),Ge())},[L,j,at,Ge]);const fa=$.useCallback(()=>{if(X.length===0){y(Kv);return}U()},[X.length,U]),pa=$.useCallback(async(he,we)=>{if(!we){y(qv);return}await Re(he,we)&&z()},[Re,z]),Zr=$.useCallback(async he=>{try{const we=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(he)});if(!we.ok){const je=await we.text();throw new Error(je||"Failed to save settings")}await we.json(),y("設定を保存しました。ブラウザをリロードしてください。"),setTimeout(()=>{window.location.reload()},2e3)}catch(we){throw console.error("Failed to save settings:",we),we}},[]),Nn=$.useCallback(he=>{ne(he),R("editor")},[ne]),In=$.useCallback(()=>{R("list")},[]),_a=$.useCallback(async he=>{await ee(he)&&O()},[ee,O]),jn=$.useCallback(he=>{const we=J[he]||Ze;Je(he,we.terminals.length)},[J,Ze,Je]),Fn=$.useCallback(he=>{const we=J[he]||Ze;Je(he,we.terminals.length,"claude","Claude Code")},[J,Ze,Je]),Hn=$.useCallback(he=>{const we=J[he]||Ze;Je(he,we.terminals.length,"codex","Codex")},[J,Ze,Je]),$n=$.useCallback((he,we)=>{kt(he,we)},[kt]),va=$.useCallback((he,we)=>{Ct(he,we)},[Ct]),ga=$.useCallback(he=>{if(n.current){n.current=!1;return}pe([he])},[pe]),lt=$.useCallback(he=>{pe(we=>{const je=[...we.filter(We=>We!==he),he];return je.length<=Df?je:je.slice(je.length-Df)})},[pe]),ma=$.useCallback(he=>{pe(we=>{if(we.length<=1){const je=Wr.find(We=>We.id!==he);return je?[je.id]:we}return we.filter(je=>je!==he)})},[Wr,pe]),Hs=$.useCallback((he,we)=>{he.preventDefault(),he.stopPropagation(),g({deckId:we,x:he.clientX,y:he.clientY})},[]),zn=$.useCallback(()=>{if(!u)return;const{deckId:he}=u;g(null),window.confirm(`このデッキを完全に削除しますか?
177
+ ターミナルもすべて削除されます。`)&&Te(he)},[u,Te]),Fi=$.useCallback(()=>{g(null)},[]),ya=$.useCallback((he,we)=>{if(!h){he.preventDefault();return}he.dataTransfer.effectAllowed="move",he.dataTransfer.setData("text/plain",we),S(we),T(null),c(!1)},[h]),Un=$.useCallback((he,we)=>{!h||!f||f===we||(he.preventDefault(),he.dataTransfer.dropEffect="move",T(we),c(!1))},[h,f]),ss=$.useCallback((he,we)=>{he.currentTarget.contains(he.relatedTarget)||T(je=>je===we?null:je)},[]),Cr=$.useCallback((he,we)=>{if(!h)return;he.preventDefault();const je=f||he.dataTransfer.getData("text/plain");if(!je||je===we){Qt();return}ye(We=>{const xr=We.map(Vr=>Vr.id),br=Af(xr,je,we),$s=new Map(We.map(Vr=>[Vr.id,Vr]));return br.map(Vr=>$s.get(Vr))}),pe(We=>Af(We,je,we)),Or(),Qt()},[f,h,Qt,pe,Or,ye]),wa=$.useCallback(he=>{!h||!f||(he.preventDefault(),he.dataTransfer.dropEffect="move",c(!0))},[h,f]),vr=$.useCallback(he=>{he.currentTarget.contains(he.relatedTarget)||c(!1)},[]),Sa=$.useCallback(he=>{if(!h)return;he.preventDefault();const we=f||he.dataTransfer.getData("text/plain");if(!we){Qt();return}lt(we),Or(),Qt()},[f,lt,h,Qt,Or]),Ca=$.useCallback(he=>{j&&P(j,we=>({...we,activeFileId:he}))},[j,P]),xa=L==="editor"&&!!j,ns=M.jsxs("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[M.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 flex-shrink-0",children:[M.jsx("button",{type:"button",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90",onClick:q,children:"ワークスペース追加"}),M.jsx(jg,{workspaces:X,selectedWorkspaceId:j,onSelect:Nn,onDelete:ce})]}),xa&&M.jsx(G0,{activeWorkspace:et,defaultRoot:o,activeWorkspaceState:Vt,editorWorkspaceId:j,gitState:Ve,theme:C,savingFileId:xt,onCloseWorkspaceEditor:In,onToggleDir:bt,onOpenFile:ht,onRefreshTree:at,onCreateFile:ze,onCreateDirectory:Pr,onDeleteFile:xe,onDeleteDirectory:Me,onRefreshGit:Ge,onSelectRepo:Mt,onStageFile:He,onUnstageFile:vt,onStageAll:Ye,onUnstageAll:oe,onCommit:ue,onDiscardFile:be,onShowDiff:Oe,onCloseDiff:Ke,onPush:Fe,onPull:Jt,onLoadBranches:ut,onCheckoutBranch:gt,onCreateBranch:Xe,onLoadLogs:Pe,onSelectFile:Ca,onCloseFile:Tt,onChangeFile:sr,onSaveFile:_t})]}),os=M.jsxs("div",{className:"terminal-layout",children:[M.jsx("div",{className:"terminal-topbar",children:M.jsx("div",{className:"topbar-left",children:M.jsxs("div",{className:"deck-tabs",children:[Wr.map(he=>{var we,je;return M.jsxs("button",{type:"button",className:St("deck-tab",ie.includes(he.id)&&"active",f===he.id&&"is-dragging",x===he.id&&"is-drag-over"),onClick:()=>ga(he.id),onContextMenu:We=>Hs(We,he.id),draggable:h,onDragStart:We=>ya(We,he.id),onDragOver:We=>Un(We,he.id),onDragLeave:We=>ss(We,he.id),onDrop:We=>Cr(We,he.id),onDragEnd:Qt,title:h?`${((we=rt.get(he.workspaceId))==null?void 0:we.path)||he.root}
178
+ ドラッグで並び替え / メインにドロップで分割表示`:`${((je=rt.get(he.workspaceId))==null?void 0:je.path)||he.root}`,children:[M.jsx("span",{className:"deck-tab-name",children:he.name}),M.jsx("span",{className:"deck-tab-close",role:"button","aria-label":"閉じる",onClick:We=>{We.stopPropagation(),ma(he.id)},children:"×"})]},he.id)}),M.jsx("button",{type:"button",className:"deck-tab deck-tab-add",onClick:fa,title:"デッキ作成",children:"+"})]})})}),M.jsx("div",{className:St("terminal-split-container",w&&"is-drop-target"),ref:i,style:{gridTemplateColumns:`repeat(${ie.length}, minmax(0, 1fr))`},onDragOver:wa,onDragLeave:vr,onDrop:Sa,children:ie.length===0?M.jsx("div",{className:"panel flex items-center justify-center text-muted text-[13px] p-5",children:"デッキを作成してください。"}):ie.map(he=>{const we=ve.find(We=>We.id===he),je=J[he]||Ze;return we?M.jsx("div",{className:"deck-split-pane",children:M.jsx(Jp,{deck:we,deckState:je,wsBase:dt,liveTitles:D,showName:ie.length>1,onNewTerminal:jn,onNewClaude:Fn,onNewCodex:Hn,onSetActiveTerminal:(We,xr)=>le(We,br=>({...br,activeTerminalId:xr})),onDeleteTerminal:$n,onExitTerminal:va,onTerminalTitle:N})},he):null})})]}),Hi=M.jsx(rp,{wsBase:dt}),[as]=$.useState(()=>{try{return new URLSearchParams(window.location.search).get("shell")==="legacy"}catch{return!1}});return as?M.jsxs("div",{className:"app","data-view":_,children:[M.jsx(Wv,{activeView:_,onSelect:p,theme:C,onToggleTheme:k,onOpenSettings:Y}),M.jsxs("main",{className:"main",children:[_==="workspace"&&ns,_==="terminal"&&os,_==="browser"&&Hi]}),M.jsx(Ff,{message:v}),M.jsx(Jg,{isOpen:V,defaultRoot:o,onSubmit:_a,onClose:O}),M.jsx(Uv,{isOpen:A,workspaces:X,onSubmit:pa,onClose:z}),M.jsx(Vw,{isOpen:K,onClose:W,onSave:Zr}),u&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"fixed inset-0 z-[999]",onClick:Fi,onContextMenu:he=>{he.preventDefault(),Fi()}}),M.jsx("div",{className:"fixed z-[1000] bg-panel border border-border shadow-lg rounded-[2px] py-1 min-w-[140px]",style:{left:u.x,top:u.y},children:M.jsx("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-[13px] text-red-400 bg-transparent border-0 cursor-pointer hover:bg-list-hover",onClick:zn,children:"デッキを削除"})})]})]}):M.jsx(Rw,{wsBase:dt})}class _S extends $.Component{constructor(i){super(i),this.handleReload=()=>{window.location.reload()},this.state={hasError:!1,error:null}}static getDerivedStateFromError(i){return{hasError:!0,error:i}}componentDidCatch(i,n){console.error("Application error:",i),console.error("Component stack:",n.componentStack)}render(){return this.state.hasError?M.jsx("div",{className:"flex items-center justify-center min-h-screen p-8 bg-bg",children:M.jsxs("div",{className:"max-w-[500px] p-8 bg-panel border border-border text-center",children:[M.jsx("h1",{className:"m-0 mb-4 text-xl text-[#f14c4c]",children:"Something went wrong"}),M.jsx("p",{className:"m-0 mb-6 text-muted",children:"The application encountered an unexpected error."}),this.state.error&&!1,M.jsx("button",{onClick:this.handleReload,className:"px-4 py-2 bg-accent text-white border-0 rounded-[2px] font-medium cursor-pointer hover:opacity-90",children:"Reload Application"})]})}):this.props.children}}zv.createRoot(document.getElementById("root")).render(M.jsx(ts.StrictMode,{children:M.jsx(_S,{children:M.jsx(pS,{})})}));