@adhdev/daemon-standalone 0.5.40 → 0.5.41

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,209 @@
1
+ var U1=Object.defineProperty;var V1=(e,t,r)=>t in e?U1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var js=(e,t,r)=>V1(e,typeof t!="symbol"?t+"":t,r);function K1(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var ha=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var F_={exports:{}},Ga={},W_={exports:{}},$e={};/**
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 Go=Symbol.for("react.element"),q1=Symbol.for("react.portal"),Y1=Symbol.for("react.fragment"),X1=Symbol.for("react.strict_mode"),G1=Symbol.for("react.profiler"),Q1=Symbol.for("react.provider"),J1=Symbol.for("react.context"),Z1=Symbol.for("react.forward_ref"),ew=Symbol.for("react.suspense"),tw=Symbol.for("react.memo"),rw=Symbol.for("react.lazy"),sp=Symbol.iterator;function nw(e){return e===null||typeof e!="object"?null:(e=sp&&e[sp]||e["@@iterator"],typeof e=="function"?e:null)}var H_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U_=Object.assign,V_={};function Cs(e,t,r){this.props=e,this.context=t,this.refs=V_,this.updater=r||H_}Cs.prototype.isReactComponent={};Cs.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Cs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function K_(){}K_.prototype=Cs.prototype;function Ld(e,t,r){this.props=e,this.context=t,this.refs=V_,this.updater=r||H_}var Rd=Ld.prototype=new K_;Rd.constructor=Ld;U_(Rd,Cs.prototype);Rd.isPureReactComponent=!0;var op=Array.isArray,q_=Object.prototype.hasOwnProperty,Md={current:null},Y_={key:!0,ref:!0,__self:!0,__source:!0};function X_(e,t,r){var n,i={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)q_.call(t,n)&&!Y_.hasOwnProperty(n)&&(i[n]=t[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){for(var a=Array(l),c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)i[n]===void 0&&(i[n]=l[n]);return{$$typeof:Go,type:e,key:s,ref:o,props:i,_owner:Md.current}}function iw(e,t){return{$$typeof:Go,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Id(e){return typeof e=="object"&&e!==null&&e.$$typeof===Go}function sw(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var lp=/\/+/g;function Ec(e,t){return typeof e=="object"&&e!==null&&e.key!=null?sw(""+e.key):t.toString(36)}function Fl(e,t,r,n,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Go:case q1:o=!0}}if(o)return o=e,i=i(o),e=n===""?"."+Ec(o,0):n,op(i)?(r="",e!=null&&(r=e.replace(lp,"$&/")+"/"),Fl(i,t,r,"",function(c){return c})):i!=null&&(Id(i)&&(i=iw(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(lp,"$&/")+"/")+e)),t.push(i)),1;if(o=0,n=n===""?".":n+":",op(e))for(var l=0;l<e.length;l++){s=e[l];var a=n+Ec(s,l);o+=Fl(s,t,r,a,i)}else if(a=nw(e),typeof a=="function")for(e=a.call(e),l=0;!(s=e.next()).done;)s=s.value,a=n+Ec(s,l++),o+=Fl(s,t,r,a,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function dl(e,t,r){if(e==null)return e;var n=[],i=0;return Fl(e,n,"","",function(s){return t.call(r,s,i++)}),n}function ow(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var tr={current:null},Wl={transition:null},lw={ReactCurrentDispatcher:tr,ReactCurrentBatchConfig:Wl,ReactCurrentOwner:Md};function G_(){throw Error("act(...) is not supported in production builds of React.")}$e.Children={map:dl,forEach:function(e,t,r){dl(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return dl(e,function(){t++}),t},toArray:function(e){return dl(e,function(t){return t})||[]},only:function(e){if(!Id(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};$e.Component=Cs;$e.Fragment=Y1;$e.Profiler=G1;$e.PureComponent=Ld;$e.StrictMode=X1;$e.Suspense=ew;$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lw;$e.act=G_;$e.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=U_({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Md.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)q_.call(t,a)&&!Y_.hasOwnProperty(a)&&(n[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)n.children=r;else if(1<a){l=Array(a);for(var c=0;c<a;c++)l[c]=arguments[c+2];n.children=l}return{$$typeof:Go,type:e.type,key:i,ref:s,props:n,_owner:o}};$e.createContext=function(e){return e={$$typeof:J1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Q1,_context:e},e.Consumer=e};$e.createElement=X_;$e.createFactory=function(e){var t=X_.bind(null,e);return t.type=e,t};$e.createRef=function(){return{current:null}};$e.forwardRef=function(e){return{$$typeof:Z1,render:e}};$e.isValidElement=Id;$e.lazy=function(e){return{$$typeof:rw,_payload:{_status:-1,_result:e},_init:ow}};$e.memo=function(e,t){return{$$typeof:tw,type:e,compare:t===void 0?null:t}};$e.startTransition=function(e){var t=Wl.transition;Wl.transition={};try{e()}finally{Wl.transition=t}};$e.unstable_act=G_;$e.useCallback=function(e,t){return tr.current.useCallback(e,t)};$e.useContext=function(e){return tr.current.useContext(e)};$e.useDebugValue=function(){};$e.useDeferredValue=function(e){return tr.current.useDeferredValue(e)};$e.useEffect=function(e,t){return tr.current.useEffect(e,t)};$e.useId=function(){return tr.current.useId()};$e.useImperativeHandle=function(e,t,r){return tr.current.useImperativeHandle(e,t,r)};$e.useInsertionEffect=function(e,t){return tr.current.useInsertionEffect(e,t)};$e.useLayoutEffect=function(e,t){return tr.current.useLayoutEffect(e,t)};$e.useMemo=function(e,t){return tr.current.useMemo(e,t)};$e.useReducer=function(e,t,r){return tr.current.useReducer(e,t,r)};$e.useRef=function(e){return tr.current.useRef(e)};$e.useState=function(e){return tr.current.useState(e)};$e.useSyncExternalStore=function(e,t,r){return tr.current.useSyncExternalStore(e,t,r)};$e.useTransition=function(){return tr.current.useTransition()};$e.version="18.3.1";W_.exports=$e;var x=W_.exports;const Q_=Pd(x),aw=K1({__proto__:null,default:Q_},[x]);/**
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 cw=x,uw=Symbol.for("react.element"),hw=Symbol.for("react.fragment"),dw=Object.prototype.hasOwnProperty,fw=cw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pw={key:!0,ref:!0,__self:!0,__source:!0};function J_(e,t,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)dw.call(t,n)&&!pw.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:uw,type:e,key:s,ref:o,props:i,_owner:fw.current}}Ga.Fragment=hw;Ga.jsx=J_;Ga.jsxs=J_;F_.exports=Ga;var h=F_.exports,Z_={exports:{}},Sr={},ev={exports:{}},tv={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(D,V){var w=D.length;D.push(V);e:for(;0<w;){var Z=w-1>>>1,oe=D[Z];if(0<i(oe,V))D[Z]=V,D[w]=oe,w=Z;else break e}}function r(D){return D.length===0?null:D[0]}function n(D){if(D.length===0)return null;var V=D[0],w=D.pop();if(w!==V){D[0]=w;e:for(var Z=0,oe=D.length,N=oe>>>1;Z<N;){var q=2*(Z+1)-1,I=D[q],$=q+1,Y=D[$];if(0>i(I,w))$<oe&&0>i(Y,I)?(D[Z]=Y,D[$]=w,Z=$):(D[Z]=I,D[q]=w,Z=q);else if($<oe&&0>i(Y,w))D[Z]=Y,D[$]=w,Z=$;else break e}}return V}function i(D,V){var w=D.sortIndex-V.sortIndex;return w!==0?w:D.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],c=[],d=1,u=null,f=3,p=!1,m=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(D){for(var V=r(c);V!==null;){if(V.callback===null)n(c);else if(V.startTime<=D)n(c),V.sortIndex=V.expirationTime,t(a,V);else break;V=r(c)}}function k(D){if(_=!1,y(D),!m)if(r(a)!==null)m=!0,A(L);else{var V=r(c);V!==null&&U(k,V.startTime-D)}}function L(D,V){m=!1,_&&(_=!1,g(T),T=-1),p=!0;var w=f;try{for(y(V),u=r(a);u!==null&&(!(u.expirationTime>V)||D&&!O());){var Z=u.callback;if(typeof Z=="function"){u.callback=null,f=u.priorityLevel;var oe=Z(u.expirationTime<=V);V=e.unstable_now(),typeof oe=="function"?u.callback=oe:u===r(a)&&n(a),y(V)}else n(a);u=r(a)}if(u!==null)var N=!0;else{var q=r(c);q!==null&&U(k,q.startTime-V),N=!1}return N}finally{u=null,f=w,p=!1}}var S=!1,j=null,T=-1,B=5,E=-1;function O(){return!(e.unstable_now()-E<B)}function R(){if(j!==null){var D=e.unstable_now();E=D;var V=!0;try{V=j(!0,D)}finally{V?C():(S=!1,j=null)}}else S=!1}var C;if(typeof v=="function")C=function(){v(R)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,z=P.port2;P.port1.onmessage=R,C=function(){z.postMessage(null)}}else C=function(){b(R,0)};function A(D){j=D,S||(S=!0,C())}function U(D,V){T=b(function(){D(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,A(L))},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(a)},e.unstable_next=function(D){switch(f){case 1:case 2:case 3:var V=3;break;default:V=f}var w=f;f=V;try{return D()}finally{f=w}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(D,V){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var w=f;f=D;try{return V()}finally{f=w}},e.unstable_scheduleCallback=function(D,V,w){var Z=e.unstable_now();switch(typeof w=="object"&&w!==null?(w=w.delay,w=typeof w=="number"&&0<w?Z+w:Z):w=Z,D){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=w+oe,D={id:d++,callback:V,priorityLevel:D,startTime:w,expirationTime:oe,sortIndex:-1},w>Z?(D.sortIndex=w,t(c,D),r(a)===null&&D===r(c)&&(_?(g(T),T=-1):_=!0,U(k,w-Z))):(D.sortIndex=oe,t(a,D),m||p||(m=!0,A(L))),D},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(D){var V=f;return function(){var w=f;f=V;try{return D.apply(this,arguments)}finally{f=w}}}})(tv);ev.exports=tv;var mw=ev.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 gw=x,br=mw;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var rv=new Set,ko={};function zi(e,t){gs(e,t),gs(e+"Capture",t)}function gs(e,t){for(ko[e]=t,e=0;e<t.length;e++)rv.add(t[e])}var wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Au=Object.prototype.hasOwnProperty,_w=/^[: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]*$/,ap={},cp={};function vw(e){return Au.call(cp,e)?!0:Au.call(ap,e)?!1:_w.test(e)?cp[e]=!0:(ap[e]=!0,!1)}function xw(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function yw(e,t,r,n){if(t===null||typeof t>"u"||xw(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function rr(e,t,r,n,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Ht={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ht[e]=new rr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ht[t]=new rr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ht[e]=new rr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ht[e]=new rr(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){Ht[e]=new rr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ht[e]=new rr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ht[e]=new rr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ht[e]=new rr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ht[e]=new rr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Dd=/[\-:]([a-z])/g;function jd(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(Dd,jd);Ht[t]=new rr(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(Dd,jd);Ht[t]=new rr(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(Dd,jd);Ht[t]=new rr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ht[e]=new rr(e,1,!1,e.toLowerCase(),null,!1,!1)});Ht.xlinkHref=new rr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ht[e]=new rr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ad(e,t,r,n){var i=Ht.hasOwnProperty(t)?Ht[t]:null;(i!==null?i.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(yw(t,r,i,n)&&(r=null),n||i===null?vw(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=r===null?i.type===3?!1:"":r:(t=i.attributeName,n=i.attributeNamespace,r===null?e.removeAttribute(t):(i=i.type,r=i===3||i===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var Cn=gw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,fl=Symbol.for("react.element"),Gi=Symbol.for("react.portal"),Qi=Symbol.for("react.fragment"),Bd=Symbol.for("react.strict_mode"),Bu=Symbol.for("react.profiler"),nv=Symbol.for("react.provider"),iv=Symbol.for("react.context"),Od=Symbol.for("react.forward_ref"),Ou=Symbol.for("react.suspense"),zu=Symbol.for("react.suspense_list"),zd=Symbol.for("react.memo"),On=Symbol.for("react.lazy"),sv=Symbol.for("react.offscreen"),up=Symbol.iterator;function As(e){return e===null||typeof e!="object"?null:(e=up&&e[up]||e["@@iterator"],typeof e=="function"?e:null)}var dt=Object.assign,Nc;function to(e){if(Nc===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Nc=t&&t[1]||""}return`
34
+ `+Nc+e}var Tc=!1;function Pc(e,t){if(!e||Tc)return"";Tc=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var n=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){n=c}e.call(t.prototype)}else{try{throw Error()}catch(c){n=c}e()}}catch(c){if(c&&n&&typeof c.stack=="string"){for(var i=c.stack.split(`
35
+ `),s=n.stack.split(`
36
+ `),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var a=`
37
+ `+i[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Tc=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?to(e):""}function ww(e){switch(e.tag){case 5:return to(e.type);case 16:return to("Lazy");case 13:return to("Suspense");case 19:return to("SuspenseList");case 0:case 2:case 15:return e=Pc(e.type,!1),e;case 11:return e=Pc(e.type.render,!1),e;case 1:return e=Pc(e.type,!0),e;default:return""}}function $u(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 Qi:return"Fragment";case Gi:return"Portal";case Bu:return"Profiler";case Bd:return"StrictMode";case Ou:return"Suspense";case zu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case iv:return(e.displayName||"Context")+".Consumer";case nv:return(e._context.displayName||"Context")+".Provider";case Od:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case zd:return t=e.displayName||null,t!==null?t:$u(e.type)||"Memo";case On:t=e._payload,e=e._init;try{return $u(e(t))}catch{}}return null}function bw(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 $u(t);case 8:return t===Bd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ri(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ov(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Sw(e){var t=ov(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function pl(e){e._valueTracker||(e._valueTracker=Sw(e))}function lv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=ov(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function da(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 Fu(e,t){var r=t.checked;return dt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function hp(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=ri(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function av(e,t){t=t.checked,t!=null&&Ad(e,"checked",t,!1)}function Wu(e,t){av(e,t);var r=ri(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Hu(e,t.type,r):t.hasOwnProperty("defaultValue")&&Hu(e,t.type,ri(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function dp(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Hu(e,t,r){(t!=="number"||da(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var ro=Array.isArray;function cs(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+ri(r),t=null,i=0;i<e.length;i++){if(e[i].value===r){e[i].selected=!0,n&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Uu(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return dt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function fp(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(te(92));if(ro(r)){if(1<r.length)throw Error(te(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:ri(r)}}function cv(e,t){var r=ri(t.value),n=ri(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function pp(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function uv(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 Vu(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?uv(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ml,hv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,i){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ml=ml||document.createElement("div"),ml.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ml.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Co(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var uo={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},kw=["Webkit","ms","Moz","O"];Object.keys(uo).forEach(function(e){kw.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),uo[t]=uo[e]})});function dv(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||uo.hasOwnProperty(e)&&uo[e]?(""+t).trim():t+"px"}function fv(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=dv(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var Cw=dt({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 Ku(e,t){if(t){if(Cw[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function qu(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 Yu=null;function $d(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xu=null,us=null,hs=null;function mp(e){if(e=Zo(e)){if(typeof Xu!="function")throw Error(te(280));var t=e.stateNode;t&&(t=tc(t),Xu(e.stateNode,e.type,t))}}function pv(e){us?hs?hs.push(e):hs=[e]:us=e}function mv(){if(us){var e=us,t=hs;if(hs=us=null,mp(e),t)for(e=0;e<t.length;e++)mp(t[e])}}function gv(e,t){return e(t)}function _v(){}var Lc=!1;function vv(e,t,r){if(Lc)return e(t,r);Lc=!0;try{return gv(e,t,r)}finally{Lc=!1,(us!==null||hs!==null)&&(_v(),mv())}}function Eo(e,t){var r=e.stateNode;if(r===null)return null;var n=tc(r);if(n===null)return null;r=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(te(231,t,typeof r));return r}var Gu=!1;if(wn)try{var Bs={};Object.defineProperty(Bs,"passive",{get:function(){Gu=!0}}),window.addEventListener("test",Bs,Bs),window.removeEventListener("test",Bs,Bs)}catch{Gu=!1}function Ew(e,t,r,n,i,s,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(d){this.onError(d)}}var ho=!1,fa=null,pa=!1,Qu=null,Nw={onError:function(e){ho=!0,fa=e}};function Tw(e,t,r,n,i,s,o,l,a){ho=!1,fa=null,Ew.apply(Nw,arguments)}function Pw(e,t,r,n,i,s,o,l,a){if(Tw.apply(this,arguments),ho){if(ho){var c=fa;ho=!1,fa=null}else throw Error(te(198));pa||(pa=!0,Qu=c)}}function $i(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function xv(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 gp(e){if($i(e)!==e)throw Error(te(188))}function Lw(e){var t=e.alternate;if(!t){if(t=$i(e),t===null)throw Error(te(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(i===null)break;var s=i.alternate;if(s===null){if(n=i.return,n!==null){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return gp(i),e;if(s===n)return gp(i),t;s=s.sibling}throw Error(te(188))}if(r.return!==n.return)r=i,n=s;else{for(var o=!1,l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o)throw Error(te(189))}}if(r.alternate!==n)throw Error(te(190))}if(r.tag!==3)throw Error(te(188));return r.stateNode.current===r?e:t}function yv(e){return e=Lw(e),e!==null?wv(e):null}function wv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=wv(e);if(t!==null)return t;e=e.sibling}return null}var bv=br.unstable_scheduleCallback,_p=br.unstable_cancelCallback,Rw=br.unstable_shouldYield,Mw=br.unstable_requestPaint,vt=br.unstable_now,Iw=br.unstable_getCurrentPriorityLevel,Fd=br.unstable_ImmediatePriority,Sv=br.unstable_UserBlockingPriority,ma=br.unstable_NormalPriority,Dw=br.unstable_LowPriority,kv=br.unstable_IdlePriority,Qa=null,nn=null;function jw(e){if(nn&&typeof nn.onCommitFiberRoot=="function")try{nn.onCommitFiberRoot(Qa,e,void 0,(e.current.flags&128)===128)}catch{}}var Ur=Math.clz32?Math.clz32:Ow,Aw=Math.log,Bw=Math.LN2;function Ow(e){return e>>>=0,e===0?32:31-(Aw(e)/Bw|0)|0}var gl=64,_l=4194304;function no(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 ga(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~i;l!==0?n=no(l):(s&=o,s!==0&&(n=no(s)))}else o=r&~i,o!==0?n=no(o):s!==0&&(n=no(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Ur(t),i=1<<r,n|=e[r],t&=~i;return n}function zw(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 $w(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Ur(s),l=1<<o,a=i[o];a===-1?(!(l&r)||l&n)&&(i[o]=zw(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function Ju(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Cv(){var e=gl;return gl<<=1,!(gl&4194240)&&(gl=64),e}function Rc(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Qo(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ur(t),e[t]=r}function Fw(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-Ur(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function Wd(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Ur(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var Ye=0;function Ev(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Nv,Hd,Tv,Pv,Lv,Zu=!1,vl=[],qn=null,Yn=null,Xn=null,No=new Map,To=new Map,Fn=[],Ww="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 vp(e,t){switch(e){case"focusin":case"focusout":qn=null;break;case"dragenter":case"dragleave":Yn=null;break;case"mouseover":case"mouseout":Xn=null;break;case"pointerover":case"pointerout":No.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":To.delete(t.pointerId)}}function Os(e,t,r,n,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},t!==null&&(t=Zo(t),t!==null&&Hd(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Hw(e,t,r,n,i){switch(t){case"focusin":return qn=Os(qn,e,t,r,n,i),!0;case"dragenter":return Yn=Os(Yn,e,t,r,n,i),!0;case"mouseover":return Xn=Os(Xn,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return No.set(s,Os(No.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,To.set(s,Os(To.get(s)||null,e,t,r,n,i)),!0}return!1}function Rv(e){var t=Si(e.target);if(t!==null){var r=$i(t);if(r!==null){if(t=r.tag,t===13){if(t=xv(r),t!==null){e.blockedOn=t,Lv(e.priority,function(){Tv(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Hl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=eh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);Yu=n,r.target.dispatchEvent(n),Yu=null}else return t=Zo(r),t!==null&&Hd(t),e.blockedOn=r,!1;t.shift()}return!0}function xp(e,t,r){Hl(e)&&r.delete(t)}function Uw(){Zu=!1,qn!==null&&Hl(qn)&&(qn=null),Yn!==null&&Hl(Yn)&&(Yn=null),Xn!==null&&Hl(Xn)&&(Xn=null),No.forEach(xp),To.forEach(xp)}function zs(e,t){e.blockedOn===t&&(e.blockedOn=null,Zu||(Zu=!0,br.unstable_scheduleCallback(br.unstable_NormalPriority,Uw)))}function Po(e){function t(i){return zs(i,e)}if(0<vl.length){zs(vl[0],e);for(var r=1;r<vl.length;r++){var n=vl[r];n.blockedOn===e&&(n.blockedOn=null)}}for(qn!==null&&zs(qn,e),Yn!==null&&zs(Yn,e),Xn!==null&&zs(Xn,e),No.forEach(t),To.forEach(t),r=0;r<Fn.length;r++)n=Fn[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Fn.length&&(r=Fn[0],r.blockedOn===null);)Rv(r),r.blockedOn===null&&Fn.shift()}var ds=Cn.ReactCurrentBatchConfig,_a=!0;function Vw(e,t,r,n){var i=Ye,s=ds.transition;ds.transition=null;try{Ye=1,Ud(e,t,r,n)}finally{Ye=i,ds.transition=s}}function Kw(e,t,r,n){var i=Ye,s=ds.transition;ds.transition=null;try{Ye=4,Ud(e,t,r,n)}finally{Ye=i,ds.transition=s}}function Ud(e,t,r,n){if(_a){var i=eh(e,t,r,n);if(i===null)Fc(e,t,n,va,r),vp(e,n);else if(Hw(i,e,t,r,n))n.stopPropagation();else if(vp(e,n),t&4&&-1<Ww.indexOf(e)){for(;i!==null;){var s=Zo(i);if(s!==null&&Nv(s),s=eh(e,t,r,n),s===null&&Fc(e,t,n,va,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else Fc(e,t,n,null,r)}}var va=null;function eh(e,t,r,n){if(va=null,e=$d(n),e=Si(e),e!==null)if(t=$i(e),t===null)e=null;else if(r=t.tag,r===13){if(e=xv(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return va=e,null}function Mv(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(Iw()){case Fd:return 1;case Sv:return 4;case ma:case Dw:return 16;case kv:return 536870912;default:return 16}default:return 16}}var Hn=null,Vd=null,Ul=null;function Iv(){if(Ul)return Ul;var e,t=Vd,r=t.length,n,i="value"in Hn?Hn.value:Hn.textContent,s=i.length;for(e=0;e<r&&t[e]===i[e];e++);var o=r-e;for(n=1;n<=o&&t[r-n]===i[s-n];n++);return Ul=i.slice(e,1<n?1-n:void 0)}function Vl(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 xl(){return!0}function yp(){return!1}function kr(e){function t(r,n,i,s,o){this._reactName=r,this._targetInst=i,this.type=n,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?xl:yp,this.isPropagationStopped=yp,this}return dt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=xl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=xl)},persist:function(){},isPersistent:xl}),t}var Es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Kd=kr(Es),Jo=dt({},Es,{view:0,detail:0}),qw=kr(Jo),Mc,Ic,$s,Ja=dt({},Jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qd,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!==$s&&($s&&e.type==="mousemove"?(Mc=e.screenX-$s.screenX,Ic=e.screenY-$s.screenY):Ic=Mc=0,$s=e),Mc)},movementY:function(e){return"movementY"in e?e.movementY:Ic}}),wp=kr(Ja),Yw=dt({},Ja,{dataTransfer:0}),Xw=kr(Yw),Gw=dt({},Jo,{relatedTarget:0}),Dc=kr(Gw),Qw=dt({},Es,{animationName:0,elapsedTime:0,pseudoElement:0}),Jw=kr(Qw),Zw=dt({},Es,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),eb=kr(Zw),tb=dt({},Es,{data:0}),bp=kr(tb),rb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nb={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"},ib={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ib[e])?!!t[e]:!1}function qd(){return sb}var ob=dt({},Jo,{key:function(e){if(e.key){var t=rb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Vl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?nb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qd,charCode:function(e){return e.type==="keypress"?Vl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Vl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),lb=kr(ob),ab=dt({},Ja,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sp=kr(ab),cb=dt({},Jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qd}),ub=kr(cb),hb=dt({},Es,{propertyName:0,elapsedTime:0,pseudoElement:0}),db=kr(hb),fb=dt({},Ja,{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}),pb=kr(fb),mb=[9,13,27,32],Yd=wn&&"CompositionEvent"in window,fo=null;wn&&"documentMode"in document&&(fo=document.documentMode);var gb=wn&&"TextEvent"in window&&!fo,Dv=wn&&(!Yd||fo&&8<fo&&11>=fo),kp=" ",Cp=!1;function jv(e,t){switch(e){case"keyup":return mb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Av(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ji=!1;function _b(e,t){switch(e){case"compositionend":return Av(t);case"keypress":return t.which!==32?null:(Cp=!0,kp);case"textInput":return e=t.data,e===kp&&Cp?null:e;default:return null}}function vb(e,t){if(Ji)return e==="compositionend"||!Yd&&jv(e,t)?(e=Iv(),Ul=Vd=Hn=null,Ji=!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 Dv&&t.locale!=="ko"?null:t.data;default:return null}}var xb={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 Ep(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!xb[e.type]:t==="textarea"}function Bv(e,t,r,n){pv(n),t=xa(t,"onChange"),0<t.length&&(r=new Kd("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var po=null,Lo=null;function yb(e){Yv(e,0)}function Za(e){var t=ts(e);if(lv(t))return e}function wb(e,t){if(e==="change")return t}var Ov=!1;if(wn){var jc;if(wn){var Ac="oninput"in document;if(!Ac){var Np=document.createElement("div");Np.setAttribute("oninput","return;"),Ac=typeof Np.oninput=="function"}jc=Ac}else jc=!1;Ov=jc&&(!document.documentMode||9<document.documentMode)}function Tp(){po&&(po.detachEvent("onpropertychange",zv),Lo=po=null)}function zv(e){if(e.propertyName==="value"&&Za(Lo)){var t=[];Bv(t,Lo,e,$d(e)),vv(yb,t)}}function bb(e,t,r){e==="focusin"?(Tp(),po=t,Lo=r,po.attachEvent("onpropertychange",zv)):e==="focusout"&&Tp()}function Sb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Za(Lo)}function kb(e,t){if(e==="click")return Za(t)}function Cb(e,t){if(e==="input"||e==="change")return Za(t)}function Eb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qr=typeof Object.is=="function"?Object.is:Eb;function Ro(e,t){if(qr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!Au.call(t,i)||!qr(e[i],t[i]))return!1}return!0}function Pp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lp(e,t){var r=Pp(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Pp(r)}}function $v(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$v(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fv(){for(var e=window,t=da();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=da(e.document)}return t}function Xd(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 Nb(e){var t=Fv(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&$v(r.ownerDocument.documentElement,r)){if(n!==null&&Xd(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=Lp(r,s);var o=Lp(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Tb=wn&&"documentMode"in document&&11>=document.documentMode,Zi=null,th=null,mo=null,rh=!1;function Rp(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;rh||Zi==null||Zi!==da(n)||(n=Zi,"selectionStart"in n&&Xd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),mo&&Ro(mo,n)||(mo=n,n=xa(th,"onSelect"),0<n.length&&(t=new Kd("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Zi)))}function yl(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var es={animationend:yl("Animation","AnimationEnd"),animationiteration:yl("Animation","AnimationIteration"),animationstart:yl("Animation","AnimationStart"),transitionend:yl("Transition","TransitionEnd")},Bc={},Wv={};wn&&(Wv=document.createElement("div").style,"AnimationEvent"in window||(delete es.animationend.animation,delete es.animationiteration.animation,delete es.animationstart.animation),"TransitionEvent"in window||delete es.transitionend.transition);function ec(e){if(Bc[e])return Bc[e];if(!es[e])return e;var t=es[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in Wv)return Bc[e]=t[r];return e}var Hv=ec("animationend"),Uv=ec("animationiteration"),Vv=ec("animationstart"),Kv=ec("transitionend"),qv=new Map,Mp="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 si(e,t){qv.set(e,t),zi(t,[e])}for(var Oc=0;Oc<Mp.length;Oc++){var zc=Mp[Oc],Pb=zc.toLowerCase(),Lb=zc[0].toUpperCase()+zc.slice(1);si(Pb,"on"+Lb)}si(Hv,"onAnimationEnd");si(Uv,"onAnimationIteration");si(Vv,"onAnimationStart");si("dblclick","onDoubleClick");si("focusin","onFocus");si("focusout","onBlur");si(Kv,"onTransitionEnd");gs("onMouseEnter",["mouseout","mouseover"]);gs("onMouseLeave",["mouseout","mouseover"]);gs("onPointerEnter",["pointerout","pointerover"]);gs("onPointerLeave",["pointerout","pointerover"]);zi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));zi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));zi("onBeforeInput",["compositionend","keypress","textInput","paste"]);zi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));zi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));zi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var io="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(" "),Rb=new Set("cancel close invalid load scroll toggle".split(" ").concat(io));function Ip(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,Pw(n,t,void 0,e),e.currentTarget=null}function Yv(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var s=void 0;if(t)for(var o=n.length-1;0<=o;o--){var l=n[o],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==s&&i.isPropagationStopped())break e;Ip(i,l,c),s=a}else for(o=0;o<n.length;o++){if(l=n[o],a=l.instance,c=l.currentTarget,l=l.listener,a!==s&&i.isPropagationStopped())break e;Ip(i,l,c),s=a}}}if(pa)throw e=Qu,pa=!1,Qu=null,e}function rt(e,t){var r=t[lh];r===void 0&&(r=t[lh]=new Set);var n=e+"__bubble";r.has(n)||(Xv(t,e,2,!1),r.add(n))}function $c(e,t,r){var n=0;t&&(n|=4),Xv(r,e,n,t)}var wl="_reactListening"+Math.random().toString(36).slice(2);function Mo(e){if(!e[wl]){e[wl]=!0,rv.forEach(function(r){r!=="selectionchange"&&(Rb.has(r)||$c(r,!1,e),$c(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wl]||(t[wl]=!0,$c("selectionchange",!1,t))}}function Xv(e,t,r,n){switch(Mv(t)){case 1:var i=Vw;break;case 4:i=Kw;break;default:i=Ud}r=i.bind(null,t,r,e),i=void 0,!Gu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),n?i!==void 0?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):i!==void 0?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function Fc(e,t,r,n,i){var s=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=n.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===i||a.nodeType===8&&a.parentNode===i))return;o=o.return}for(;l!==null;){if(o=Si(l),o===null)return;if(a=o.tag,a===5||a===6){n=s=o;continue e}l=l.parentNode}}n=n.return}vv(function(){var c=s,d=$d(r),u=[];e:{var f=qv.get(e);if(f!==void 0){var p=Kd,m=e;switch(e){case"keypress":if(Vl(r)===0)break e;case"keydown":case"keyup":p=lb;break;case"focusin":m="focus",p=Dc;break;case"focusout":m="blur",p=Dc;break;case"beforeblur":case"afterblur":p=Dc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=wp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Xw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=ub;break;case Hv:case Uv:case Vv:p=Jw;break;case Kv:p=db;break;case"scroll":p=qw;break;case"wheel":p=pb;break;case"copy":case"cut":case"paste":p=eb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Sp}var _=(t&4)!==0,b=!_&&e==="scroll",g=_?f!==null?f+"Capture":null:f;_=[];for(var v=c,y;v!==null;){y=v;var k=y.stateNode;if(y.tag===5&&k!==null&&(y=k,g!==null&&(k=Eo(v,g),k!=null&&_.push(Io(v,k,y)))),b)break;v=v.return}0<_.length&&(f=new p(f,m,null,r,d),u.push({event:f,listeners:_}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==Yu&&(m=r.relatedTarget||r.fromElement)&&(Si(m)||m[bn]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=c,m=m?Si(m):null,m!==null&&(b=$i(m),m!==b||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(_=wp,k="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(_=Sp,k="onPointerLeave",g="onPointerEnter",v="pointer"),b=p==null?f:ts(p),y=m==null?f:ts(m),f=new _(k,v+"leave",p,r,d),f.target=b,f.relatedTarget=y,k=null,Si(d)===c&&(_=new _(g,v+"enter",m,r,d),_.target=y,_.relatedTarget=b,k=_),b=k,p&&m)t:{for(_=p,g=m,v=0,y=_;y;y=Ui(y))v++;for(y=0,k=g;k;k=Ui(k))y++;for(;0<v-y;)_=Ui(_),v--;for(;0<y-v;)g=Ui(g),y--;for(;v--;){if(_===g||g!==null&&_===g.alternate)break t;_=Ui(_),g=Ui(g)}_=null}else _=null;p!==null&&Dp(u,f,p,_,!1),m!==null&&b!==null&&Dp(u,b,m,_,!0)}}e:{if(f=c?ts(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var L=wb;else if(Ep(f))if(Ov)L=Cb;else{L=Sb;var S=bb}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(L=kb);if(L&&(L=L(e,c))){Bv(u,L,r,d);break e}S&&S(e,f,c),e==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&Hu(f,"number",f.value)}switch(S=c?ts(c):window,e){case"focusin":(Ep(S)||S.contentEditable==="true")&&(Zi=S,th=c,mo=null);break;case"focusout":mo=th=Zi=null;break;case"mousedown":rh=!0;break;case"contextmenu":case"mouseup":case"dragend":rh=!1,Rp(u,r,d);break;case"selectionchange":if(Tb)break;case"keydown":case"keyup":Rp(u,r,d)}var j;if(Yd)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Ji?jv(e,r)&&(T="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(T="onCompositionStart");T&&(Dv&&r.locale!=="ko"&&(Ji||T!=="onCompositionStart"?T==="onCompositionEnd"&&Ji&&(j=Iv()):(Hn=d,Vd="value"in Hn?Hn.value:Hn.textContent,Ji=!0)),S=xa(c,T),0<S.length&&(T=new bp(T,e,null,r,d),u.push({event:T,listeners:S}),j?T.data=j:(j=Av(r),j!==null&&(T.data=j)))),(j=gb?_b(e,r):vb(e,r))&&(c=xa(c,"onBeforeInput"),0<c.length&&(d=new bp("onBeforeInput","beforeinput",null,r,d),u.push({event:d,listeners:c}),d.data=j))}Yv(u,t)})}function Io(e,t,r){return{instance:e,listener:t,currentTarget:r}}function xa(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Eo(e,r),s!=null&&n.unshift(Io(e,s,i)),s=Eo(e,t),s!=null&&n.push(Io(e,s,i))),e=e.return}return n}function Ui(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Dp(e,t,r,n,i){for(var s=t._reactName,o=[];r!==null&&r!==n;){var l=r,a=l.alternate,c=l.stateNode;if(a!==null&&a===n)break;l.tag===5&&c!==null&&(l=c,i?(a=Eo(r,s),a!=null&&o.unshift(Io(r,a,l))):i||(a=Eo(r,s),a!=null&&o.push(Io(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var Mb=/\r\n?/g,Ib=/\u0000|\uFFFD/g;function jp(e){return(typeof e=="string"?e:""+e).replace(Mb,`
38
+ `).replace(Ib,"")}function bl(e,t,r){if(t=jp(t),jp(e)!==t&&r)throw Error(te(425))}function ya(){}var nh=null,ih=null;function sh(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 oh=typeof setTimeout=="function"?setTimeout:void 0,Db=typeof clearTimeout=="function"?clearTimeout:void 0,Ap=typeof Promise=="function"?Promise:void 0,jb=typeof queueMicrotask=="function"?queueMicrotask:typeof Ap<"u"?function(e){return Ap.resolve(null).then(e).catch(Ab)}:oh;function Ab(e){setTimeout(function(){throw e})}function Wc(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(n===0){e.removeChild(i),Po(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);Po(t)}function Gn(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 Bp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Ns=Math.random().toString(36).slice(2),tn="__reactFiber$"+Ns,Do="__reactProps$"+Ns,bn="__reactContainer$"+Ns,lh="__reactEvents$"+Ns,Bb="__reactListeners$"+Ns,Ob="__reactHandles$"+Ns;function Si(e){var t=e[tn];if(t)return t;for(var r=e.parentNode;r;){if(t=r[bn]||r[tn]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Bp(e);e!==null;){if(r=e[tn])return r;e=Bp(e)}return t}e=r,r=e.parentNode}return null}function Zo(e){return e=e[tn]||e[bn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ts(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function tc(e){return e[Do]||null}var ah=[],rs=-1;function oi(e){return{current:e}}function it(e){0>rs||(e.current=ah[rs],ah[rs]=null,rs--)}function tt(e,t){rs++,ah[rs]=e.current,e.current=t}var ni={},Xt=oi(ni),cr=oi(!1),Ri=ni;function _s(e,t){var r=e.type.contextTypes;if(!r)return ni;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ur(e){return e=e.childContextTypes,e!=null}function wa(){it(cr),it(Xt)}function Op(e,t,r){if(Xt.current!==ni)throw Error(te(168));tt(Xt,t),tt(cr,r)}function Gv(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(te(108,bw(e)||"Unknown",i));return dt({},r,n)}function ba(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ni,Ri=Xt.current,tt(Xt,e),tt(cr,cr.current),!0}function zp(e,t,r){var n=e.stateNode;if(!n)throw Error(te(169));r?(e=Gv(e,t,Ri),n.__reactInternalMemoizedMergedChildContext=e,it(cr),it(Xt),tt(Xt,e)):it(cr),tt(cr,r)}var pn=null,rc=!1,Hc=!1;function Qv(e){pn===null?pn=[e]:pn.push(e)}function zb(e){rc=!0,Qv(e)}function li(){if(!Hc&&pn!==null){Hc=!0;var e=0,t=Ye;try{var r=pn;for(Ye=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}pn=null,rc=!1}catch(i){throw pn!==null&&(pn=pn.slice(e+1)),bv(Fd,li),i}finally{Ye=t,Hc=!1}}return null}var ns=[],is=0,Sa=null,ka=0,Pr=[],Lr=0,Mi=null,_n=1,vn="";function vi(e,t){ns[is++]=ka,ns[is++]=Sa,Sa=e,ka=t}function Jv(e,t,r){Pr[Lr++]=_n,Pr[Lr++]=vn,Pr[Lr++]=Mi,Mi=e;var n=_n;e=vn;var i=32-Ur(n)-1;n&=~(1<<i),r+=1;var s=32-Ur(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,_n=1<<32-Ur(t)+i|r<<i|n,vn=s+e}else _n=1<<s|r<<i|n,vn=e}function Gd(e){e.return!==null&&(vi(e,1),Jv(e,1,0))}function Qd(e){for(;e===Sa;)Sa=ns[--is],ns[is]=null,ka=ns[--is],ns[is]=null;for(;e===Mi;)Mi=Pr[--Lr],Pr[Lr]=null,vn=Pr[--Lr],Pr[Lr]=null,_n=Pr[--Lr],Pr[Lr]=null}var yr=null,xr=null,st=!1,Hr=null;function Zv(e,t){var r=Ir(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function $p(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,yr=e,xr=Gn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,yr=e,xr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Mi!==null?{id:_n,overflow:vn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Ir(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,yr=e,xr=null,!0):!1;default:return!1}}function ch(e){return(e.mode&1)!==0&&(e.flags&128)===0}function uh(e){if(st){var t=xr;if(t){var r=t;if(!$p(e,t)){if(ch(e))throw Error(te(418));t=Gn(r.nextSibling);var n=yr;t&&$p(e,t)?Zv(n,r):(e.flags=e.flags&-4097|2,st=!1,yr=e)}}else{if(ch(e))throw Error(te(418));e.flags=e.flags&-4097|2,st=!1,yr=e}}}function Fp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;yr=e}function Sl(e){if(e!==yr)return!1;if(!st)return Fp(e),st=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!sh(e.type,e.memoizedProps)),t&&(t=xr)){if(ch(e))throw e0(),Error(te(418));for(;t;)Zv(e,t),t=Gn(t.nextSibling)}if(Fp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){xr=Gn(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}xr=null}}else xr=yr?Gn(e.stateNode.nextSibling):null;return!0}function e0(){for(var e=xr;e;)e=Gn(e.nextSibling)}function vs(){xr=yr=null,st=!1}function Jd(e){Hr===null?Hr=[e]:Hr.push(e)}var $b=Cn.ReactCurrentBatchConfig;function Fs(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(te(309));var n=r.stateNode}if(!n)throw Error(te(147,e));var i=n,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(te(284));if(!r._owner)throw Error(te(290,e))}return e}function kl(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Wp(e){var t=e._init;return t(e._payload)}function t0(e){function t(g,v){if(e){var y=g.deletions;y===null?(g.deletions=[v],g.flags|=16):y.push(v)}}function r(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function n(g,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function i(g,v){return g=ei(g,v),g.index=0,g.sibling=null,g}function s(g,v,y){return g.index=y,e?(y=g.alternate,y!==null?(y=y.index,y<v?(g.flags|=2,v):y):(g.flags|=2,v)):(g.flags|=1048576,v)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,v,y,k){return v===null||v.tag!==6?(v=Gc(y,g.mode,k),v.return=g,v):(v=i(v,y),v.return=g,v)}function a(g,v,y,k){var L=y.type;return L===Qi?d(g,v,y.props.children,k,y.key):v!==null&&(v.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===On&&Wp(L)===v.type)?(k=i(v,y.props),k.ref=Fs(g,v,y),k.return=g,k):(k=Jl(y.type,y.key,y.props,null,g.mode,k),k.ref=Fs(g,v,y),k.return=g,k)}function c(g,v,y,k){return v===null||v.tag!==4||v.stateNode.containerInfo!==y.containerInfo||v.stateNode.implementation!==y.implementation?(v=Qc(y,g.mode,k),v.return=g,v):(v=i(v,y.children||[]),v.return=g,v)}function d(g,v,y,k,L){return v===null||v.tag!==7?(v=Ti(y,g.mode,k,L),v.return=g,v):(v=i(v,y),v.return=g,v)}function u(g,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Gc(""+v,g.mode,y),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case fl:return y=Jl(v.type,v.key,v.props,null,g.mode,y),y.ref=Fs(g,null,v),y.return=g,y;case Gi:return v=Qc(v,g.mode,y),v.return=g,v;case On:var k=v._init;return u(g,k(v._payload),y)}if(ro(v)||As(v))return v=Ti(v,g.mode,y,null),v.return=g,v;kl(g,v)}return null}function f(g,v,y,k){var L=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return L!==null?null:l(g,v,""+y,k);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case fl:return y.key===L?a(g,v,y,k):null;case Gi:return y.key===L?c(g,v,y,k):null;case On:return L=y._init,f(g,v,L(y._payload),k)}if(ro(y)||As(y))return L!==null?null:d(g,v,y,k,null);kl(g,y)}return null}function p(g,v,y,k,L){if(typeof k=="string"&&k!==""||typeof k=="number")return g=g.get(y)||null,l(v,g,""+k,L);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case fl:return g=g.get(k.key===null?y:k.key)||null,a(v,g,k,L);case Gi:return g=g.get(k.key===null?y:k.key)||null,c(v,g,k,L);case On:var S=k._init;return p(g,v,y,S(k._payload),L)}if(ro(k)||As(k))return g=g.get(y)||null,d(v,g,k,L,null);kl(v,k)}return null}function m(g,v,y,k){for(var L=null,S=null,j=v,T=v=0,B=null;j!==null&&T<y.length;T++){j.index>T?(B=j,j=null):B=j.sibling;var E=f(g,j,y[T],k);if(E===null){j===null&&(j=B);break}e&&j&&E.alternate===null&&t(g,j),v=s(E,v,T),S===null?L=E:S.sibling=E,S=E,j=B}if(T===y.length)return r(g,j),st&&vi(g,T),L;if(j===null){for(;T<y.length;T++)j=u(g,y[T],k),j!==null&&(v=s(j,v,T),S===null?L=j:S.sibling=j,S=j);return st&&vi(g,T),L}for(j=n(g,j);T<y.length;T++)B=p(j,g,T,y[T],k),B!==null&&(e&&B.alternate!==null&&j.delete(B.key===null?T:B.key),v=s(B,v,T),S===null?L=B:S.sibling=B,S=B);return e&&j.forEach(function(O){return t(g,O)}),st&&vi(g,T),L}function _(g,v,y,k){var L=As(y);if(typeof L!="function")throw Error(te(150));if(y=L.call(y),y==null)throw Error(te(151));for(var S=L=null,j=v,T=v=0,B=null,E=y.next();j!==null&&!E.done;T++,E=y.next()){j.index>T?(B=j,j=null):B=j.sibling;var O=f(g,j,E.value,k);if(O===null){j===null&&(j=B);break}e&&j&&O.alternate===null&&t(g,j),v=s(O,v,T),S===null?L=O:S.sibling=O,S=O,j=B}if(E.done)return r(g,j),st&&vi(g,T),L;if(j===null){for(;!E.done;T++,E=y.next())E=u(g,E.value,k),E!==null&&(v=s(E,v,T),S===null?L=E:S.sibling=E,S=E);return st&&vi(g,T),L}for(j=n(g,j);!E.done;T++,E=y.next())E=p(j,g,T,E.value,k),E!==null&&(e&&E.alternate!==null&&j.delete(E.key===null?T:E.key),v=s(E,v,T),S===null?L=E:S.sibling=E,S=E);return e&&j.forEach(function(R){return t(g,R)}),st&&vi(g,T),L}function b(g,v,y,k){if(typeof y=="object"&&y!==null&&y.type===Qi&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case fl:e:{for(var L=y.key,S=v;S!==null;){if(S.key===L){if(L=y.type,L===Qi){if(S.tag===7){r(g,S.sibling),v=i(S,y.props.children),v.return=g,g=v;break e}}else if(S.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===On&&Wp(L)===S.type){r(g,S.sibling),v=i(S,y.props),v.ref=Fs(g,S,y),v.return=g,g=v;break e}r(g,S);break}else t(g,S);S=S.sibling}y.type===Qi?(v=Ti(y.props.children,g.mode,k,y.key),v.return=g,g=v):(k=Jl(y.type,y.key,y.props,null,g.mode,k),k.ref=Fs(g,v,y),k.return=g,g=k)}return o(g);case Gi:e:{for(S=y.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){r(g,v.sibling),v=i(v,y.children||[]),v.return=g,g=v;break e}else{r(g,v);break}else t(g,v);v=v.sibling}v=Qc(y,g.mode,k),v.return=g,g=v}return o(g);case On:return S=y._init,b(g,v,S(y._payload),k)}if(ro(y))return m(g,v,y,k);if(As(y))return _(g,v,y,k);kl(g,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(r(g,v.sibling),v=i(v,y),v.return=g,g=v):(r(g,v),v=Gc(y,g.mode,k),v.return=g,g=v),o(g)):r(g,v)}return b}var xs=t0(!0),r0=t0(!1),Ca=oi(null),Ea=null,ss=null,Zd=null;function ef(){Zd=ss=Ea=null}function tf(e){var t=Ca.current;it(Ca),e._currentValue=t}function hh(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function fs(e,t){Ea=e,Zd=ss=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ar=!0),e.firstContext=null)}function Ar(e){var t=e._currentValue;if(Zd!==e)if(e={context:e,memoizedValue:t,next:null},ss===null){if(Ea===null)throw Error(te(308));ss=e,Ea.dependencies={lanes:0,firstContext:e}}else ss=ss.next=e;return t}var ki=null;function rf(e){ki===null?ki=[e]:ki.push(e)}function n0(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,rf(t)):(r.next=i.next,i.next=r),t.interleaved=r,Sn(e,n)}function Sn(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var zn=!1;function nf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function i0(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 yn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Qn(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Ve&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,Sn(e,r)}return i=n.interleaved,i===null?(t.next=t,rf(n)):(t.next=i.next,i.next=t),n.interleaved=t,Sn(e,r)}function Kl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Wd(e,r)}}function Hp(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=t:s=s.next=t}else i=s=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Na(e,t,r,n){var i=e.updateQueue;zn=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var a=l,c=a.next;a.next=null,o===null?s=c:o.next=c,o=a;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=c:l.next=c,d.lastBaseUpdate=a))}if(s!==null){var u=i.baseState;o=0,d=c=a=null,l=s;do{var f=l.lane,p=l.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,_=l;switch(f=t,p=r,_.tag){case 1:if(m=_.payload,typeof m=="function"){u=m.call(p,u,f);break e}u=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=_.payload,f=typeof m=="function"?m.call(p,u,f):m,f==null)break e;u=dt({},u,f);break e;case 2:zn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(c=d=p,a=u):d=d.next=p,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(a=u),i.baseState=a,i.firstBaseUpdate=c,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Di|=o,e.lanes=o,e.memoizedState=u}}function Up(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(i!==null){if(n.callback=null,n=r,typeof i!="function")throw Error(te(191,i));i.call(n)}}}var el={},sn=oi(el),jo=oi(el),Ao=oi(el);function Ci(e){if(e===el)throw Error(te(174));return e}function sf(e,t){switch(tt(Ao,t),tt(jo,e),tt(sn,el),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Vu(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Vu(t,e)}it(sn),tt(sn,t)}function ys(){it(sn),it(jo),it(Ao)}function s0(e){Ci(Ao.current);var t=Ci(sn.current),r=Vu(t,e.type);t!==r&&(tt(jo,e),tt(sn,r))}function of(e){jo.current===e&&(it(sn),it(jo))}var ut=oi(0);function Ta(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Uc=[];function lf(){for(var e=0;e<Uc.length;e++)Uc[e]._workInProgressVersionPrimary=null;Uc.length=0}var ql=Cn.ReactCurrentDispatcher,Vc=Cn.ReactCurrentBatchConfig,Ii=0,ht=null,Nt=null,Mt=null,Pa=!1,go=!1,Bo=0,Fb=0;function Ut(){throw Error(te(321))}function af(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!qr(e[r],t[r]))return!1;return!0}function cf(e,t,r,n,i,s){if(Ii=s,ht=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ql.current=e===null||e.memoizedState===null?Vb:Kb,e=r(n,i),go){s=0;do{if(go=!1,Bo=0,25<=s)throw Error(te(301));s+=1,Mt=Nt=null,t.updateQueue=null,ql.current=qb,e=r(n,i)}while(go)}if(ql.current=La,t=Nt!==null&&Nt.next!==null,Ii=0,Mt=Nt=ht=null,Pa=!1,t)throw Error(te(300));return e}function uf(){var e=Bo!==0;return Bo=0,e}function Zr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?ht.memoizedState=Mt=e:Mt=Mt.next=e,Mt}function Br(){if(Nt===null){var e=ht.alternate;e=e!==null?e.memoizedState:null}else e=Nt.next;var t=Mt===null?ht.memoizedState:Mt.next;if(t!==null)Mt=t,Nt=e;else{if(e===null)throw Error(te(310));Nt=e,e={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},Mt===null?ht.memoizedState=Mt=e:Mt=Mt.next=e}return Mt}function Oo(e,t){return typeof t=="function"?t(e):t}function Kc(e){var t=Br(),r=t.queue;if(r===null)throw Error(te(311));r.lastRenderedReducer=e;var n=Nt,i=n.baseQueue,s=r.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}n.baseQueue=i=s,r.pending=null}if(i!==null){s=i.next,n=n.baseState;var l=o=null,a=null,c=s;do{var d=c.lane;if((Ii&d)===d)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),n=c.hasEagerState?c.eagerState:e(n,c.action);else{var u={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=u,o=n):a=a.next=u,ht.lanes|=d,Di|=d}c=c.next}while(c!==null&&c!==s);a===null?o=n:a.next=l,qr(n,t.memoizedState)||(ar=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=a,r.lastRenderedState=n}if(e=r.interleaved,e!==null){i=e;do s=i.lane,ht.lanes|=s,Di|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function qc(e){var t=Br(),r=t.queue;if(r===null)throw Error(te(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,s=t.memoizedState;if(i!==null){r.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);qr(s,t.memoizedState)||(ar=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function o0(){}function l0(e,t){var r=ht,n=Br(),i=t(),s=!qr(n.memoizedState,i);if(s&&(n.memoizedState=i,ar=!0),n=n.queue,hf(u0.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||Mt!==null&&Mt.memoizedState.tag&1){if(r.flags|=2048,zo(9,c0.bind(null,r,n,i,t),void 0,null),At===null)throw Error(te(349));Ii&30||a0(r,t,i)}return i}function a0(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ht.updateQueue,t===null?(t={lastEffect:null,stores:null},ht.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function c0(e,t,r,n){t.value=r,t.getSnapshot=n,h0(t)&&d0(e)}function u0(e,t,r){return r(function(){h0(t)&&d0(e)})}function h0(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!qr(e,r)}catch{return!0}}function d0(e){var t=Sn(e,1);t!==null&&Vr(t,e,1,-1)}function Vp(e){var t=Zr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:e},t.queue=e,e=e.dispatch=Ub.bind(null,ht,e),[t.memoizedState,e]}function zo(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ht.updateQueue,t===null?(t={lastEffect:null,stores:null},ht.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function f0(){return Br().memoizedState}function Yl(e,t,r,n){var i=Zr();ht.flags|=e,i.memoizedState=zo(1|t,r,void 0,n===void 0?null:n)}function nc(e,t,r,n){var i=Br();n=n===void 0?null:n;var s=void 0;if(Nt!==null){var o=Nt.memoizedState;if(s=o.destroy,n!==null&&af(n,o.deps)){i.memoizedState=zo(t,r,s,n);return}}ht.flags|=e,i.memoizedState=zo(1|t,r,s,n)}function Kp(e,t){return Yl(8390656,8,e,t)}function hf(e,t){return nc(2048,8,e,t)}function p0(e,t){return nc(4,2,e,t)}function m0(e,t){return nc(4,4,e,t)}function g0(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 _0(e,t,r){return r=r!=null?r.concat([e]):null,nc(4,4,g0.bind(null,t,e),r)}function df(){}function v0(e,t){var r=Br();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&af(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function x0(e,t){var r=Br();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&af(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function y0(e,t,r){return Ii&21?(qr(r,t)||(r=Cv(),ht.lanes|=r,Di|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ar=!0),e.memoizedState=r)}function Wb(e,t){var r=Ye;Ye=r!==0&&4>r?r:4,e(!0);var n=Vc.transition;Vc.transition={};try{e(!1),t()}finally{Ye=r,Vc.transition=n}}function w0(){return Br().memoizedState}function Hb(e,t,r){var n=Zn(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},b0(e))S0(t,r);else if(r=n0(e,t,r,n),r!==null){var i=er();Vr(r,e,n,i),k0(r,t,n)}}function Ub(e,t,r){var n=Zn(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(b0(e))S0(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,r);if(i.hasEagerState=!0,i.eagerState=l,qr(l,o)){var a=t.interleaved;a===null?(i.next=i,rf(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}r=n0(e,t,i,n),r!==null&&(i=er(),Vr(r,e,n,i),k0(r,t,n))}}function b0(e){var t=e.alternate;return e===ht||t!==null&&t===ht}function S0(e,t){go=Pa=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function k0(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Wd(e,r)}}var La={readContext:Ar,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},Vb={readContext:Ar,useCallback:function(e,t){return Zr().memoizedState=[e,t===void 0?null:t],e},useContext:Ar,useEffect:Kp,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Yl(4194308,4,g0.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Yl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Yl(4,2,e,t)},useMemo:function(e,t){var r=Zr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Zr();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=Hb.bind(null,ht,e),[n.memoizedState,e]},useRef:function(e){var t=Zr();return e={current:e},t.memoizedState=e},useState:Vp,useDebugValue:df,useDeferredValue:function(e){return Zr().memoizedState=e},useTransition:function(){var e=Vp(!1),t=e[0];return e=Wb.bind(null,e[1]),Zr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ht,i=Zr();if(st){if(r===void 0)throw Error(te(407));r=r()}else{if(r=t(),At===null)throw Error(te(349));Ii&30||a0(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Kp(u0.bind(null,n,s,e),[e]),n.flags|=2048,zo(9,c0.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=Zr(),t=At.identifierPrefix;if(st){var r=vn,n=_n;r=(n&~(1<<32-Ur(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Bo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=Fb++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Kb={readContext:Ar,useCallback:v0,useContext:Ar,useEffect:hf,useImperativeHandle:_0,useInsertionEffect:p0,useLayoutEffect:m0,useMemo:x0,useReducer:Kc,useRef:f0,useState:function(){return Kc(Oo)},useDebugValue:df,useDeferredValue:function(e){var t=Br();return y0(t,Nt.memoizedState,e)},useTransition:function(){var e=Kc(Oo)[0],t=Br().memoizedState;return[e,t]},useMutableSource:o0,useSyncExternalStore:l0,useId:w0,unstable_isNewReconciler:!1},qb={readContext:Ar,useCallback:v0,useContext:Ar,useEffect:hf,useImperativeHandle:_0,useInsertionEffect:p0,useLayoutEffect:m0,useMemo:x0,useReducer:qc,useRef:f0,useState:function(){return qc(Oo)},useDebugValue:df,useDeferredValue:function(e){var t=Br();return Nt===null?t.memoizedState=e:y0(t,Nt.memoizedState,e)},useTransition:function(){var e=qc(Oo)[0],t=Br().memoizedState;return[e,t]},useMutableSource:o0,useSyncExternalStore:l0,useId:w0,unstable_isNewReconciler:!1};function Fr(e,t){if(e&&e.defaultProps){t=dt({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function dh(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:dt({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var ic={isMounted:function(e){return(e=e._reactInternals)?$i(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=er(),i=Zn(e),s=yn(n,i);s.payload=t,r!=null&&(s.callback=r),t=Qn(e,s,i),t!==null&&(Vr(t,e,i,n),Kl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=er(),i=Zn(e),s=yn(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=Qn(e,s,i),t!==null&&(Vr(t,e,i,n),Kl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=er(),n=Zn(e),i=yn(r,n);i.tag=2,t!=null&&(i.callback=t),t=Qn(e,i,n),t!==null&&(Vr(t,e,n,r),Kl(t,e,n))}};function qp(e,t,r,n,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,o):t.prototype&&t.prototype.isPureReactComponent?!Ro(r,n)||!Ro(i,s):!0}function C0(e,t,r){var n=!1,i=ni,s=t.contextType;return typeof s=="object"&&s!==null?s=Ar(s):(i=ur(t)?Ri:Xt.current,n=t.contextTypes,s=(n=n!=null)?_s(e,i):ni),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ic,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Yp(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&ic.enqueueReplaceState(t,t.state,null)}function fh(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},nf(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Ar(s):(s=ur(t)?Ri:Xt.current,i.context=_s(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(dh(e,t,s,r),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&ic.enqueueReplaceState(i,i.state,null),Na(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function ws(e,t){try{var r="",n=t;do r+=ww(n),n=n.return;while(n);var i=r}catch(s){i=`
39
+ Error generating stack: `+s.message+`
40
+ `+s.stack}return{value:e,source:t,stack:i,digest:null}}function Yc(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function ph(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Yb=typeof WeakMap=="function"?WeakMap:Map;function E0(e,t,r){r=yn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Ma||(Ma=!0,kh=n),ph(e,t)},r}function N0(e,t,r){r=yn(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){ph(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){ph(e,t),typeof n!="function"&&(Jn===null?Jn=new Set([this]):Jn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function Xp(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new Yb;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=aS.bind(null,e,t,r),t.then(e,e))}function Gp(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 Qp(e,t,r,n,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=yn(-1,1),t.tag=2,Qn(r,t,1))),r.lanes|=1),e)}var Xb=Cn.ReactCurrentOwner,ar=!1;function Jt(e,t,r,n){t.child=e===null?r0(t,null,r,n):xs(t,e.child,r,n)}function Jp(e,t,r,n,i){r=r.render;var s=t.ref;return fs(t,i),n=cf(e,t,r,n,s,i),r=uf(),e!==null&&!ar?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,kn(e,t,i)):(st&&r&&Gd(t),t.flags|=1,Jt(e,t,n,i),t.child)}function Zp(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!yf(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,T0(e,t,s,n,i)):(e=Jl(r.type,null,n,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:Ro,r(o,n)&&e.ref===t.ref)return kn(e,t,i)}return t.flags|=1,e=ei(s,n),e.ref=t.ref,e.return=t,t.child=e}function T0(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(Ro(s,n)&&e.ref===t.ref)if(ar=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(ar=!0);else return t.lanes=e.lanes,kn(e,t,i)}return mh(e,t,r,n,i)}function P0(e,t,r){var n=t.pendingProps,i=n.children,s=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(ls,_r),_r|=r;else{if(!(r&1073741824))return e=s!==null?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,tt(ls,_r),_r|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,tt(ls,_r),_r|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,tt(ls,_r),_r|=n;return Jt(e,t,i,r),t.child}function L0(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function mh(e,t,r,n,i){var s=ur(r)?Ri:Xt.current;return s=_s(t,s),fs(t,i),r=cf(e,t,r,n,s,i),n=uf(),e!==null&&!ar?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,kn(e,t,i)):(st&&n&&Gd(t),t.flags|=1,Jt(e,t,r,i),t.child)}function em(e,t,r,n,i){if(ur(r)){var s=!0;ba(t)}else s=!1;if(fs(t,i),t.stateNode===null)Xl(e,t),C0(t,r,n),fh(t,r,n,i),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,c=r.contextType;typeof c=="object"&&c!==null?c=Ar(c):(c=ur(r)?Ri:Xt.current,c=_s(t,c));var d=r.getDerivedStateFromProps,u=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||a!==c)&&Yp(t,o,n,c),zn=!1;var f=t.memoizedState;o.state=f,Na(t,n,o,i),a=t.memoizedState,l!==n||f!==a||cr.current||zn?(typeof d=="function"&&(dh(t,r,d,n),a=t.memoizedState),(l=zn||qp(t,r,l,n,f,a,c))?(u||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=a),o.props=n,o.state=a,o.context=c,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,i0(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Fr(t.type,l),o.props=c,u=t.pendingProps,f=o.context,a=r.contextType,typeof a=="object"&&a!==null?a=Ar(a):(a=ur(r)?Ri:Xt.current,a=_s(t,a));var p=r.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==u||f!==a)&&Yp(t,o,n,a),zn=!1,f=t.memoizedState,o.state=f,Na(t,n,o,i);var m=t.memoizedState;l!==u||f!==m||cr.current||zn?(typeof p=="function"&&(dh(t,r,p,n),m=t.memoizedState),(c=zn||qp(t,r,c,n,f,m,a)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=a,n=c):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return gh(e,t,r,n,s,i)}function gh(e,t,r,n,i,s){L0(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&zp(t,r,!1),kn(e,t,s);n=t.stateNode,Xb.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=xs(t,e.child,null,s),t.child=xs(t,null,l,s)):Jt(e,t,l,s),t.memoizedState=n.state,i&&zp(t,r,!0),t.child}function R0(e){var t=e.stateNode;t.pendingContext?Op(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Op(e,t.context,!1),sf(e,t.containerInfo)}function tm(e,t,r,n,i){return vs(),Jd(i),t.flags|=256,Jt(e,t,r,n),t.child}var _h={dehydrated:null,treeContext:null,retryLane:0};function vh(e){return{baseLanes:e,cachePool:null,transitions:null}}function M0(e,t,r){var n=t.pendingProps,i=ut.current,s=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),tt(ut,i&1),e===null)return uh(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=n.children,e=n.fallback,s?(n=t.mode,s=t.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=lc(o,n,0,null),e=Ti(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=vh(r),t.memoizedState=_h,e):ff(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return Gb(e,t,o,n,l,i,r);if(s){s=n.fallback,o=t.mode,i=e.child,l=i.sibling;var a={mode:"hidden",children:n.children};return!(o&1)&&t.child!==i?(n=t.child,n.childLanes=0,n.pendingProps=a,t.deletions=null):(n=ei(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=ei(l,s):(s=Ti(s,o,r,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,n=s,s=t.child,o=e.child.memoizedState,o=o===null?vh(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=_h,n}return s=e.child,e=s.sibling,n=ei(s,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function ff(e,t){return t=lc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Cl(e,t,r,n){return n!==null&&Jd(n),xs(t,e.child,null,r),e=ff(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gb(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=Yc(Error(te(422))),Cl(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=lc({mode:"visible",children:n.children},i,0,null),s=Ti(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&xs(t,e.child,null,o),t.child.memoizedState=vh(o),t.memoizedState=_h,s);if(!(t.mode&1))return Cl(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,s=Error(te(419)),n=Yc(s,n,void 0),Cl(e,t,o,n)}if(l=(o&e.childLanes)!==0,ar||l){if(n=At,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Sn(e,i),Vr(n,e,i,-1))}return xf(),n=Yc(Error(te(421))),Cl(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=cS.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,xr=Gn(i.nextSibling),yr=t,st=!0,Hr=null,e!==null&&(Pr[Lr++]=_n,Pr[Lr++]=vn,Pr[Lr++]=Mi,_n=e.id,vn=e.overflow,Mi=t),t=ff(t,n.children),t.flags|=4096,t)}function rm(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),hh(e.return,t,r)}function Xc(e,t,r,n,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function I0(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(Jt(e,t,n.children,r),n=ut.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&rm(e,r,t);else if(e.tag===19)rm(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(tt(ut,n),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;r!==null;)e=r.alternate,e!==null&&Ta(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),Xc(t,!1,i,r,s);break;case"backwards":for(r=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ta(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}Xc(t,!0,r,null,s);break;case"together":Xc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Xl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function kn(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Di|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,r=ei(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=ei(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Qb(e,t,r){switch(t.tag){case 3:R0(t),vs();break;case 5:s0(t);break;case 1:ur(t.type)&&ba(t);break;case 4:sf(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;tt(Ca,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(tt(ut,ut.current&1),t.flags|=128,null):r&t.child.childLanes?M0(e,t,r):(tt(ut,ut.current&1),e=kn(e,t,r),e!==null?e.sibling:null);tt(ut,ut.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return I0(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),tt(ut,ut.current),n)break;return null;case 22:case 23:return t.lanes=0,P0(e,t,r)}return kn(e,t,r)}var D0,xh,j0,A0;D0=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};xh=function(){};j0=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,Ci(sn.current);var s=null;switch(r){case"input":i=Fu(e,i),n=Fu(e,n),s=[];break;case"select":i=dt({},i,{value:void 0}),n=dt({},n,{value:void 0}),s=[];break;case"textarea":i=Uu(e,i),n=Uu(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=ya)}Ku(r,n);var o;r=null;for(c in i)if(!n.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var l=i[c];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(ko.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in n){var a=n[c];if(l=i!=null?i[c]:void 0,n.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(r||(r={}),r[o]=a[o])}else r||(s||(s=[]),s.push(c,r)),r=a;else c==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(c,a)):c==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(c,""+a):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(ko.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&rt("scroll",e),s||l===a||(s=[])):(s=s||[]).push(c,a))}r&&(s=s||[]).push("style",r);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};A0=function(e,t,r,n){r!==n&&(t.flags|=4)};function Ws(e,t){if(!st)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Vt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function Jb(e,t,r){var n=t.pendingProps;switch(Qd(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(t),null;case 1:return ur(t.type)&&wa(),Vt(t),null;case 3:return n=t.stateNode,ys(),it(cr),it(Xt),lf(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Sl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Hr!==null&&(Nh(Hr),Hr=null))),xh(e,t),Vt(t),null;case 5:of(t);var i=Ci(Ao.current);if(r=t.type,e!==null&&t.stateNode!=null)j0(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(te(166));return Vt(t),null}if(e=Ci(sn.current),Sl(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[tn]=t,n[Do]=s,e=(t.mode&1)!==0,r){case"dialog":rt("cancel",n),rt("close",n);break;case"iframe":case"object":case"embed":rt("load",n);break;case"video":case"audio":for(i=0;i<io.length;i++)rt(io[i],n);break;case"source":rt("error",n);break;case"img":case"image":case"link":rt("error",n),rt("load",n);break;case"details":rt("toggle",n);break;case"input":hp(n,s),rt("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},rt("invalid",n);break;case"textarea":fp(n,s),rt("invalid",n)}Ku(r,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?n.textContent!==l&&(s.suppressHydrationWarning!==!0&&bl(n.textContent,l,e),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&bl(n.textContent,l,e),i=["children",""+l]):ko.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&rt("scroll",n)}switch(r){case"input":pl(n),dp(n,s,!0);break;case"textarea":pl(n),pp(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=ya)}n=i,t.updateQueue=n,n!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=uv(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[tn]=t,e[Do]=n,D0(e,t,!1,!1),t.stateNode=e;e:{switch(o=qu(r,n),r){case"dialog":rt("cancel",e),rt("close",e),i=n;break;case"iframe":case"object":case"embed":rt("load",e),i=n;break;case"video":case"audio":for(i=0;i<io.length;i++)rt(io[i],e);i=n;break;case"source":rt("error",e),i=n;break;case"img":case"image":case"link":rt("error",e),rt("load",e),i=n;break;case"details":rt("toggle",e),i=n;break;case"input":hp(e,n),i=Fu(e,n),rt("invalid",e);break;case"option":i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=dt({},n,{value:void 0}),rt("invalid",e);break;case"textarea":fp(e,n),i=Uu(e,n),rt("invalid",e);break;default:i=n}Ku(r,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?fv(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&hv(e,a)):s==="children"?typeof a=="string"?(r!=="textarea"||a!=="")&&Co(e,a):typeof a=="number"&&Co(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(ko.hasOwnProperty(s)?a!=null&&s==="onScroll"&&rt("scroll",e):a!=null&&Ad(e,s,a,o))}switch(r){case"input":pl(e),dp(e,n,!1);break;case"textarea":pl(e),pp(e);break;case"option":n.value!=null&&e.setAttribute("value",""+ri(n.value));break;case"select":e.multiple=!!n.multiple,s=n.value,s!=null?cs(e,!!n.multiple,s,!1):n.defaultValue!=null&&cs(e,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=ya)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Vt(t),null;case 6:if(e&&t.stateNode!=null)A0(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(te(166));if(r=Ci(Ao.current),Ci(sn.current),Sl(t)){if(n=t.stateNode,r=t.memoizedProps,n[tn]=t,(s=n.nodeValue!==r)&&(e=yr,e!==null))switch(e.tag){case 3:bl(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&bl(n.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[tn]=t,t.stateNode=n}return Vt(t),null;case 13:if(it(ut),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(st&&xr!==null&&t.mode&1&&!(t.flags&128))e0(),vs(),t.flags|=98560,s=!1;else if(s=Sl(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(te(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(te(317));s[tn]=t}else vs(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Vt(t),s=!1}else Hr!==null&&(Nh(Hr),Hr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||ut.current&1?Tt===0&&(Tt=3):xf())),t.updateQueue!==null&&(t.flags|=4),Vt(t),null);case 4:return ys(),xh(e,t),e===null&&Mo(t.stateNode.containerInfo),Vt(t),null;case 10:return tf(t.type._context),Vt(t),null;case 17:return ur(t.type)&&wa(),Vt(t),null;case 19:if(it(ut),s=t.memoizedState,s===null)return Vt(t),null;if(n=(t.flags&128)!==0,o=s.rendering,o===null)if(n)Ws(s,!1);else{if(Tt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Ta(e),o!==null){for(t.flags|=128,Ws(s,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)s=r,e=n,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return tt(ut,ut.current&1|2),t.child}e=e.sibling}s.tail!==null&&vt()>bs&&(t.flags|=128,n=!0,Ws(s,!1),t.lanes=4194304)}else{if(!n)if(e=Ta(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ws(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!st)return Vt(t),null}else 2*vt()-s.renderingStartTime>bs&&r!==1073741824&&(t.flags|=128,n=!0,Ws(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=vt(),t.sibling=null,r=ut.current,tt(ut,n?r&1|2:r&1),t):(Vt(t),null);case 22:case 23:return vf(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?_r&1073741824&&(Vt(t),t.subtreeFlags&6&&(t.flags|=8192)):Vt(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function Zb(e,t){switch(Qd(t),t.tag){case 1:return ur(t.type)&&wa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ys(),it(cr),it(Xt),lf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return of(t),null;case 13:if(it(ut),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));vs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return it(ut),null;case 4:return ys(),null;case 10:return tf(t.type._context),null;case 22:case 23:return vf(),null;case 24:return null;default:return null}}var El=!1,qt=!1,eS=typeof WeakSet=="function"?WeakSet:Set,de=null;function os(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){pt(e,t,n)}else r.current=null}function yh(e,t,r){try{r()}catch(n){pt(e,t,n)}}var nm=!1;function tS(e,t){if(nh=_a,e=Fv(),Xd(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,l=-1,a=-1,c=0,d=0,u=e,f=null;t:for(;;){for(var p;u!==r||i!==0&&u.nodeType!==3||(l=o+i),u!==s||n!==0&&u.nodeType!==3||(a=o+n),u.nodeType===3&&(o+=u.nodeValue.length),(p=u.firstChild)!==null;)f=u,u=p;for(;;){if(u===e)break t;if(f===r&&++c===i&&(l=o),f===s&&++d===n&&(a=o),(p=u.nextSibling)!==null)break;u=f,f=u.parentNode}u=p}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(ih={focusedElem:e,selectionRange:r},_a=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var _=m.memoizedProps,b=m.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?_:Fr(t.type,_),b);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(k){pt(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return m=nm,nm=!1,m}function _o(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&yh(t,r,s)}i=i.next}while(i!==n)}}function sc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function wh(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function B0(e){var t=e.alternate;t!==null&&(e.alternate=null,B0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[tn],delete t[Do],delete t[lh],delete t[Bb],delete t[Ob])),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 O0(e){return e.tag===5||e.tag===3||e.tag===4}function im(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||O0(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 bh(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=ya));else if(n!==4&&(e=e.child,e!==null))for(bh(e,t,r),e=e.sibling;e!==null;)bh(e,t,r),e=e.sibling}function Sh(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Sh(e,t,r),e=e.sibling;e!==null;)Sh(e,t,r),e=e.sibling}var zt=null,Wr=!1;function Rn(e,t,r){for(r=r.child;r!==null;)z0(e,t,r),r=r.sibling}function z0(e,t,r){if(nn&&typeof nn.onCommitFiberUnmount=="function")try{nn.onCommitFiberUnmount(Qa,r)}catch{}switch(r.tag){case 5:qt||os(r,t);case 6:var n=zt,i=Wr;zt=null,Rn(e,t,r),zt=n,Wr=i,zt!==null&&(Wr?(e=zt,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):zt.removeChild(r.stateNode));break;case 18:zt!==null&&(Wr?(e=zt,r=r.stateNode,e.nodeType===8?Wc(e.parentNode,r):e.nodeType===1&&Wc(e,r),Po(e)):Wc(zt,r.stateNode));break;case 4:n=zt,i=Wr,zt=r.stateNode.containerInfo,Wr=!0,Rn(e,t,r),zt=n,Wr=i;break;case 0:case 11:case 14:case 15:if(!qt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&yh(r,t,o),i=i.next}while(i!==n)}Rn(e,t,r);break;case 1:if(!qt&&(os(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){pt(r,t,l)}Rn(e,t,r);break;case 21:Rn(e,t,r);break;case 22:r.mode&1?(qt=(n=qt)||r.memoizedState!==null,Rn(e,t,r),qt=n):Rn(e,t,r);break;default:Rn(e,t,r)}}function sm(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new eS),t.forEach(function(n){var i=uS.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function zr(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var i=r[n];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:zt=l.stateNode,Wr=!1;break e;case 3:zt=l.stateNode.containerInfo,Wr=!0;break e;case 4:zt=l.stateNode.containerInfo,Wr=!0;break e}l=l.return}if(zt===null)throw Error(te(160));z0(s,o,i),zt=null,Wr=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){pt(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)$0(t,e),t=t.sibling}function $0(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(zr(t,e),Xr(e),n&4){try{_o(3,e,e.return),sc(3,e)}catch(_){pt(e,e.return,_)}try{_o(5,e,e.return)}catch(_){pt(e,e.return,_)}}break;case 1:zr(t,e),Xr(e),n&512&&r!==null&&os(r,r.return);break;case 5:if(zr(t,e),Xr(e),n&512&&r!==null&&os(r,r.return),e.flags&32){var i=e.stateNode;try{Co(i,"")}catch(_){pt(e,e.return,_)}}if(n&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=r!==null?r.memoizedProps:s,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&av(i,s),qu(l,o);var c=qu(l,s);for(o=0;o<a.length;o+=2){var d=a[o],u=a[o+1];d==="style"?fv(i,u):d==="dangerouslySetInnerHTML"?hv(i,u):d==="children"?Co(i,u):Ad(i,d,u,c)}switch(l){case"input":Wu(i,s);break;case"textarea":cv(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?cs(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?cs(i,!!s.multiple,s.defaultValue,!0):cs(i,!!s.multiple,s.multiple?[]:"",!1))}i[Do]=s}catch(_){pt(e,e.return,_)}}break;case 6:if(zr(t,e),Xr(e),n&4){if(e.stateNode===null)throw Error(te(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(_){pt(e,e.return,_)}}break;case 3:if(zr(t,e),Xr(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Po(t.containerInfo)}catch(_){pt(e,e.return,_)}break;case 4:zr(t,e),Xr(e);break;case 13:zr(t,e),Xr(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(gf=vt())),n&4&&sm(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(qt=(c=qt)||d,zr(t,e),qt=c):zr(t,e),Xr(e),n&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!d&&e.mode&1)for(de=e,d=e.child;d!==null;){for(u=de=d;de!==null;){switch(f=de,p=f.child,f.tag){case 0:case 11:case 14:case 15:_o(4,f,f.return);break;case 1:os(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(_){pt(n,r,_)}}break;case 5:os(f,f.return);break;case 22:if(f.memoizedState!==null){lm(u);continue}}p!==null?(p.return=f,de=p):lm(u)}d=d.sibling}e:for(d=null,u=e;;){if(u.tag===5){if(d===null){d=u;try{i=u.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=u.stateNode,a=u.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=dv("display",o))}catch(_){pt(e,e.return,_)}}}else if(u.tag===6){if(d===null)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(_){pt(e,e.return,_)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;d===u&&(d=null),u=u.return}d===u&&(d=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:zr(t,e),Xr(e),n&4&&sm(e);break;case 21:break;default:zr(t,e),Xr(e)}}function Xr(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(O0(r)){var n=r;break e}r=r.return}throw Error(te(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(Co(i,""),n.flags&=-33);var s=im(e);Sh(e,s,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=im(e);bh(e,l,o);break;default:throw Error(te(161))}}catch(a){pt(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function rS(e,t,r){de=e,F0(e)}function F0(e,t,r){for(var n=(e.mode&1)!==0;de!==null;){var i=de,s=i.child;if(i.tag===22&&n){var o=i.memoizedState!==null||El;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||qt;l=El;var c=qt;if(El=o,(qt=a)&&!c)for(de=i;de!==null;)o=de,a=o.child,o.tag===22&&o.memoizedState!==null?am(i):a!==null?(a.return=o,de=a):am(i);for(;s!==null;)de=s,F0(s),s=s.sibling;de=i,El=l,qt=c}om(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,de=s):om(e)}}function om(e){for(;de!==null;){var t=de;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:qt||sc(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!qt)if(r===null)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:Fr(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Up(t,s,n);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}Up(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break;case"img":a.src&&(r.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var u=d.dehydrated;u!==null&&Po(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}qt||t.flags&512&&wh(t)}catch(f){pt(t,t.return,f)}}if(t===e){de=null;break}if(r=t.sibling,r!==null){r.return=t.return,de=r;break}de=t.return}}function lm(e){for(;de!==null;){var t=de;if(t===e){de=null;break}var r=t.sibling;if(r!==null){r.return=t.return,de=r;break}de=t.return}}function am(e){for(;de!==null;){var t=de;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{sc(4,t)}catch(a){pt(t,r,a)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var i=t.return;try{n.componentDidMount()}catch(a){pt(t,i,a)}}var s=t.return;try{wh(t)}catch(a){pt(t,s,a)}break;case 5:var o=t.return;try{wh(t)}catch(a){pt(t,o,a)}}}catch(a){pt(t,t.return,a)}if(t===e){de=null;break}var l=t.sibling;if(l!==null){l.return=t.return,de=l;break}de=t.return}}var nS=Math.ceil,Ra=Cn.ReactCurrentDispatcher,pf=Cn.ReactCurrentOwner,Dr=Cn.ReactCurrentBatchConfig,Ve=0,At=null,bt=null,Wt=0,_r=0,ls=oi(0),Tt=0,$o=null,Di=0,oc=0,mf=0,vo=null,lr=null,gf=0,bs=1/0,fn=null,Ma=!1,kh=null,Jn=null,Nl=!1,Un=null,Ia=0,xo=0,Ch=null,Gl=-1,Ql=0;function er(){return Ve&6?vt():Gl!==-1?Gl:Gl=vt()}function Zn(e){return e.mode&1?Ve&2&&Wt!==0?Wt&-Wt:$b.transition!==null?(Ql===0&&(Ql=Cv()),Ql):(e=Ye,e!==0||(e=window.event,e=e===void 0?16:Mv(e.type)),e):1}function Vr(e,t,r,n){if(50<xo)throw xo=0,Ch=null,Error(te(185));Qo(e,r,n),(!(Ve&2)||e!==At)&&(e===At&&(!(Ve&2)&&(oc|=r),Tt===4&&Wn(e,Wt)),hr(e,n),r===1&&Ve===0&&!(t.mode&1)&&(bs=vt()+500,rc&&li()))}function hr(e,t){var r=e.callbackNode;$w(e,t);var n=ga(e,e===At?Wt:0);if(n===0)r!==null&&_p(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&_p(r),t===1)e.tag===0?zb(cm.bind(null,e)):Qv(cm.bind(null,e)),jb(function(){!(Ve&6)&&li()}),r=null;else{switch(Ev(n)){case 1:r=Fd;break;case 4:r=Sv;break;case 16:r=ma;break;case 536870912:r=kv;break;default:r=ma}r=X0(r,W0.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function W0(e,t){if(Gl=-1,Ql=0,Ve&6)throw Error(te(327));var r=e.callbackNode;if(ps()&&e.callbackNode!==r)return null;var n=ga(e,e===At?Wt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Da(e,n);else{t=n;var i=Ve;Ve|=2;var s=U0();(At!==e||Wt!==t)&&(fn=null,bs=vt()+500,Ni(e,t));do try{oS();break}catch(l){H0(e,l)}while(!0);ef(),Ra.current=s,Ve=i,bt!==null?t=0:(At=null,Wt=0,t=Tt)}if(t!==0){if(t===2&&(i=Ju(e),i!==0&&(n=i,t=Eh(e,i))),t===1)throw r=$o,Ni(e,0),Wn(e,n),hr(e,vt()),r;if(t===6)Wn(e,n);else{if(i=e.current.alternate,!(n&30)&&!iS(i)&&(t=Da(e,n),t===2&&(s=Ju(e),s!==0&&(n=s,t=Eh(e,s))),t===1))throw r=$o,Ni(e,0),Wn(e,n),hr(e,vt()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(te(345));case 2:xi(e,lr,fn);break;case 3:if(Wn(e,n),(n&130023424)===n&&(t=gf+500-vt(),10<t)){if(ga(e,0)!==0)break;if(i=e.suspendedLanes,(i&n)!==n){er(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=oh(xi.bind(null,e,lr,fn),t);break}xi(e,lr,fn);break;case 4:if(Wn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,i=-1;0<n;){var o=31-Ur(n);s=1<<o,o=t[o],o>i&&(i=o),n&=~s}if(n=i,n=vt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*nS(n/1960))-n,10<n){e.timeoutHandle=oh(xi.bind(null,e,lr,fn),n);break}xi(e,lr,fn);break;case 5:xi(e,lr,fn);break;default:throw Error(te(329))}}}return hr(e,vt()),e.callbackNode===r?W0.bind(null,e):null}function Eh(e,t){var r=vo;return e.current.memoizedState.isDehydrated&&(Ni(e,t).flags|=256),e=Da(e,t),e!==2&&(t=lr,lr=r,t!==null&&Nh(t)),e}function Nh(e){lr===null?lr=e:lr.push.apply(lr,e)}function iS(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var i=r[n],s=i.getSnapshot;i=i.value;try{if(!qr(s(),i))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Wn(e,t){for(t&=~mf,t&=~oc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Ur(t),n=1<<r;e[r]=-1,t&=~n}}function cm(e){if(Ve&6)throw Error(te(327));ps();var t=ga(e,0);if(!(t&1))return hr(e,vt()),null;var r=Da(e,t);if(e.tag!==0&&r===2){var n=Ju(e);n!==0&&(t=n,r=Eh(e,n))}if(r===1)throw r=$o,Ni(e,0),Wn(e,t),hr(e,vt()),r;if(r===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,xi(e,lr,fn),hr(e,vt()),null}function _f(e,t){var r=Ve;Ve|=1;try{return e(t)}finally{Ve=r,Ve===0&&(bs=vt()+500,rc&&li())}}function ji(e){Un!==null&&Un.tag===0&&!(Ve&6)&&ps();var t=Ve;Ve|=1;var r=Dr.transition,n=Ye;try{if(Dr.transition=null,Ye=1,e)return e()}finally{Ye=n,Dr.transition=r,Ve=t,!(Ve&6)&&li()}}function vf(){_r=ls.current,it(ls)}function Ni(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Db(r)),bt!==null)for(r=bt.return;r!==null;){var n=r;switch(Qd(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&wa();break;case 3:ys(),it(cr),it(Xt),lf();break;case 5:of(n);break;case 4:ys();break;case 13:it(ut);break;case 19:it(ut);break;case 10:tf(n.type._context);break;case 22:case 23:vf()}r=r.return}if(At=e,bt=e=ei(e.current,null),Wt=_r=t,Tt=0,$o=null,mf=oc=Di=0,lr=vo=null,ki!==null){for(t=0;t<ki.length;t++)if(r=ki[t],n=r.interleaved,n!==null){r.interleaved=null;var i=n.next,s=r.pending;if(s!==null){var o=s.next;s.next=i,n.next=o}r.pending=n}ki=null}return e}function H0(e,t){do{var r=bt;try{if(ef(),ql.current=La,Pa){for(var n=ht.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}Pa=!1}if(Ii=0,Mt=Nt=ht=null,go=!1,Bo=0,pf.current=null,r===null||r.return===null){Tt=1,$o=t,bt=null;break}e:{var s=e,o=r.return,l=r,a=t;if(t=Wt,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var c=a,d=l,u=d.tag;if(!(d.mode&1)&&(u===0||u===11||u===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=Gp(o);if(p!==null){p.flags&=-257,Qp(p,o,l,s,t),p.mode&1&&Xp(s,c,t),t=p,a=c;var m=t.updateQueue;if(m===null){var _=new Set;_.add(a),t.updateQueue=_}else m.add(a);break e}else{if(!(t&1)){Xp(s,c,t),xf();break e}a=Error(te(426))}}else if(st&&l.mode&1){var b=Gp(o);if(b!==null){!(b.flags&65536)&&(b.flags|=256),Qp(b,o,l,s,t),Jd(ws(a,l));break e}}s=a=ws(a,l),Tt!==4&&(Tt=2),vo===null?vo=[s]:vo.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var g=E0(s,a,t);Hp(s,g);break e;case 1:l=a;var v=s.type,y=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Jn===null||!Jn.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t;var k=N0(s,l,t);Hp(s,k);break e}}s=s.return}while(s!==null)}K0(r)}catch(L){t=L,bt===r&&r!==null&&(bt=r=r.return);continue}break}while(!0)}function U0(){var e=Ra.current;return Ra.current=La,e===null?La:e}function xf(){(Tt===0||Tt===3||Tt===2)&&(Tt=4),At===null||!(Di&268435455)&&!(oc&268435455)||Wn(At,Wt)}function Da(e,t){var r=Ve;Ve|=2;var n=U0();(At!==e||Wt!==t)&&(fn=null,Ni(e,t));do try{sS();break}catch(i){H0(e,i)}while(!0);if(ef(),Ve=r,Ra.current=n,bt!==null)throw Error(te(261));return At=null,Wt=0,Tt}function sS(){for(;bt!==null;)V0(bt)}function oS(){for(;bt!==null&&!Rw();)V0(bt)}function V0(e){var t=Y0(e.alternate,e,_r);e.memoizedProps=e.pendingProps,t===null?K0(e):bt=t,pf.current=null}function K0(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=Zb(r,t),r!==null){r.flags&=32767,bt=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Tt=6,bt=null;return}}else if(r=Jb(r,t,_r),r!==null){bt=r;return}if(t=t.sibling,t!==null){bt=t;return}bt=t=e}while(t!==null);Tt===0&&(Tt=5)}function xi(e,t,r){var n=Ye,i=Dr.transition;try{Dr.transition=null,Ye=1,lS(e,t,r,n)}finally{Dr.transition=i,Ye=n}return null}function lS(e,t,r,n){do ps();while(Un!==null);if(Ve&6)throw Error(te(327));r=e.finishedWork;var i=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(te(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(Fw(e,s),e===At&&(bt=At=null,Wt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Nl||(Nl=!0,X0(ma,function(){return ps(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=Dr.transition,Dr.transition=null;var o=Ye;Ye=1;var l=Ve;Ve|=4,pf.current=null,tS(e,r),$0(r,e),Nb(ih),_a=!!nh,ih=nh=null,e.current=r,rS(r),Mw(),Ve=l,Ye=o,Dr.transition=s}else e.current=r;if(Nl&&(Nl=!1,Un=e,Ia=i),s=e.pendingLanes,s===0&&(Jn=null),jw(r.stateNode),hr(e,vt()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)i=t[r],n(i.value,{componentStack:i.stack,digest:i.digest});if(Ma)throw Ma=!1,e=kh,kh=null,e;return Ia&1&&e.tag!==0&&ps(),s=e.pendingLanes,s&1?e===Ch?xo++:(xo=0,Ch=e):xo=0,li(),null}function ps(){if(Un!==null){var e=Ev(Ia),t=Dr.transition,r=Ye;try{if(Dr.transition=null,Ye=16>e?16:e,Un===null)var n=!1;else{if(e=Un,Un=null,Ia=0,Ve&6)throw Error(te(331));var i=Ve;for(Ve|=4,de=e.current;de!==null;){var s=de,o=s.child;if(de.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(de=c;de!==null;){var d=de;switch(d.tag){case 0:case 11:case 15:_o(8,d,s)}var u=d.child;if(u!==null)u.return=d,de=u;else for(;de!==null;){d=de;var f=d.sibling,p=d.return;if(B0(d),d===c){de=null;break}if(f!==null){f.return=p,de=f;break}de=p}}}var m=s.alternate;if(m!==null){var _=m.child;if(_!==null){m.child=null;do{var b=_.sibling;_.sibling=null,_=b}while(_!==null)}}de=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,de=o;else e:for(;de!==null;){if(s=de,s.flags&2048)switch(s.tag){case 0:case 11:case 15:_o(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,de=g;break e}de=s.return}}var v=e.current;for(de=v;de!==null;){o=de;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,de=y;else e:for(o=v;de!==null;){if(l=de,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:sc(9,l)}}catch(L){pt(l,l.return,L)}if(l===o){de=null;break e}var k=l.sibling;if(k!==null){k.return=l.return,de=k;break e}de=l.return}}if(Ve=i,li(),nn&&typeof nn.onPostCommitFiberRoot=="function")try{nn.onPostCommitFiberRoot(Qa,e)}catch{}n=!0}return n}finally{Ye=r,Dr.transition=t}}return!1}function um(e,t,r){t=ws(r,t),t=E0(e,t,1),e=Qn(e,t,1),t=er(),e!==null&&(Qo(e,1,t),hr(e,t))}function pt(e,t,r){if(e.tag===3)um(e,e,r);else for(;t!==null;){if(t.tag===3){um(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Jn===null||!Jn.has(n))){e=ws(r,e),e=N0(t,e,1),t=Qn(t,e,1),e=er(),t!==null&&(Qo(t,1,e),hr(t,e));break}}t=t.return}}function aS(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=er(),e.pingedLanes|=e.suspendedLanes&r,At===e&&(Wt&r)===r&&(Tt===4||Tt===3&&(Wt&130023424)===Wt&&500>vt()-gf?Ni(e,0):mf|=r),hr(e,t)}function q0(e,t){t===0&&(e.mode&1?(t=_l,_l<<=1,!(_l&130023424)&&(_l=4194304)):t=1);var r=er();e=Sn(e,t),e!==null&&(Qo(e,t,r),hr(e,r))}function cS(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),q0(e,r)}function uS(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(te(314))}n!==null&&n.delete(t),q0(e,r)}var Y0;Y0=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||cr.current)ar=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return ar=!1,Qb(e,t,r);ar=!!(e.flags&131072)}else ar=!1,st&&t.flags&1048576&&Jv(t,ka,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Xl(e,t),e=t.pendingProps;var i=_s(t,Xt.current);fs(t,r),i=cf(null,t,n,e,i,r);var s=uf();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ur(n)?(s=!0,ba(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,nf(t),i.updater=ic,t.stateNode=i,i._reactInternals=t,fh(t,n,e,r),t=gh(null,t,n,!0,s,r)):(t.tag=0,st&&s&&Gd(t),Jt(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Xl(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=dS(n),e=Fr(n,e),i){case 0:t=mh(null,t,n,e,r);break e;case 1:t=em(null,t,n,e,r);break e;case 11:t=Jp(null,t,n,e,r);break e;case 14:t=Zp(null,t,n,Fr(n.type,e),r);break e}throw Error(te(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Fr(n,i),mh(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Fr(n,i),em(e,t,n,i,r);case 3:e:{if(R0(t),e===null)throw Error(te(387));n=t.pendingProps,s=t.memoizedState,i=s.element,i0(e,t),Na(t,n,null,r);var o=t.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=ws(Error(te(423)),t),t=tm(e,t,n,r,i);break e}else if(n!==i){i=ws(Error(te(424)),t),t=tm(e,t,n,r,i);break e}else for(xr=Gn(t.stateNode.containerInfo.firstChild),yr=t,st=!0,Hr=null,r=r0(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(vs(),n===i){t=kn(e,t,r);break e}Jt(e,t,n,r)}t=t.child}return t;case 5:return s0(t),e===null&&uh(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,sh(n,i)?o=null:s!==null&&sh(n,s)&&(t.flags|=32),L0(e,t),Jt(e,t,o,r),t.child;case 6:return e===null&&uh(t),null;case 13:return M0(e,t,r);case 4:return sf(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=xs(t,null,n,r):Jt(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Fr(n,i),Jp(e,t,n,i,r);case 7:return Jt(e,t,t.pendingProps,r),t.child;case 8:return Jt(e,t,t.pendingProps.children,r),t.child;case 12:return Jt(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,tt(Ca,n._currentValue),n._currentValue=o,s!==null)if(qr(s.value,o)){if(s.children===i.children&&!cr.current){t=kn(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(s.tag===1){a=yn(-1,r&-r),a.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?a.next=a:(a.next=d.next,d.next=a),c.pending=a}}s.lanes|=r,a=s.alternate,a!==null&&(a.lanes|=r),hh(s.return,r,t),l.lanes|=r;break}a=a.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(te(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),hh(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Jt(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,fs(t,r),i=Ar(i),n=n(i),t.flags|=1,Jt(e,t,n,r),t.child;case 14:return n=t.type,i=Fr(n,t.pendingProps),i=Fr(n.type,i),Zp(e,t,n,i,r);case 15:return T0(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Fr(n,i),Xl(e,t),t.tag=1,ur(n)?(e=!0,ba(t)):e=!1,fs(t,r),C0(t,n,i),fh(t,n,i,r),gh(null,t,n,!0,e,r);case 19:return I0(e,t,r);case 22:return P0(e,t,r)}throw Error(te(156,t.tag))};function X0(e,t){return bv(e,t)}function hS(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ir(e,t,r,n){return new hS(e,t,r,n)}function yf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dS(e){if(typeof e=="function")return yf(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Od)return 11;if(e===zd)return 14}return 2}function ei(e,t){var r=e.alternate;return r===null?(r=Ir(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Jl(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")yf(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Qi:return Ti(r.children,i,s,t);case Bd:o=8,i|=8;break;case Bu:return e=Ir(12,r,t,i|2),e.elementType=Bu,e.lanes=s,e;case Ou:return e=Ir(13,r,t,i),e.elementType=Ou,e.lanes=s,e;case zu:return e=Ir(19,r,t,i),e.elementType=zu,e.lanes=s,e;case sv:return lc(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case nv:o=10;break e;case iv:o=9;break e;case Od:o=11;break e;case zd:o=14;break e;case On:o=16,n=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=Ir(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function Ti(e,t,r,n){return e=Ir(7,e,n,t),e.lanes=r,e}function lc(e,t,r,n){return e=Ir(22,e,n,t),e.elementType=sv,e.lanes=r,e.stateNode={isHidden:!1},e}function Gc(e,t,r){return e=Ir(6,e,null,t),e.lanes=r,e}function Qc(e,t,r){return t=Ir(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fS(e,t,r,n,i){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=Rc(0),this.expirationTimes=Rc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function wf(e,t,r,n,i,s,o,l,a){return e=new fS(e,t,r,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Ir(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},nf(s),e}function pS(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Gi,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function G0(e){if(!e)return ni;e=e._reactInternals;e:{if($i(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ur(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var r=e.type;if(ur(r))return Gv(e,r,t)}return t}function Q0(e,t,r,n,i,s,o,l,a){return e=wf(r,n,!0,e,i,s,o,l,a),e.context=G0(null),r=e.current,n=er(),i=Zn(r),s=yn(n,i),s.callback=t??null,Qn(r,s,i),e.current.lanes=i,Qo(e,i,n),hr(e,n),e}function ac(e,t,r,n){var i=t.current,s=er(),o=Zn(i);return r=G0(r),t.context===null?t.context=r:t.pendingContext=r,t=yn(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=Qn(i,t,o),e!==null&&(Vr(e,i,o,s),Kl(e,i,o)),o}function ja(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 hm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function bf(e,t){hm(e,t),(e=e.alternate)&&hm(e,t)}function mS(){return null}var J0=typeof reportError=="function"?reportError:function(e){console.error(e)};function Sf(e){this._internalRoot=e}cc.prototype.render=Sf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));ac(e,t,null,null)};cc.prototype.unmount=Sf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ji(function(){ac(null,e,null,null)}),t[bn]=null}};function cc(e){this._internalRoot=e}cc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Pv();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Fn.length&&t!==0&&t<Fn[r].priority;r++);Fn.splice(r,0,e),r===0&&Rv(e)}};function kf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function uc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dm(){}function gS(e,t,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=ja(o);s.call(c)}}var o=Q0(t,n,e,0,null,!1,!1,"",dm);return e._reactRootContainer=o,e[bn]=o.current,Mo(e.nodeType===8?e.parentNode:e),ji(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var c=ja(a);l.call(c)}}var a=wf(e,0,!1,null,null,!1,!1,"",dm);return e._reactRootContainer=a,e[bn]=a.current,Mo(e.nodeType===8?e.parentNode:e),ji(function(){ac(t,a,r,n)}),a}function hc(e,t,r,n,i){var s=r._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var a=ja(o);l.call(a)}}ac(t,o,e,i)}else o=gS(r,t,e,i,n);return ja(o)}Nv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=no(t.pendingLanes);r!==0&&(Wd(t,r|1),hr(t,vt()),!(Ve&6)&&(bs=vt()+500,li()))}break;case 13:ji(function(){var n=Sn(e,1);if(n!==null){var i=er();Vr(n,e,1,i)}}),bf(e,1)}};Hd=function(e){if(e.tag===13){var t=Sn(e,134217728);if(t!==null){var r=er();Vr(t,e,134217728,r)}bf(e,134217728)}};Tv=function(e){if(e.tag===13){var t=Zn(e),r=Sn(e,t);if(r!==null){var n=er();Vr(r,e,t,n)}bf(e,t)}};Pv=function(){return Ye};Lv=function(e,t){var r=Ye;try{return Ye=e,t()}finally{Ye=r}};Xu=function(e,t,r){switch(t){case"input":if(Wu(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=tc(n);if(!i)throw Error(te(90));lv(n),Wu(n,i)}}}break;case"textarea":cv(e,r);break;case"select":t=r.value,t!=null&&cs(e,!!r.multiple,t,!1)}};gv=_f;_v=ji;var _S={usingClientEntryPoint:!1,Events:[Zo,ts,tc,pv,mv,_f]},Hs={findFiberByHostInstance:Si,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},vS={bundleType:Hs.bundleType,version:Hs.version,rendererPackageName:Hs.rendererPackageName,rendererConfig:Hs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Cn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=yv(e),e===null?null:e.stateNode},findFiberByHostInstance:Hs.findFiberByHostInstance||mS,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 Tl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tl.isDisabled&&Tl.supportsFiber)try{Qa=Tl.inject(vS),nn=Tl}catch{}}Sr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_S;Sr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!kf(t))throw Error(te(200));return pS(e,t,null,r)};Sr.createRoot=function(e,t){if(!kf(e))throw Error(te(299));var r=!1,n="",i=J0;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=wf(e,1,!1,null,null,r,!1,n,i),e[bn]=t.current,Mo(e.nodeType===8?e.parentNode:e),new Sf(t)};Sr.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(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=yv(t),e=e===null?null:e.stateNode,e};Sr.flushSync=function(e){return ji(e)};Sr.hydrate=function(e,t,r){if(!uc(t))throw Error(te(200));return hc(null,e,t,!0,r)};Sr.hydrateRoot=function(e,t,r){if(!kf(e))throw Error(te(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",o=J0;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=Q0(t,null,e,1,r??null,i,!1,s,o),e[bn]=t.current,Mo(e),n)for(e=0;e<n.length;e++)r=n[e],i=r._getVersion,i=i(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,i]:t.mutableSourceEagerHydrationData.push(r,i);return new cc(t)};Sr.render=function(e,t,r){if(!uc(t))throw Error(te(200));return hc(null,e,t,!1,r)};Sr.unmountComponentAtNode=function(e){if(!uc(e))throw Error(te(40));return e._reactRootContainer?(ji(function(){hc(null,null,e,!1,function(){e._reactRootContainer=null,e[bn]=null})}),!0):!1};Sr.unstable_batchedUpdates=_f;Sr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!uc(r))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return hc(e,t,r,!1,n)};Sr.version="18.3.1-next-f1338f8080-20240426";function Z0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Z0)}catch(e){console.error(e)}}Z0(),Z_.exports=Sr;var ex=Z_.exports,tx,fm=ex;tx=fm.createRoot,fm.hydrateRoot;/**
41
+ * @remix-run/router v1.23.2
42
+ *
43
+ * Copyright (c) Remix Software Inc.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE.md file in the root directory of this source tree.
47
+ *
48
+ * @license MIT
49
+ */function Fo(){return Fo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fo.apply(this,arguments)}var Vn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Vn||(Vn={}));const pm="popstate";function xS(e){e===void 0&&(e={});function t(n,i){let{pathname:s,search:o,hash:l}=n.location;return Th("",{pathname:s,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(n,i){return typeof i=="string"?i:rx(i)}return wS(t,r,null,e)}function St(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Cf(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function yS(){return Math.random().toString(36).substr(2,8)}function mm(e,t){return{usr:e.state,key:e.key,idx:t}}function Th(e,t,r,n){return r===void 0&&(r=null),Fo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ts(t):t,{state:r,key:t&&t.key||n||yS()})}function rx(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Ts(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function wS(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,l=Vn.Pop,a=null,c=d();c==null&&(c=0,o.replaceState(Fo({},o.state,{idx:c}),""));function d(){return(o.state||{idx:null}).idx}function u(){l=Vn.Pop;let b=d(),g=b==null?null:b-c;c=b,a&&a({action:l,location:_.location,delta:g})}function f(b,g){l=Vn.Push;let v=Th(_.location,b,g);c=d()+1;let y=mm(v,c),k=_.createHref(v);try{o.pushState(y,"",k)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;i.location.assign(k)}s&&a&&a({action:l,location:_.location,delta:1})}function p(b,g){l=Vn.Replace;let v=Th(_.location,b,g);c=d();let y=mm(v,c),k=_.createHref(v);o.replaceState(y,"",k),s&&a&&a({action:l,location:_.location,delta:0})}function m(b){let g=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof b=="string"?b:rx(b);return v=v.replace(/ $/,"%20"),St(g,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,g)}let _={get action(){return l},get location(){return e(i,o)},listen(b){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(pm,u),a=b,()=>{i.removeEventListener(pm,u),a=null}},createHref(b){return t(i,b)},createURL:m,encodeLocation(b){let g=m(b);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:p,go(b){return o.go(b)}};return _}var gm;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(gm||(gm={}));function bS(e,t,r){return r===void 0&&(r="/"),SS(e,t,r)}function SS(e,t,r,n){let i=typeof t=="string"?Ts(t):t,s=sx(i.pathname||"/",r);if(s==null)return null;let o=nx(e);kS(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let c=AS(s);l=IS(o[a],c)}return l}function nx(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let i=(s,o,l)=>{let a={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};a.relativePath.startsWith("/")&&(St(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let c=Pi([n,a.relativePath]),d=r.concat(a);s.children&&s.children.length>0&&(St(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),nx(s.children,t,d,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:RS(c,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let a of ix(s.path))i(s,o,a)}),t}function ix(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=ix(n.join("/")),l=[];return l.push(...o.map(a=>a===""?s:[s,a].join("/"))),i&&l.push(...o),l.map(a=>e.startsWith("/")&&a===""?"/":a)}function kS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:MS(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const CS=/^:[\w-]+$/,ES=3,NS=2,TS=1,PS=10,LS=-2,_m=e=>e==="*";function RS(e,t){let r=e.split("/"),n=r.length;return r.some(_m)&&(n+=LS),t&&(n+=NS),r.filter(i=>!_m(i)).reduce((i,s)=>i+(CS.test(s)?ES:s===""?TS:PS),n)}function MS(e,t){return e.length===t.length&&e.slice(0,-1).every((n,i)=>n===t[i])?e[e.length-1]-t[t.length-1]:0}function IS(e,t,r){let{routesMeta:n}=e,i={},s="/",o=[];for(let l=0;l<n.length;++l){let a=n[l],c=l===n.length-1,d=s==="/"?t:t.slice(s.length)||"/",u=DS({path:a.relativePath,caseSensitive:a.caseSensitive,end:c},d),f=a.route;if(!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Pi([s,u.pathname]),pathnameBase:FS(Pi([s,u.pathnameBase])),route:f}),u.pathnameBase!=="/"&&(s=Pi([s,u.pathnameBase]))}return o}function DS(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=jS(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:n.reduce((c,d,u)=>{let{paramName:f,isOptional:p}=d;if(f==="*"){let _=l[u]||"";o=s.slice(0,s.length-_.length).replace(/(.)\/+$/,"$1")}const m=l[u];return p&&!m?c[f]=void 0:c[f]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function jS(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),Cf(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),n]}function AS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Cf(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function sx(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const BS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,OS=e=>BS.test(e);function zS(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?Ts(e):e,s;if(r)if(OS(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),Cf(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=vm(r.substring(1),"/"):s=vm(r,t)}else s=t;return{pathname:s,search:WS(n),hash:HS(i)}}function vm(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Jc(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function $S(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function ox(e,t){let r=$S(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function lx(e,t,r,n){n===void 0&&(n=!1);let i;typeof e=="string"?i=Ts(e):(i=Fo({},e),St(!i.pathname||!i.pathname.includes("?"),Jc("?","pathname","search",i)),St(!i.pathname||!i.pathname.includes("#"),Jc("#","pathname","hash",i)),St(!i.search||!i.search.includes("#"),Jc("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=r;else{let u=t.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),u-=1;i.pathname=f.join("/")}l=u>=0?t[u]:"/"}let a=zS(i,l),c=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(c||d)&&(a.pathname+="/"),a}const Pi=e=>e.join("/").replace(/\/\/+/g,"/"),FS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),WS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,HS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function US(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const ax=["post","put","patch","delete"];new Set(ax);const VS=["get",...ax];new Set(VS);/**
50
+ * React Router v6.30.3
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */function Wo(){return Wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wo.apply(this,arguments)}const Ef=x.createContext(null),KS=x.createContext(null),tl=x.createContext(null),dc=x.createContext(null),ai=x.createContext({outlet:null,matches:[],isDataRoute:!1}),cx=x.createContext(null);function rl(){return x.useContext(dc)!=null}function nl(){return rl()||St(!1),x.useContext(dc).location}function ux(e){x.useContext(tl).static||x.useLayoutEffect(e)}function En(){let{isDataRoute:e}=x.useContext(ai);return e?sk():qS()}function qS(){rl()||St(!1);let e=x.useContext(Ef),{basename:t,future:r,navigator:n}=x.useContext(tl),{matches:i}=x.useContext(ai),{pathname:s}=nl(),o=JSON.stringify(ox(i,r.v7_relativeSplatPath)),l=x.useRef(!1);return ux(()=>{l.current=!0}),x.useCallback(function(c,d){if(d===void 0&&(d={}),!l.current)return;if(typeof c=="number"){n.go(c);return}let u=lx(c,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:Pi([t,u.pathname])),(d.replace?n.replace:n.push)(u,d.state,d)},[t,n,o,s,e])}function hx(){let{matches:e}=x.useContext(ai),t=e[e.length-1];return t?t.params:{}}function YS(e,t){return XS(e,t)}function XS(e,t,r,n){rl()||St(!1);let{navigator:i}=x.useContext(tl),{matches:s}=x.useContext(ai),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let c=nl(),d;if(t){var u;let b=typeof t=="string"?Ts(t):t;a==="/"||(u=b.pathname)!=null&&u.startsWith(a)||St(!1),d=b}else d=c;let f=d.pathname||"/",p=f;if(a!=="/"){let b=a.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(b.length).join("/")}let m=bS(e,{pathname:p}),_=ek(m&&m.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:Pi([a,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?a:Pi([a,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),s,r,n);return t&&_?x.createElement(dc.Provider,{value:{location:Wo({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Vn.Pop}},_):_}function GS(){let e=ik(),t=US(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),r?x.createElement("pre",{style:i},r):null,null)}const QS=x.createElement(GS,null);class JS extends x.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?x.createElement(ai.Provider,{value:this.props.routeContext},x.createElement(cx.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ZS(e){let{routeContext:t,match:r,children:n}=e,i=x.useContext(Ef);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),x.createElement(ai.Provider,{value:t},n)}function ek(e,t,r,n){var i;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var s;if(!r)return null;if(r.errors)e=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(i=r)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(u=>u.route.id&&(l==null?void 0:l[u.route.id])!==void 0);d>=0||St(!1),o=o.slice(0,Math.min(o.length,d+1))}let a=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<o.length;d++){let u=o[d];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(c=d),u.route.id){let{loaderData:f,errors:p}=r,m=u.route.loader&&f[u.route.id]===void 0&&(!p||p[u.route.id]===void 0);if(u.route.lazy||m){a=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((d,u,f)=>{let p,m=!1,_=null,b=null;r&&(p=l&&u.route.id?l[u.route.id]:void 0,_=u.route.errorElement||QS,a&&(c<0&&f===0?(ok("route-fallback"),m=!0,b=null):c===f&&(m=!0,b=u.route.hydrateFallbackElement||null)));let g=t.concat(o.slice(0,f+1)),v=()=>{let y;return p?y=_:m?y=b:u.route.Component?y=x.createElement(u.route.Component,null):u.route.element?y=u.route.element:y=d,x.createElement(ZS,{match:u,routeContext:{outlet:d,matches:g,isDataRoute:r!=null},children:y})};return r&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?x.createElement(JS,{location:r.location,revalidation:r.revalidation,component:_,error:p,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):v()},null)}var dx=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(dx||{}),fx=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(fx||{});function tk(e){let t=x.useContext(Ef);return t||St(!1),t}function rk(e){let t=x.useContext(KS);return t||St(!1),t}function nk(e){let t=x.useContext(ai);return t||St(!1),t}function px(e){let t=nk(),r=t.matches[t.matches.length-1];return r.route.id||St(!1),r.route.id}function ik(){var e;let t=x.useContext(cx),r=rk(),n=px();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function sk(){let{router:e}=tk(dx.UseNavigateStable),t=px(fx.UseNavigateStable),r=x.useRef(!1);return ux(()=>{r.current=!0}),x.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Wo({fromRouteId:t},s)))},[e,t])}const xm={};function ok(e,t,r){xm[e]||(xm[e]=!0)}function lk(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Zl(e){let{to:t,replace:r,state:n,relative:i}=e;rl()||St(!1);let{future:s,static:o}=x.useContext(tl),{matches:l}=x.useContext(ai),{pathname:a}=nl(),c=En(),d=lx(t,ox(l,s.v7_relativeSplatPath),a,i==="path"),u=JSON.stringify(d);return x.useEffect(()=>c(JSON.parse(u),{replace:r,state:n,relative:i}),[c,u,i,r,n]),null}function dn(e){St(!1)}function ak(e){let{basename:t="/",children:r=null,location:n,navigationType:i=Vn.Pop,navigator:s,static:o=!1,future:l}=e;rl()&&St(!1);let a=t.replace(/^\/*/,"/"),c=x.useMemo(()=>({basename:a,navigator:s,static:o,future:Wo({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof n=="string"&&(n=Ts(n));let{pathname:d="/",search:u="",hash:f="",state:p=null,key:m="default"}=n,_=x.useMemo(()=>{let b=sx(d,a);return b==null?null:{location:{pathname:b,search:u,hash:f,state:p,key:m},navigationType:i}},[a,d,u,f,p,m,i]);return _==null?null:x.createElement(tl.Provider,{value:c},x.createElement(dc.Provider,{children:r,value:_}))}function ck(e){let{children:t,location:r}=e;return YS(Ph(t),r)}new Promise(()=>{});function Ph(e,t){t===void 0&&(t=[]);let r=[];return x.Children.forEach(e,(n,i)=>{if(!x.isValidElement(n))return;let s=[...t,i];if(n.type===x.Fragment){r.push.apply(r,Ph(n.props.children,s));return}n.type!==dn&&St(!1),!n.props.index||!n.props.children||St(!1);let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=Ph(n.props.children,s)),r.push(o)}),r}/**
59
+ * React Router DOM v6.30.3
60
+ *
61
+ * Copyright (c) Remix Software Inc.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE.md file in the root directory of this source tree.
65
+ *
66
+ * @license MIT
67
+ */function Lh(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(i=>[r,i]):[[r,n]])},[]))}function uk(e,t){let r=Lh(e);return t&&t.forEach((n,i)=>{r.has(i)||t.getAll(i).forEach(s=>{r.append(i,s)})}),r}const hk="6";try{window.__reactRouterVersion=hk}catch{}const dk="startTransition",ym=aw[dk];function fk(e){let{basename:t,children:r,future:n,window:i}=e,s=x.useRef();s.current==null&&(s.current=xS({window:i,v5Compat:!0}));let o=s.current,[l,a]=x.useState({action:o.action,location:o.location}),{v7_startTransition:c}=n||{},d=x.useCallback(u=>{c&&ym?ym(()=>a(u)):a(u)},[a,c]);return x.useLayoutEffect(()=>o.listen(d),[o,d]),x.useEffect(()=>lk(n),[n]),x.createElement(ak,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}var wm;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(wm||(wm={}));var bm;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(bm||(bm={}));function mx(e){let t=x.useRef(Lh(e)),r=x.useRef(!1),n=nl(),i=x.useMemo(()=>uk(n.search,r.current?null:t.current),[n.search]),s=En(),o=x.useCallback((l,a)=>{const c=Lh(typeof l=="function"?l(i):l);r.current=!0,s("?"+c,a)},[s,i]);return[i,o]}const gx=x.createContext({ides:[],updateIdeChats:()=>{},screenshotMap:{},setScreenshotMap:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{},wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1,userName:void 0,setUserName:()=>{},isP2PActive:!1,p2pStates:{},userRole:void 0}),_x=x.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function pk(e,t){var o,l,a,c;const r=Date.now();if(t.length===0)return e.map(d=>({...d,_lastUpdate:r}));const n=new Map;for(const d of t)n.set(d.id,d);for(const d of e){const u=n.get(d.id);if(!u){n.set(d.id,{...d,_lastUpdate:r});continue}const f=d.timestamp||r,p=u._lastUpdate||u.timestamp||0;if(f>=p){const m=(o=d.chats)!=null&&o.length?d.chats:u.chats;n.set(d.id,{...u,...d,chats:m,_lastUpdate:r})}else(l=d.chats)!=null&&l.length&&!((a=u.chats)!=null&&a.length)&&n.set(d.id,{...u,chats:d.chats})}const i=new Set(e.map(d=>d.id)),s=new Set;for(const d of e){const u=d.daemonId||((c=d.id)==null?void 0:c.split(":")[0]);u&&s.add(u)}for(const[d,u]of n){const f=u.daemonId||d.split(":")[0];if(!s.has(f))continue;const p=r-(u._lastUpdate||u.timestamp||0);(d.includes(":cli:")&&!i.has(d)&&p>1e4||d.includes(":acp:")&&!i.has(d)&&p>1e4||d.includes(":ide:")&&!i.has(d)&&p>3e4)&&n.delete(d)}for(const[d,u]of n)r-(u._lastUpdate||u.timestamp||0)>3e5&&u.status!=="online"&&n.delete(d);return Array.from(n.values())}function mk({children:e,connectionOverrides:t}){const[r,n]=x.useState([]),[i,s]=x.useState({}),[o,l]=x.useState(!1),[a,c]=x.useState([]),[d,u]=x.useState(void 0),f=x.useCallback((_,b)=>{n(g=>g.map(v=>v.id===_?{...v,chats:b}:v))},[]),p={injectEntries:_=>{n(b=>b.length===0?_:pk(_,b))},markLoaded:()=>l(!0),getIdes:()=>r},m=t;return h.jsx(_x.Provider,{value:p,children:h.jsx(gx.Provider,{value:{ides:r,updateIdeChats:f,screenshotMap:i,setScreenshotMap:s,initialLoaded:o,toasts:a,setToasts:c,wsStatus:(m==null?void 0:m.wsStatus)??"connected",isConnected:(m==null?void 0:m.isConnected)??!0,connectionStates:(m==null?void 0:m.connectionStates)??{},connectionTransports:(m==null?void 0:m.connectionTransports)??{},showReconnected:(m==null?void 0:m.showReconnected)??!1,retryConnection:m==null?void 0:m.retryConnection,isP2PActive:(m==null?void 0:m.isP2PActive)??!1,p2pStates:(m==null?void 0:m.p2pStates)??{},userRole:m==null?void 0:m.userRole,userName:d,setUserName:u},children:e})})}function Ho(){return x.useContext(gx)}function Sm(){return x.useContext(_x)}function gk(e){const{baseUrl:t,getToken:r,onUnauthorized:n}=e;async function i(s,o={}){const l={"Content-Type":"application/json",...o.headers||{}},a=r==null?void 0:r();a&&(l.Authorization=`Bearer ${a}`);const c=s.startsWith("http")?s:`${t}${s.startsWith("/")?"":"/"}${s}`,d=await fetch(c,{...o,headers:l});if(d.status===401)throw n==null||n(),new Error("Unauthorized");if(!d.ok){const u=await d.json().catch(()=>({error:d.statusText}));throw new Error(u.error||`API Error: ${d.status}`)}return d.json()}return{getDaemons:()=>i("/api/v1/daemons"),getDaemonStatus:s=>i(`/api/v1/daemons/${s}/status`),sendCommand:(s,o,l={})=>i(`/api/v1/daemons/${s}/command`,{method:"POST",body:JSON.stringify({type:o,payload:l})}),execTerminal:(s,o,l)=>i(`/api/v1/daemons/${s}/terminal`,{method:"POST",body:JSON.stringify({command:o,name:l})}),sendAgentMessage:(s,o,l)=>i(`/api/v1/shortcuts/${s}/chat`,{method:"POST",body:JSON.stringify({agentType:o,message:l})}),getAgentStatus:s=>i(`/api/v1/shortcuts/${s}/status`),approveAgent:(s,o,l)=>i(`/api/v1/shortcuts/${s}/approve`,{method:"POST",body:JSON.stringify({agentType:o,action:l?"approve":"reject"})}),request:i}}const _k=gk({baseUrl:"http://localhost:3847"});x.createContext(_k);const vk={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},vx=x.createContext(vk);function xk({value:e,children:t}){return h.jsx(vx.Provider,{value:e,children:t})}function ci(){return x.useContext(vx)}function yk(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const wk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Sk={};function km(e,t){return(Sk.jsx?bk:wk).test(e)}const kk=/[ \t\n\f\r]/g;function Ck(e){return typeof e=="object"?e.type==="text"?Cm(e.value):!1:Cm(e)}function Cm(e){return e.replace(kk,"")===""}class il{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}il.prototype.normal={};il.prototype.property={};il.prototype.space=void 0;function xx(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new il(r,n,t)}function Rh(e){return e.toLowerCase()}class dr{constructor(t,r){this.attribute=r,this.property=t}}dr.prototype.attribute="";dr.prototype.booleanish=!1;dr.prototype.boolean=!1;dr.prototype.commaOrSpaceSeparated=!1;dr.prototype.commaSeparated=!1;dr.prototype.defined=!1;dr.prototype.mustUseProperty=!1;dr.prototype.number=!1;dr.prototype.overloadedBoolean=!1;dr.prototype.property="";dr.prototype.spaceSeparated=!1;dr.prototype.space=void 0;let Ek=0;const Re=Fi(),xt=Fi(),Mh=Fi(),re=Fi(),et=Fi(),ms=Fi(),gr=Fi();function Fi(){return 2**++Ek}const Ih=Object.freeze(Object.defineProperty({__proto__:null,boolean:Re,booleanish:xt,commaOrSpaceSeparated:gr,commaSeparated:ms,number:re,overloadedBoolean:Mh,spaceSeparated:et},Symbol.toStringTag,{value:"Module"})),Zc=Object.keys(Ih);class Nf extends dr{constructor(t,r,n,i){let s=-1;if(super(t,r),Em(this,"space",i),typeof n=="number")for(;++s<Zc.length;){const o=Zc[s];Em(this,Zc[s],(n&Ih[o])===Ih[o])}}}Nf.prototype.defined=!0;function Em(e,t,r){r&&(e[t]=r)}function Ps(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new Nf(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[Rh(n)]=n,r[Rh(s.attribute)]=n}return new il(t,r,e.space)}const yx=Ps({properties:{ariaActiveDescendant:null,ariaAtomic:xt,ariaAutoComplete:null,ariaBusy:xt,ariaChecked:xt,ariaColCount:re,ariaColIndex:re,ariaColSpan:re,ariaControls:et,ariaCurrent:null,ariaDescribedBy:et,ariaDetails:null,ariaDisabled:xt,ariaDropEffect:et,ariaErrorMessage:null,ariaExpanded:xt,ariaFlowTo:et,ariaGrabbed:xt,ariaHasPopup:null,ariaHidden:xt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:et,ariaLevel:re,ariaLive:null,ariaModal:xt,ariaMultiLine:xt,ariaMultiSelectable:xt,ariaOrientation:null,ariaOwns:et,ariaPlaceholder:null,ariaPosInSet:re,ariaPressed:xt,ariaReadOnly:xt,ariaRelevant:null,ariaRequired:xt,ariaRoleDescription:et,ariaRowCount:re,ariaRowIndex:re,ariaRowSpan:re,ariaSelected:xt,ariaSetSize:re,ariaSort:null,ariaValueMax:re,ariaValueMin:re,ariaValueNow:re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function wx(e,t){return t in e?e[t]:t}function bx(e,t){return wx(e,t.toLowerCase())}const Nk=Ps({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ms,acceptCharset:et,accessKey:et,action:null,allow:null,allowFullScreen:Re,allowPaymentRequest:Re,allowUserMedia:Re,alt:null,as:null,async:Re,autoCapitalize:null,autoComplete:et,autoFocus:Re,autoPlay:Re,blocking:et,capture:null,charSet:null,checked:Re,cite:null,className:et,cols:re,colSpan:null,content:null,contentEditable:xt,controls:Re,controlsList:et,coords:re|ms,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Re,defer:Re,dir:null,dirName:null,disabled:Re,download:Mh,draggable:xt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Re,formTarget:null,headers:et,height:re,hidden:Mh,high:re,href:null,hrefLang:null,htmlFor:et,httpEquiv:et,id:null,imageSizes:null,imageSrcSet:null,inert:Re,inputMode:null,integrity:null,is:null,isMap:Re,itemId:null,itemProp:et,itemRef:et,itemScope:Re,itemType:et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Re,low:re,manifest:null,max:null,maxLength:re,media:null,method:null,min:null,minLength:re,multiple:Re,muted:Re,name:null,nonce:null,noModule:Re,noValidate:Re,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Re,optimum:re,pattern:null,ping:et,placeholder:null,playsInline:Re,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Re,referrerPolicy:null,rel:et,required:Re,reversed:Re,rows:re,rowSpan:re,sandbox:et,scope:null,scoped:Re,seamless:Re,selected:Re,shadowRootClonable:Re,shadowRootDelegatesFocus:Re,shadowRootMode:null,shape:null,size:re,sizes:null,slot:null,span:re,spellCheck:xt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:re,step:null,style:null,tabIndex:re,target:null,title:null,translate:null,type:null,typeMustMatch:Re,useMap:null,value:xt,width:re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:et,axis:null,background:null,bgColor:null,border:re,borderColor:null,bottomMargin:re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Re,declare:Re,event:null,face:null,frame:null,frameBorder:null,hSpace:re,leftMargin:re,link:null,longDesc:null,lowSrc:null,marginHeight:re,marginWidth:re,noResize:Re,noHref:Re,noShade:Re,noWrap:Re,object:null,profile:null,prompt:null,rev:null,rightMargin:re,rules:null,scheme:null,scrolling:xt,standby:null,summary:null,text:null,topMargin:re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Re,disableRemotePlayback:Re,prefix:null,property:null,results:re,security:null,unselectable:null},space:"html",transform:bx}),Tk=Ps({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gr,accentHeight:re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:re,amplitude:re,arabicForm:null,ascent:re,attributeName:null,attributeType:null,azimuth:re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:re,by:null,calcMode:null,capHeight:re,className:et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:re,diffuseConstant:re,direction:null,display:null,dur:null,divisor:re,dominantBaseline:null,download:Re,dx:null,dy:null,edgeMode:null,editable:null,elevation:re,enableBackground:null,end:null,event:null,exponent:re,externalResourcesRequired:null,fill:null,fillOpacity:re,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ms,g2:ms,glyphName:ms,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:re,horizOriginX:re,horizOriginY:re,id:null,ideographic:re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:re,k:re,k1:re,k2:re,k3:re,k4:re,kernelMatrix:gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:re,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:re,overlineThickness:re,paintOrder:null,panose1:null,path:null,pathLength:re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:re,pointsAtY:re,pointsAtZ:re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gr,rev:gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gr,requiredFeatures:gr,requiredFonts:gr,requiredFormats:gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:re,specularExponent:re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:re,strikethroughThickness:re,string:null,stroke:null,strokeDashArray:gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:re,strokeOpacity:re,strokeWidth:null,style:null,surfaceScale:re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gr,tabIndex:re,tableValues:null,target:null,targetX:re,targetY:re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:re,underlineThickness:re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:re,values:null,vAlphabetic:re,vMathematical:re,vectorEffect:null,vHanging:re,vIdeographic:re,version:null,vertAdvY:re,vertOriginX:re,vertOriginY:re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:wx}),Sx=Ps({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),kx=Ps({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bx}),Cx=Ps({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Pk={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Lk=/[A-Z]/g,Nm=/-[a-z]/g,Rk=/^data[-\w.:]+$/i;function Mk(e,t){const r=Rh(t);let n=t,i=dr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Rk.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Nm,Dk);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Nm.test(s)){let o=s.replace(Lk,Ik);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Nf}return new i(n,t)}function Ik(e){return"-"+e.toLowerCase()}function Dk(e){return e.charAt(1).toUpperCase()}const jk=xx([yx,Nk,Sx,kx,Cx],"html"),Tf=xx([yx,Tk,Sx,kx,Cx],"svg");function Ak(e){return e.join(" ").trim()}var Pf={},Tm=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Bk=/\n/g,Ok=/^\s*/,zk=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,$k=/^:\s*/,Fk=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Wk=/^[;\s]*/,Hk=/^\s+|\s+$/g,Uk=`
68
+ `,Pm="/",Lm="*",bi="",Vk="comment",Kk="declaration";function qk(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function i(m){var _=m.match(Bk);_&&(r+=_.length);var b=m.lastIndexOf(Uk);n=~b?m.length-b:n+m.length}function s(){var m={line:r,column:n};return function(_){return _.position=new o(m),c(),_}}function o(m){this.start=m,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(m){var _=new Error(t.source+":"+r+":"+n+": "+m);if(_.reason=m,_.filename=t.source,_.line=r,_.column=n,_.source=e,!t.silent)throw _}function a(m){var _=m.exec(e);if(_){var b=_[0];return i(b),e=e.slice(b.length),_}}function c(){a(Ok)}function d(m){var _;for(m=m||[];_=u();)_!==!1&&m.push(_);return m}function u(){var m=s();if(!(Pm!=e.charAt(0)||Lm!=e.charAt(1))){for(var _=2;bi!=e.charAt(_)&&(Lm!=e.charAt(_)||Pm!=e.charAt(_+1));)++_;if(_+=2,bi===e.charAt(_-1))return l("End of comment missing");var b=e.slice(2,_-2);return n+=2,i(b),e=e.slice(_),n+=2,m({type:Vk,comment:b})}}function f(){var m=s(),_=a(zk);if(_){if(u(),!a($k))return l("property missing ':'");var b=a(Fk),g=m({type:Kk,property:Rm(_[0].replace(Tm,bi)),value:b?Rm(b[0].replace(Tm,bi)):bi});return a(Wk),g}}function p(){var m=[];d(m);for(var _;_=f();)_!==!1&&(m.push(_),d(m));return m}return c(),p()}function Rm(e){return e?e.replace(Hk,bi):bi}var Yk=qk,Xk=ha&&ha.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Pf,"__esModule",{value:!0});Pf.default=Qk;const Gk=Xk(Yk);function Qk(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,Gk.default)(e),i=typeof t=="function";return n.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(r=r||{},r[o]=l)}),r}var fc={};Object.defineProperty(fc,"__esModule",{value:!0});fc.camelCase=void 0;var Jk=/^--[a-zA-Z0-9_-]+$/,Zk=/-([a-z])/g,eC=/^[^-]+$/,tC=/^-(webkit|moz|ms|o|khtml)-/,rC=/^-(ms)-/,nC=function(e){return!e||eC.test(e)||Jk.test(e)},iC=function(e,t){return t.toUpperCase()},Mm=function(e,t){return"".concat(t,"-")},sC=function(e,t){return t===void 0&&(t={}),nC(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(rC,Mm):e=e.replace(tC,Mm),e.replace(Zk,iC))};fc.camelCase=sC;var oC=ha&&ha.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},lC=oC(Pf),aC=fc;function Dh(e,t){var r={};return!e||typeof e!="string"||(0,lC.default)(e,function(n,i){n&&i&&(r[(0,aC.camelCase)(n,t)]=i)}),r}Dh.default=Dh;var cC=Dh;const uC=Pd(cC),Ex=Nx("end"),Lf=Nx("start");function Nx(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function hC(e){const t=Lf(e),r=Ex(e);if(t&&r)return{start:t,end:r}}function yo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Im(e.position):"start"in e||"end"in e?Im(e):"line"in e||"column"in e?jh(e):""}function jh(e){return Dm(e&&e.line)+":"+Dm(e&&e.column)}function Im(e){return jh(e&&e.start)+"-"+jh(e&&e.end)}function Dm(e){return e&&typeof e=="number"?e:1}class Gt extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof n=="string"){const a=n.indexOf(":");a===-1?s.ruleId=n:(s.source=n.slice(0,a),s.ruleId=n.slice(a+1))}if(!s.place&&s.ancestors&&s.ancestors){const a=s.ancestors[s.ancestors.length-1];a&&(s.place=a.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=yo(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gt.prototype.file="";Gt.prototype.name="";Gt.prototype.reason="";Gt.prototype.message="";Gt.prototype.stack="";Gt.prototype.column=void 0;Gt.prototype.line=void 0;Gt.prototype.ancestors=void 0;Gt.prototype.cause=void 0;Gt.prototype.fatal=void 0;Gt.prototype.place=void 0;Gt.prototype.ruleId=void 0;Gt.prototype.source=void 0;const Rf={}.hasOwnProperty,dC=new Map,fC=/[A-Z]/g,pC=new Set(["table","tbody","thead","tfoot","tr"]),mC=new Set(["td","th"]),Tx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=kC(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=SC(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Tf:jk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Px(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function Px(e,t,r){if(t.type==="element")return _C(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return vC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return yC(e,t,r);if(t.type==="mdxjsEsm")return xC(e,t);if(t.type==="root")return wC(e,t,r);if(t.type==="text")return bC(e,t)}function _C(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Tf,e.schema=i),e.ancestors.push(t);const s=Rx(e,t.tagName,!1),o=CC(e,t);let l=If(e,t);return pC.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Ck(a):!0})),Lx(e,o,s,t),Mf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function vC(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Uo(e,t.position)}function xC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Uo(e,t.position)}function yC(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=Tf,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:Rx(e,t.name,!0),o=EC(e,t),l=If(e,t);return Lx(e,o,s,t),Mf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function wC(e,t,r){const n={};return Mf(n,If(e,t)),e.create(t,e.Fragment,n,r)}function bC(e,t){return t.value}function Lx(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function Mf(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function SC(e,t,r){return n;function n(i,s,o,l){const c=Array.isArray(o.children)?r:t;return l?c(s,o,l):c(s,o)}}function kC(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),a=Lf(n);return t(i,s,o,l,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function CC(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&Rf.call(t.properties,i)){const s=NC(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&mC.has(t.tagName)?n=l:r[o]=l}}if(n){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function EC(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else Uo(e,t.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const l=n.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else Uo(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function If(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:dC;for(;++n<t.children.length;){const s=t.children[n];let o;if(e.passKeys){const a=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(a){const c=i.get(a)||0;o=a+"-"+c,i.set(a,c+1)}}const l=Px(e,s,o);l!==void 0&&r.push(l)}return r}function NC(e,t,r){const n=Mk(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?yk(r):Ak(r)),n.property==="style"){let i=typeof r=="object"?r:TC(e,String(r));return e.stylePropertyNameCase==="css"&&(i=PC(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?Pk[n.property]||n.property:n.attribute,r]}}function TC(e,t){try{return uC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new Gt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Tx+"#cannot-parse-style-attribute",i}}function Rx(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=km(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}n=o}else n=km(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return Rf.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);Uo(e)}function Uo(e,t){const r=new Gt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Tx+"#cannot-handle-mdx-estrees-without-createevaluater",r}function PC(e){const t={};let r;for(r in e)Rf.call(e,r)&&(t[LC(r)]=e[r]);return t}function LC(e){let t=e.replace(fC,RC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function RC(e){return"-"+e.toLowerCase()}const eu={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},MC={};function Df(e,t){const r=MC,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Mx(e,n,i)}function Mx(e,t,r){if(IC(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return jm(e.children,t,r)}return Array.isArray(e)?jm(e,t,r):""}function jm(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=Mx(e[i],t,r);return n.join("")}function IC(e){return!!(e&&typeof e=="object")}const Am=document.createElement("i");function jf(e){const t="&"+e+";";Am.innerHTML=t;const r=Am.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function wr(e,t,r,n){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function Rr(e,t){return e.length>0?(wr(e,e.length,0,t),e):t}const Bm={}.hasOwnProperty;function Ix(e){const t={};let r=-1;for(;++r<e.length;)DC(t,e[r]);return t}function DC(e,t){let r;for(r in t){const i=(Bm.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){Bm.call(i,o)||(i[o]=[]);const l=s[o];jC(i[o],Array.isArray(l)?l:l?[l]:[])}}}function jC(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);wr(e,0,0,n)}function Dx(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Kr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zt=ui(/[A-Za-z]/),Yt=ui(/[\dA-Za-z]/),AC=ui(/[#-'*+\--9=?A-Z^-~]/);function Aa(e){return e!==null&&(e<32||e===127)}const Ah=ui(/\d/),BC=ui(/[\dA-Fa-f]/),OC=ui(/[!-/:-@[-`{-~]/);function we(e){return e!==null&&e<-2}function Ze(e){return e!==null&&(e<0||e===32)}function ze(e){return e===-2||e===-1||e===32}const pc=ui(new RegExp("\\p{P}|\\p{S}","u")),Ai=ui(/\s/);function ui(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Ls(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&Yt(e.charCodeAt(r+1))&&Yt(e.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(r+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function Ue(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return ze(a)?(e.enter(r),l(a)):t(a)}function l(a){return ze(a)&&s++<i?(e.consume(a),l):(e.exit(r),t(a))}}const zC={tokenize:$C};function $C(e){const t=e.attempt(this.parser.constructs.contentInitial,n,i);let r;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ue(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const a=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=a),r=a,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return we(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const FC={tokenize:WC},Om={tokenize:HC};function WC(e){const t=this,r=[];let n=0,i,s,o;return l;function l(y){if(n<r.length){const k=r[n];return t.containerState=k[1],e.attempt(k[0].continuation,a,c)(y)}return c(y)}function a(y){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const k=t.events.length;let L=k,S;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){S=t.events[L][1].end;break}g(n);let j=k;for(;j<t.events.length;)t.events[j][1].end={...S},j++;return wr(t.events,L+1,0,t.events.slice(k)),t.events.length=j,c(y)}return l(y)}function c(y){if(n===r.length){if(!i)return f(y);if(i.currentConstruct&&i.currentConstruct.concrete)return m(y);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Om,d,u)(y)}function d(y){return i&&v(),g(n),f(y)}function u(y){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,m(y)}function f(y){return t.containerState={},e.attempt(Om,p,m)(y)}function p(y){return n++,r.push([t.currentConstruct,t.containerState]),f(y)}function m(y){if(y===null){i&&v(),g(0),e.consume(y);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),_(y)}function _(y){if(y===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(y);return}return we(y)?(e.consume(y),b(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(y),_)}function b(y,k){const L=t.sliceStream(y);if(k&&L.push(null),y.previous=s,s&&(s.next=y),s=y,i.defineSkip(y.start),i.write(L),t.parser.lazy[y.start.line]){let S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<o&&(!i.events[S][1].end||i.events[S][1].end.offset>o))return;const j=t.events.length;let T=j,B,E;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(B){E=t.events[T][1].end;break}B=!0}for(g(n),S=j;S<t.events.length;)t.events[S][1].end={...E},S++;wr(t.events,T+1,0,t.events.slice(j)),t.events.length=S}}function g(y){let k=r.length;for(;k-- >y;){const L=r[k];t.containerState=L[1],L[0].exit.call(t,e)}r.length=y}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function HC(e,t,r){return Ue(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ss(e){if(e===null||Ze(e)||Ai(e))return 1;if(pc(e))return 2}function mc(e,t,r){const n=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!n.includes(s)&&(t=s(t,r),n.push(s))}return t}const Bh={name:"attention",resolveAll:UC,tokenize:VC};function UC(e,t){let r=-1,n,i,s,o,l,a,c,d;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const u={...e[n][1].end},f={...e[r][1].start};zm(u,-a),zm(f,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:f},s={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:a>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[n][1].end={...o.start},e[r][1].start={...l.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=Rr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=Rr(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=Rr(c,mc(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=Rr(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(d=2,c=Rr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):d=0,wr(e,n-1,r-n+3,c),r=n+c.length-d-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function VC(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Ss(n);let s;return o;function o(a){return s=a,e.enter("attentionSequence"),l(a)}function l(a){if(a===s)return e.consume(a),l;const c=e.exit("attentionSequence"),d=Ss(a),u=!d||d===2&&i||r.includes(a),f=!i||i===2&&d||r.includes(n);return c._open=!!(s===42?u:u&&(i||!f)),c._close=!!(s===42?f:f&&(d||!u)),t(a)}}function zm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const KC={name:"autolink",tokenize:qC};function qC(e,t,r){let n=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return Zt(p)?(e.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||Yt(p)?(n=1,l(p)):c(p)}function l(p){return p===58?(e.consume(p),n=0,a):(p===43||p===45||p===46||Yt(p))&&n++<32?(e.consume(p),l):(n=0,c(p))}function a(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Aa(p)?r(p):(e.consume(p),a)}function c(p){return p===64?(e.consume(p),d):AC(p)?(e.consume(p),c):r(p)}function d(p){return Yt(p)?u(p):r(p)}function u(p){return p===46?(e.consume(p),n=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||Yt(p))&&n++<63){const m=p===45?f:u;return e.consume(p),m}return r(p)}}const sl={partial:!0,tokenize:YC};function YC(e,t,r){return n;function n(s){return ze(s)?Ue(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||we(s)?t(s):r(s)}}const jx={continuation:{tokenize:GC},exit:QC,name:"blockQuote",tokenize:XC};function XC(e,t,r){const n=this;return i;function i(o){if(o===62){const l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return r(o)}function s(o){return ze(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function GC(e,t,r){const n=this;return i;function i(o){return ze(o)?Ue(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(jx,t,r)(o)}}function QC(e){e.exit("blockQuote")}const Ax={name:"characterEscape",tokenize:JC};function JC(e,t,r){return n;function n(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return OC(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const Bx={name:"characterReference",tokenize:ZC};function ZC(e,t,r){const n=this;let i=0,s,o;return l;function l(u){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),a}function a(u){return u===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(u),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=Yt,d(u))}function c(u){return u===88||u===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(u),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=BC,d):(e.enter("characterReferenceValue"),s=7,o=Ah,d(u))}function d(u){if(u===59&&i){const f=e.exit("characterReferenceValue");return o===Yt&&!jf(n.sliceSerialize(f))?r(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(u)&&i++<s?(e.consume(u),d):r(u)}}const $m={partial:!0,tokenize:t2},Fm={concrete:!0,name:"codeFenced",tokenize:e2};function e2(e,t,r){const n=this,i={partial:!0,tokenize:L};let s=0,o=0,l;return a;function a(S){return c(S)}function c(S){const j=n.events[n.events.length-1];return s=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,l=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(S)}function d(S){return S===l?(o++,e.consume(S),d):o<3?r(S):(e.exit("codeFencedFenceSequence"),ze(S)?Ue(e,u,"whitespace")(S):u(S))}function u(S){return S===null||we(S)?(e.exit("codeFencedFence"),n.interrupt?t(S):e.check($m,_,k)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(S))}function f(S){return S===null||we(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(S)):ze(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ue(e,p,"whitespace")(S)):S===96&&S===l?r(S):(e.consume(S),f)}function p(S){return S===null||we(S)?u(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||we(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(S)):S===96&&S===l?r(S):(e.consume(S),m)}function _(S){return e.attempt(i,k,b)(S)}function b(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),g}function g(S){return s>0&&ze(S)?Ue(e,v,"linePrefix",s+1)(S):v(S)}function v(S){return S===null||we(S)?e.check($m,_,k)(S):(e.enter("codeFlowValue"),y(S))}function y(S){return S===null||we(S)?(e.exit("codeFlowValue"),v(S)):(e.consume(S),y)}function k(S){return e.exit("codeFenced"),t(S)}function L(S,j,T){let B=0;return E;function E(z){return S.enter("lineEnding"),S.consume(z),S.exit("lineEnding"),O}function O(z){return S.enter("codeFencedFence"),ze(z)?Ue(S,R,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):R(z)}function R(z){return z===l?(S.enter("codeFencedFenceSequence"),C(z)):T(z)}function C(z){return z===l?(B++,S.consume(z),C):B>=o?(S.exit("codeFencedFenceSequence"),ze(z)?Ue(S,P,"whitespace")(z):P(z)):T(z)}function P(z){return z===null||we(z)?(S.exit("codeFencedFence"),j(z)):T(z)}}}function t2(e,t,r){const n=this;return i;function i(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}const tu={name:"codeIndented",tokenize:n2},r2={partial:!0,tokenize:i2};function n2(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Ue(e,s,"linePrefix",5)(c)}function s(c){const d=n.events[n.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?a(c):we(c)?e.attempt(r2,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||we(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function i2(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):we(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ue(e,s,"linePrefix",5)(o)}function s(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):we(o)?i(o):r(o)}}const s2={name:"codeText",previous:l2,resolve:o2,tokenize:a2};function o2(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="codeTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function l2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function a2(e,t,r){let n=0,i,s;return o;function o(u){return e.enter("codeText"),e.enter("codeTextSequence"),l(u)}function l(u){return u===96?(e.consume(u),n++,l):(e.exit("codeTextSequence"),a(u))}function a(u){return u===null?r(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),a):u===96?(s=e.enter("codeTextSequence"),i=0,d(u)):we(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):(e.enter("codeTextData"),c(u))}function c(u){return u===null||u===32||u===96||we(u)?(e.exit("codeTextData"),a(u)):(e.consume(u),c)}function d(u){return u===96?(e.consume(u),i++,d):i===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(s.type="codeTextData",c(u))}}class c2{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Us(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Us(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Us(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Us(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Us(this.left,r.reverse())}}}function Us(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function Ox(e){const t={};let r=-1,n,i,s,o,l,a,c;const d=new c2(e);for(;++r<d.length;){for(;r in t;)r=t[r];if(n=d.get(r),r&&n[1].type==="chunkFlow"&&d.get(r-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,s=0,s<a.length&&a[s][1].type==="lineEndingBlank"&&(s+=2),s<a.length&&a[s][1].type==="content"))for(;++s<a.length&&a[s][1].type!=="content";)a[s][1].type==="chunkText"&&(a[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,u2(d,r)),r=t[r],c=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...d.get(i)[1].start},l=d.slice(i,r),l.unshift(n),d.splice(i,r-i+1,l))}}return wr(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function u2(e,t){const r=e.get(t)[1],n=e.get(t)[2];let i=t-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,a=[],c={};let d,u,f=-1,p=r,m=0,_=0;const b=[_];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(d=n.sliceStream(p),p.next||d.push(null),u&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),u=p,p=p.next}for(p=r;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(_=f+1,b.push(_),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),f=b.length;f--;){const g=l.slice(b[f],b[f+1]),v=s.pop();a.push([v,v+g.length-1]),e.splice(v,2,g)}for(a.reverse(),f=-1;++f<a.length;)c[m+a[f][0]]=m+a[f][1],m+=a[f][1]-a[f][0]-1;return c}const h2={resolve:f2,tokenize:p2},d2={partial:!0,tokenize:m2};function f2(e){return Ox(e),e}function p2(e,t){let r;return n;function n(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):we(l)?e.check(d2,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function m2(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ue(e,s,"linePrefix")}function s(o){if(o===null||we(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function zx(e,t,r,n,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let d=0;return u;function u(g){return g===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(g),e.exit(s),f):g===null||g===32||g===41||Aa(g)?r(g):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),_(g))}function f(g){return g===62?(e.enter(s),e.consume(g),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(l),f(g)):g===null||g===60||we(g)?r(g):(e.consume(g),g===92?m:p)}function m(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function _(g){return!d&&(g===null||g===41||Ze(g))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(g)):d<c&&g===40?(e.consume(g),d++,_):g===41?(e.consume(g),d--,_):g===null||g===32||g===40||Aa(g)?r(g):(e.consume(g),g===92?b:_)}function b(g){return g===40||g===41||g===92?(e.consume(g),_):_(g)}}function $x(e,t,r,n,i,s){const o=this;let l=0,a;return c;function c(p){return e.enter(n),e.enter(i),e.consume(p),e.exit(i),e.enter(s),d}function d(p){return l>999||p===null||p===91||p===93&&!a||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(n),t):we(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===null||p===91||p===93||we(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),a||(a=!ze(p)),p===92?f:u)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,u):u(p)}}function Fx(e,t,r,n,i,s){let o;return l;function l(f){return f===34||f===39||f===40?(e.enter(n),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,a):r(f)}function a(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(n),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),a(o)):f===null?r(f):we(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ue(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||we(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?u:d)}function u(f){return f===o||f===92?(e.consume(f),d):d(f)}}function wo(e,t){let r;return n;function n(i){return we(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):ze(i)?Ue(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const g2={name:"definition",tokenize:v2},_2={partial:!0,tokenize:x2};function v2(e,t,r){const n=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return $x.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=Kr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),a):r(p)}function a(p){return Ze(p)?wo(e,c)(p):c(p)}function c(p){return zx(e,d,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(_2,u,u)(p)}function u(p){return ze(p)?Ue(e,f,"whitespace")(p):f(p)}function f(p){return p===null||we(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function x2(e,t,r){return n;function n(l){return Ze(l)?wo(e,i)(l):r(l)}function i(l){return Fx(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return ze(l)?Ue(e,o,"whitespace")(l):o(l)}function o(l){return l===null||we(l)?t(l):r(l)}}const y2={name:"hardBreakEscape",tokenize:w2};function w2(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return we(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const b2={name:"headingAtx",resolve:S2,tokenize:k2};function S2(e,t){let r=e.length-2,n=3,i,s;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},s={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},wr(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function k2(e,t,r){let n=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&n++<6?(e.consume(d),o):d===null||Ze(d)?(e.exit("atxHeadingSequence"),l(d)):r(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),a(d)):d===null||we(d)?(e.exit("atxHeading"),t(d)):ze(d)?Ue(e,l,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function a(d){return d===35?(e.consume(d),a):(e.exit("atxHeadingSequence"),l(d))}function c(d){return d===null||d===35||Ze(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const C2=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Wm=["pre","script","style","textarea"],E2={concrete:!0,name:"htmlFlow",resolveTo:P2,tokenize:L2},N2={partial:!0,tokenize:M2},T2={partial:!0,tokenize:R2};function P2(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function L2(e,t,r){const n=this;let i,s,o,l,a;return c;function c(N){return d(N)}function d(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),u}function u(N){return N===33?(e.consume(N),f):N===47?(e.consume(N),s=!0,_):N===63?(e.consume(N),i=3,n.interrupt?t:w):Zt(N)?(e.consume(N),o=String.fromCharCode(N),b):r(N)}function f(N){return N===45?(e.consume(N),i=2,p):N===91?(e.consume(N),i=5,l=0,m):Zt(N)?(e.consume(N),i=4,n.interrupt?t:w):r(N)}function p(N){return N===45?(e.consume(N),n.interrupt?t:w):r(N)}function m(N){const q="CDATA[";return N===q.charCodeAt(l++)?(e.consume(N),l===q.length?n.interrupt?t:R:m):r(N)}function _(N){return Zt(N)?(e.consume(N),o=String.fromCharCode(N),b):r(N)}function b(N){if(N===null||N===47||N===62||Ze(N)){const q=N===47,I=o.toLowerCase();return!q&&!s&&Wm.includes(I)?(i=1,n.interrupt?t(N):R(N)):C2.includes(o.toLowerCase())?(i=6,q?(e.consume(N),g):n.interrupt?t(N):R(N)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(N):s?v(N):y(N))}return N===45||Yt(N)?(e.consume(N),o+=String.fromCharCode(N),b):r(N)}function g(N){return N===62?(e.consume(N),n.interrupt?t:R):r(N)}function v(N){return ze(N)?(e.consume(N),v):E(N)}function y(N){return N===47?(e.consume(N),E):N===58||N===95||Zt(N)?(e.consume(N),k):ze(N)?(e.consume(N),y):E(N)}function k(N){return N===45||N===46||N===58||N===95||Yt(N)?(e.consume(N),k):L(N)}function L(N){return N===61?(e.consume(N),S):ze(N)?(e.consume(N),L):y(N)}function S(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),a=N,j):ze(N)?(e.consume(N),S):T(N)}function j(N){return N===a?(e.consume(N),a=null,B):N===null||we(N)?r(N):(e.consume(N),j)}function T(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Ze(N)?L(N):(e.consume(N),T)}function B(N){return N===47||N===62||ze(N)?y(N):r(N)}function E(N){return N===62?(e.consume(N),O):r(N)}function O(N){return N===null||we(N)?R(N):ze(N)?(e.consume(N),O):r(N)}function R(N){return N===45&&i===2?(e.consume(N),A):N===60&&i===1?(e.consume(N),U):N===62&&i===4?(e.consume(N),Z):N===63&&i===3?(e.consume(N),w):N===93&&i===5?(e.consume(N),V):we(N)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(N2,oe,C)(N)):N===null||we(N)?(e.exit("htmlFlowData"),C(N)):(e.consume(N),R)}function C(N){return e.check(T2,P,oe)(N)}function P(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),z}function z(N){return N===null||we(N)?C(N):(e.enter("htmlFlowData"),R(N))}function A(N){return N===45?(e.consume(N),w):R(N)}function U(N){return N===47?(e.consume(N),o="",D):R(N)}function D(N){if(N===62){const q=o.toLowerCase();return Wm.includes(q)?(e.consume(N),Z):R(N)}return Zt(N)&&o.length<8?(e.consume(N),o+=String.fromCharCode(N),D):R(N)}function V(N){return N===93?(e.consume(N),w):R(N)}function w(N){return N===62?(e.consume(N),Z):N===45&&i===2?(e.consume(N),w):R(N)}function Z(N){return N===null||we(N)?(e.exit("htmlFlowData"),oe(N)):(e.consume(N),Z)}function oe(N){return e.exit("htmlFlow"),t(N)}}function R2(e,t,r){const n=this;return i;function i(o){return we(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function M2(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(sl,t,r)}}const I2={name:"htmlText",tokenize:D2};function D2(e,t,r){const n=this;let i,s,o;return l;function l(w){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(w),a}function a(w){return w===33?(e.consume(w),c):w===47?(e.consume(w),L):w===63?(e.consume(w),y):Zt(w)?(e.consume(w),T):r(w)}function c(w){return w===45?(e.consume(w),d):w===91?(e.consume(w),s=0,m):Zt(w)?(e.consume(w),v):r(w)}function d(w){return w===45?(e.consume(w),p):r(w)}function u(w){return w===null?r(w):w===45?(e.consume(w),f):we(w)?(o=u,U(w)):(e.consume(w),u)}function f(w){return w===45?(e.consume(w),p):u(w)}function p(w){return w===62?A(w):w===45?f(w):u(w)}function m(w){const Z="CDATA[";return w===Z.charCodeAt(s++)?(e.consume(w),s===Z.length?_:m):r(w)}function _(w){return w===null?r(w):w===93?(e.consume(w),b):we(w)?(o=_,U(w)):(e.consume(w),_)}function b(w){return w===93?(e.consume(w),g):_(w)}function g(w){return w===62?A(w):w===93?(e.consume(w),g):_(w)}function v(w){return w===null||w===62?A(w):we(w)?(o=v,U(w)):(e.consume(w),v)}function y(w){return w===null?r(w):w===63?(e.consume(w),k):we(w)?(o=y,U(w)):(e.consume(w),y)}function k(w){return w===62?A(w):y(w)}function L(w){return Zt(w)?(e.consume(w),S):r(w)}function S(w){return w===45||Yt(w)?(e.consume(w),S):j(w)}function j(w){return we(w)?(o=j,U(w)):ze(w)?(e.consume(w),j):A(w)}function T(w){return w===45||Yt(w)?(e.consume(w),T):w===47||w===62||Ze(w)?B(w):r(w)}function B(w){return w===47?(e.consume(w),A):w===58||w===95||Zt(w)?(e.consume(w),E):we(w)?(o=B,U(w)):ze(w)?(e.consume(w),B):A(w)}function E(w){return w===45||w===46||w===58||w===95||Yt(w)?(e.consume(w),E):O(w)}function O(w){return w===61?(e.consume(w),R):we(w)?(o=O,U(w)):ze(w)?(e.consume(w),O):B(w)}function R(w){return w===null||w===60||w===61||w===62||w===96?r(w):w===34||w===39?(e.consume(w),i=w,C):we(w)?(o=R,U(w)):ze(w)?(e.consume(w),R):(e.consume(w),P)}function C(w){return w===i?(e.consume(w),i=void 0,z):w===null?r(w):we(w)?(o=C,U(w)):(e.consume(w),C)}function P(w){return w===null||w===34||w===39||w===60||w===61||w===96?r(w):w===47||w===62||Ze(w)?B(w):(e.consume(w),P)}function z(w){return w===47||w===62||Ze(w)?B(w):r(w)}function A(w){return w===62?(e.consume(w),e.exit("htmlTextData"),e.exit("htmlText"),t):r(w)}function U(w){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),D}function D(w){return ze(w)?Ue(e,V,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):V(w)}function V(w){return e.enter("htmlTextData"),o(w)}}const Af={name:"labelEnd",resolveAll:O2,resolveTo:z2,tokenize:$2},j2={tokenize:F2},A2={tokenize:W2},B2={tokenize:H2};function O2(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",t+=i}}return e.length!==r.length&&wr(e,0,e.length,r),e}function z2(e,t){let r=e.length,n=0,i,s,o,l;for(;r--;)if(i=e[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const a={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[s+n+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",a,t],["enter",c,t]],l=Rr(l,e.slice(s+1,s+n+3)),l=Rr(l,[["enter",d,t]]),l=Rr(l,mc(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=Rr(l,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),l=Rr(l,e.slice(o+1)),l=Rr(l,[["exit",a,t]]),wr(e,s,e.length,l),e}function $2(e,t,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return l;function l(f){return s?s._inactive?u(f):(o=n.parser.defined.includes(Kr(n.sliceSerialize({start:s.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),a):r(f)}function a(f){return f===40?e.attempt(j2,d,o?d:u)(f):f===91?e.attempt(A2,d,o?c:u)(f):o?d(f):u(f)}function c(f){return e.attempt(B2,d,u)(f)}function d(f){return t(f)}function u(f){return s._balanced=!0,r(f)}}function F2(e,t,r){return n;function n(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),i}function i(u){return Ze(u)?wo(e,s)(u):s(u)}function s(u){return u===41?d(u):zx(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return Ze(u)?wo(e,a)(u):d(u)}function l(u){return r(u)}function a(u){return u===34||u===39||u===40?Fx(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):d(u)}function c(u){return Ze(u)?wo(e,d)(u):d(u)}function d(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),t):r(u)}}function W2(e,t,r){const n=this;return i;function i(l){return $x.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes(Kr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function H2(e,t,r){return n;function n(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):r(s)}}const U2={name:"labelStartImage",resolveAll:Af.resolveAll,tokenize:V2};function V2(e,t,r){const n=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):t(l)}}const K2={name:"labelStartLink",resolveAll:Af.resolveAll,tokenize:q2};function q2(e,t,r){const n=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const ru={name:"lineEnding",tokenize:Y2};function Y2(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ue(e,t,"linePrefix")}}const ea={name:"thematicBreak",tokenize:X2};function X2(e,t,r){let n=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,l(c)}function l(c){return c===i?(e.enter("thematicBreakSequence"),a(c)):n>=3&&(c===null||we(c))?(e.exit("thematicBreak"),t(c)):r(c)}function a(c){return c===i?(e.consume(c),n++,a):(e.exit("thematicBreakSequence"),ze(c)?Ue(e,l,"whitespace")(c):l(c))}}const or={continuation:{tokenize:Z2},exit:tE,name:"list",tokenize:J2},G2={partial:!0,tokenize:rE},Q2={partial:!0,tokenize:eE};function J2(e,t,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(p){const m=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Ah(p)){if(n.containerState.type||(n.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ea,r,c)(p):c(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(p)}return r(p)}function a(p){return Ah(p)&&++o<10?(e.consume(p),a):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):r(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(sl,n.interrupt?r:d,e.attempt(G2,f,u))}function d(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function u(p){return ze(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):r(p)}function f(p){return n.containerState.size=s+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Z2(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(sl,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ue(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!ze(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(Q2,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ue(e,e.attempt(or,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function eE(e,t,r){const n=this;return Ue(e,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(s):r(s)}}function tE(e){e.exit(this.containerState.type)}function rE(e,t,r){const n=this;return Ue(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!ze(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const Hm={name:"setextUnderline",resolveTo:nE,tokenize:iE};function nE(e,t){let r=e.length,n,i,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[n][1],t]),e[n][1].end={...e[s][1].end}):e[n][1]=o,e.push(["exit",o,t]),e}function iE(e,t,r){const n=this;let i;return s;function s(c){let d=n.events.length,u;for(;d--;)if(n.events[d][1].type!=="lineEnding"&&n.events[d][1].type!=="linePrefix"&&n.events[d][1].type!=="content"){u=n.events[d][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||u)?(e.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),ze(c)?Ue(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||we(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const sE={tokenize:oE};function oE(e){const t=this,r=e.attempt(sl,n,e.attempt(this.parser.constructs.flowInitial,i,Ue(e,e.attempt(this.parser.constructs.flow,i,e.attempt(h2,i)),"linePrefix")));return r;function n(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const lE={resolveAll:Hx()},aE=Wx("string"),cE=Wx("text");function Wx(e){return{resolveAll:Hx(e==="text"?uE:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],s=r.attempt(i,o,l);return o;function o(d){return c(d)?s(d):l(d)}function l(d){if(d===null){r.consume(d);return}return r.enter("data"),r.consume(d),a}function a(d){return c(d)?(r.exit("data"),s(d)):(r.consume(d),a)}function c(d){if(d===null)return!0;const u=i[d];let f=-1;if(u)for(;++f<u.length;){const p=u[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function Hx(e){return t;function t(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(r,n):r}}function uE(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],i=t.sliceStream(n);let s=i.length,o=-1,l=0,a;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(c===-2)a=!0,l++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const c={type:r===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}const hE={42:or,43:or,45:or,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,62:jx},dE={91:g2},fE={[-2]:tu,[-1]:tu,32:tu},pE={35:b2,42:ea,45:[Hm,ea],60:E2,61:Hm,95:ea,96:Fm,126:Fm},mE={38:Bx,92:Ax},gE={[-5]:ru,[-4]:ru,[-3]:ru,33:U2,38:Bx,42:Bh,60:[KC,I2],91:K2,92:[y2,Ax],93:Af,95:Bh,96:s2},_E={null:[Bh,lE]},vE={null:[42,95]},xE={null:[]},yE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vE,contentInitial:dE,disable:xE,document:hE,flow:pE,flowInitial:fE,insideSpan:_E,string:mE,text:gE},Symbol.toStringTag,{value:"Module"}));function wE(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],l=[];const a={attempt:j(L),check:j(S),consume:v,enter:y,exit:k,interrupt:j(S,{interrupt:!0})},c={code:null,containerState:{},defineSkip:_,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:u};let d=t.tokenize.call(c,a);return t.resolveAll&&s.push(t),c;function u(O){return o=Rr(o,O),b(),o[o.length-1]!==null?[]:(T(t,0),c.events=mc(s,c.events,c),c.events)}function f(O,R){return SE(p(O),R)}function p(O){return bE(o,O)}function m(){const{_bufferIndex:O,_index:R,line:C,column:P,offset:z}=n;return{_bufferIndex:O,_index:R,line:C,column:P,offset:z}}function _(O){i[O.line]=O.column,E()}function b(){let O;for(;n._index<o.length;){const R=o[n._index];if(typeof R=="string")for(O=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===O&&n._bufferIndex<R.length;)g(R.charCodeAt(n._bufferIndex));else g(R)}}function g(O){d=d(O)}function v(O){we(O)?(n.line++,n.column=1,n.offset+=O===-3?2:1,E()):O!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=O}function y(O,R){const C=R||{};return C.type=O,C.start=m(),c.events.push(["enter",C,c]),l.push(C),C}function k(O){const R=l.pop();return R.end=m(),c.events.push(["exit",R,c]),R}function L(O,R){T(O,R.from)}function S(O,R){R.restore()}function j(O,R){return C;function C(P,z,A){let U,D,V,w;return Array.isArray(P)?oe(P):"tokenize"in P?oe([P]):Z(P);function Z($){return Y;function Y(he){const me=he!==null&&$[he],Ce=he!==null&&$.null,ke=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(Ce)?Ce:Ce?[Ce]:[]];return oe(ke)(he)}}function oe($){return U=$,D=0,$.length===0?A:N($[D])}function N($){return Y;function Y(he){return w=B(),V=$,$.partial||(c.currentConstruct=$),$.name&&c.parser.constructs.disable.null.includes($.name)?I():$.tokenize.call(R?Object.assign(Object.create(c),R):c,a,q,I)(he)}}function q($){return O(V,w),z}function I($){return w.restore(),++D<U.length?N(U[D]):A}}}function T(O,R){O.resolveAll&&!s.includes(O)&&s.push(O),O.resolve&&wr(c.events,R,c.events.length-R,O.resolve(c.events.slice(R),c)),O.resolveTo&&(c.events=O.resolveTo(c.events,c))}function B(){const O=m(),R=c.previous,C=c.currentConstruct,P=c.events.length,z=Array.from(l);return{from:P,restore:A};function A(){n=O,c.previous=R,c.currentConstruct=C,c.events.length=P,l=z,E()}}function E(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function bE(e,t){const r=t.start._index,n=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(r===i)o=[e[r].slice(n,s)];else{if(o=e.slice(r,i),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function SE(e,t){let r=-1;const n=[];let i;for(;++r<e.length;){const s=e[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
69
+ `;break}case-3:{o=`\r
70
+ `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function kE(e){const n={constructs:Ix([yE,...(e||{}).extensions||[]]),content:i(zC),defined:[],document:i(FC),flow:i(sE),lazy:{},string:i(aE),text:i(cE)};return n;function i(s){return o;function o(l){return wE(n,s,l)}}}function CE(e){for(;!Ox(e););return e}const Um=/[\0\t\n\r]/g;function EE(){let e=1,t="",r=!0,n;return i;function i(s,o,l){const a=[];let c,d,u,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),u=0,t="",r&&(s.charCodeAt(0)===65279&&u++,r=void 0);u<s.length;){if(Um.lastIndex=u,c=Um.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(u);break}if(p===10&&u===f&&n)a.push(-3),n=void 0;else switch(n&&(a.push(-5),n=void 0),u<f&&(a.push(s.slice(u,f)),e+=f-u),p){case 0:{a.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,a.push(-2);e++<d;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:n=!0,e=1}u=f+1}return l&&(n&&a.push(-5),t&&a.push(t),a.push(null)),a}}const NE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function TE(e){return e.replace(NE,PE)}function PE(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return Dx(r.slice(s?2:1),s?16:10)}return jf(r)||e}const Ux={}.hasOwnProperty;function LE(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),RE(r)(CE(kE(r).document().write(EE()(e,t,!0))))}function RE(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(J),autolinkProtocol:B,autolinkEmail:B,atxHeading:s(Q),blockQuote:s(Ce),characterEscape:B,characterReference:B,codeFenced:s(ke),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ke,o),codeText:s(Ke,o),codeTextData:B,data:B,codeFlowValue:B,definition:s(ue),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(ve),hardBreakEscape:s(ge),hardBreakTrailing:s(ge),htmlFlow:s(_e,o),htmlFlowData:B,htmlText:s(_e,o),htmlTextData:B,image:s(Te),label:o,link:s(J),listItem:s(Fe),listItemValue:f,listOrdered:s(xe,u),listUnordered:s(xe),paragraph:s(We),reference:N,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Q),strong:s(Pe),thematicBreak:s(Ae)},exit:{atxHeading:a(),atxHeadingSequence:L,autolink:a(),autolinkEmail:me,autolinkProtocol:he,blockQuote:a(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:I,characterReferenceMarkerNumeric:I,characterReferenceValue:$,characterReference:Y,codeFenced:a(b),codeFencedFence:_,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:a(g),codeText:a(z),codeTextData:E,data:E,definition:a(),definitionDestinationString:k,definitionLabelString:v,definitionTitleString:y,emphasis:a(),hardBreakEscape:a(R),hardBreakTrailing:a(R),htmlFlow:a(C),htmlFlowData:E,htmlText:a(P),htmlTextData:E,image:a(U),label:V,labelText:D,lineEnding:O,link:a(A),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:q,resourceDestinationString:w,resourceTitleString:Z,resource:oe,setextHeading:a(T),setextHeadingLineSequence:j,setextHeadingText:S,strong:a(),thematicBreak:a()}};Vx(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(W){let ee={type:"root",children:[]};const ye={stack:[ee],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:d,data:r},Ne=[];let He=-1;for(;++He<W.length;)if(W[He][1].type==="listOrdered"||W[He][1].type==="listUnordered")if(W[He][0]==="enter")Ne.push(He);else{const Ot=Ne.pop();He=i(W,Ot,He)}for(He=-1;++He<W.length;){const Ot=t[W[He][0]];Ux.call(Ot,W[He][1].type)&&Ot[W[He][1].type].call(Object.assign({sliceSerialize:W[He][2].sliceSerialize},ye),W[He][1])}if(ye.tokenStack.length>0){const Ot=ye.tokenStack[ye.tokenStack.length-1];(Ot[1]||Vm).call(ye,void 0,Ot[0])}for(ee.position={start:Mn(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:Mn(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},He=-1;++He<t.transforms.length;)ee=t.transforms[He](ee)||ee;return ee}function i(W,ee,ye){let Ne=ee-1,He=-1,Ot=!1,fr,gt,G,le;for(;++Ne<=ye;){const ne=W[Ne];switch(ne[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ne[0]==="enter"?He++:He--,le=void 0;break}case"lineEndingBlank":{ne[0]==="enter"&&(fr&&!le&&!He&&!G&&(G=Ne),le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:le=void 0}if(!He&&ne[0]==="enter"&&ne[1].type==="listItemPrefix"||He===-1&&ne[0]==="exit"&&(ne[1].type==="listUnordered"||ne[1].type==="listOrdered")){if(fr){let be=Ne;for(gt=void 0;be--;){const Be=W[be];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;gt&&(W[gt][1].type="lineEndingBlank",Ot=!0),Be[1].type="lineEnding",gt=be}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}G&&(!gt||G<gt)&&(fr._spread=!0),fr.end=Object.assign({},gt?W[gt][1].start:ne[1].end),W.splice(gt||Ne,0,["exit",fr,ne[2]]),Ne++,ye++}if(ne[1].type==="listItemPrefix"){const be={type:"listItem",_spread:!1,start:Object.assign({},ne[1].start),end:void 0};fr=be,W.splice(Ne,0,["enter",be,ne[2]]),Ne++,ye++,G=void 0,le=!0}}}return W[ee][1]._spread=Ot,ye}function s(W,ee){return ye;function ye(Ne){l.call(this,W(Ne),Ne),ee&&ee.call(this,Ne)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(W,ee,ye){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([ee,ye||void 0]),W.position={start:Mn(ee.start),end:void 0}}function a(W){return ee;function ee(ye){W&&W.call(this,ye),c.call(this,ye)}}function c(W,ee){const ye=this.stack.pop(),Ne=this.tokenStack.pop();if(Ne)Ne[0].type!==W.type&&(ee?ee.call(this,W,Ne[0]):(Ne[1]||Vm).call(this,W,Ne[0]));else throw new Error("Cannot close `"+W.type+"` ("+yo({start:W.start,end:W.end})+"): it’s not open");ye.position.end=Mn(W.end)}function d(){return Df(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function f(W){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function p(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=W}function m(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=W}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/(\r?\n|\r)$/g,"")}function v(W){const ee=this.resume(),ye=this.stack[this.stack.length-1];ye.label=ee,ye.identifier=Kr(this.sliceSerialize(W)).toLowerCase()}function y(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function k(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function L(W){const ee=this.stack[this.stack.length-1];if(!ee.depth){const ye=this.sliceSerialize(W).length;ee.depth=ye}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function j(W){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function B(W){const ye=this.stack[this.stack.length-1].children;let Ne=ye[ye.length-1];(!Ne||Ne.type!=="text")&&(Ne=Je(),Ne.position={start:Mn(W.start),end:void 0},ye.push(Ne)),this.stack.push(Ne)}function E(W){const ee=this.stack.pop();ee.value+=this.sliceSerialize(W),ee.position.end=Mn(W.end)}function O(W){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ye=ee.children[ee.children.length-1];ye.position.end=Mn(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(B.call(this,W),E.call(this,W))}function R(){this.data.atHardBreak=!0}function C(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function P(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function z(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function A(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function U(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function D(W){const ee=this.sliceSerialize(W),ye=this.stack[this.stack.length-2];ye.label=TE(ee),ye.identifier=Kr(ee).toLowerCase()}function V(){const W=this.stack[this.stack.length-1],ee=this.resume(),ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,ye.type==="link"){const Ne=W.children;ye.children=Ne}else ye.alt=ee}function w(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function Z(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function oe(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function q(W){const ee=this.resume(),ye=this.stack[this.stack.length-1];ye.label=ee,ye.identifier=Kr(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function I(W){this.data.characterReferenceType=W.type}function $(W){const ee=this.sliceSerialize(W),ye=this.data.characterReferenceType;let Ne;ye?(Ne=Dx(ee,ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ne=jf(ee);const He=this.stack[this.stack.length-1];He.value+=Ne}function Y(W){const ee=this.stack.pop();ee.position.end=Mn(W.end)}function he(W){E.call(this,W);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(W)}function me(W){E.call(this,W);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(W)}function Ce(){return{type:"blockquote",children:[]}}function ke(){return{type:"code",lang:null,meta:null,value:""}}function Ke(){return{type:"inlineCode",value:""}}function ue(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function Q(){return{type:"heading",depth:0,children:[]}}function ge(){return{type:"break"}}function _e(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function J(){return{type:"link",title:null,url:"",children:[]}}function xe(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Fe(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function We(){return{type:"paragraph",children:[]}}function Pe(){return{type:"strong",children:[]}}function Je(){return{type:"text",value:""}}function Ae(){return{type:"thematicBreak"}}}function Mn(e){return{line:e.line,column:e.column,offset:e.offset}}function Vx(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?Vx(e,n):ME(e,n)}}function ME(e,t){let r;for(r in t)if(Ux.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function Vm(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yo({start:t.start,end:t.end})+") is still open")}function IE(e){const t=this;t.parser=r;function r(n){return LE(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function DE(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function jE(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
71
+ `}]}function AE(e,t){const r=t.value?t.value+`
72
+ `:"",n={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function BE(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function OE(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function zE(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=Ls(n.toLowerCase()),s=e.footnoteOrder.indexOf(n);let o,l=e.footnoteCounts.get(n);l===void 0?(l=0,e.footnoteOrder.push(n),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(n,l);const a={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,a);const c={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,c),e.applyData(t,c)}function $E(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function FE(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function Kx(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function WE(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Kx(e,t);const i={src:Ls(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function HE(e,t){const r={src:Ls(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function UE(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function VE(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Kx(e,t);const i={href:Ls(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function KE(e,t){const r={href:Ls(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qE(e,t,r){const n=e.all(t),i=r?YE(r):qx(t),s={},o=[];if(typeof t.checked=="boolean"){const d=n[0];let u;d&&d.type==="element"&&d.tagName==="p"?u=d:(u={type:"element",tagName:"p",properties:{},children:[]},n.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const d=n[l];(i||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
73
+ `}),d.type==="element"&&d.tagName==="p"&&!i?o.push(...d.children):o.push(d)}const a=n[n.length-1];a&&(i||a.type!=="element"||a.tagName!=="p")&&o.push({type:"text",value:`
74
+ `});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function YE(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let n=-1;for(;!t&&++n<r.length;)t=qx(r[n])}return t}function qx(e){const t=e.spread;return t??e.children.length>1}function XE(e,t){const r={},n=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,s),e.applyData(t,s)}function GE(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function QE(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function JE(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ZE(e,t){const r=e.all(t),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=Lf(t.children[1]),a=Ex(t.children[t.children.length-1]);l&&a&&(o.position={start:l,end:a}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function e5(e,t,r){const n=r?r.children:void 0,s=(n?n.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:t.children.length;let a=-1;const c=[];for(;++a<l;){const u=t.children[a],f={},p=o?o[a]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};u&&(m.children=e.all(u),e.patch(u,m),m=e.applyData(u,m)),c.push(m)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function t5(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Km=9,qm=32;function r5(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),i=0;const s=[];for(;n;)s.push(Ym(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return s.push(Ym(t.slice(i),i>0,!1)),s.join("")}function Ym(e,t,r){let n=0,i=e.length;if(t){let s=e.codePointAt(n);for(;s===Km||s===qm;)n++,s=e.codePointAt(n)}if(r){let s=e.codePointAt(i-1);for(;s===Km||s===qm;)i--,s=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function n5(e,t){const r={type:"text",value:r5(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function i5(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const s5={blockquote:DE,break:jE,code:AE,delete:BE,emphasis:OE,footnoteReference:zE,heading:$E,html:FE,imageReference:WE,image:HE,inlineCode:UE,linkReference:VE,link:KE,listItem:qE,list:XE,paragraph:GE,root:QE,strong:JE,table:ZE,tableCell:t5,tableRow:e5,text:n5,thematicBreak:i5,toml:Pl,yaml:Pl,definition:Pl,footnoteDefinition:Pl};function Pl(){}const Yx=-1,gc=0,bo=1,Ba=2,Bf=3,Of=4,zf=5,$f=6,Xx=7,Gx=8,Xm=typeof self=="object"?self:globalThis,o5=(e,t)=>{const r=(i,s)=>(e.set(s,i),i),n=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case gc:case Yx:return r(o,i);case bo:{const l=r([],i);for(const a of o)l.push(n(a));return l}case Ba:{const l=r({},i);for(const[a,c]of o)l[n(a)]=n(c);return l}case Bf:return r(new Date(o),i);case Of:{const{source:l,flags:a}=o;return r(new RegExp(l,a),i)}case zf:{const l=r(new Map,i);for(const[a,c]of o)l.set(n(a),n(c));return l}case $f:{const l=r(new Set,i);for(const a of o)l.add(n(a));return l}case Xx:{const{name:l,message:a}=o;return r(new Xm[l](a),i)}case Gx:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new Xm[s](o),i)};return n},Gm=e=>o5(new Map,e)(0),Vi="",{toString:l5}={},{keys:a5}=Object,Vs=e=>{const t=typeof e;if(t!=="object"||!e)return[gc,t];const r=l5.call(e).slice(8,-1);switch(r){case"Array":return[bo,Vi];case"Object":return[Ba,Vi];case"Date":return[Bf,Vi];case"RegExp":return[Of,Vi];case"Map":return[zf,Vi];case"Set":return[$f,Vi];case"DataView":return[bo,r]}return r.includes("Array")?[bo,r]:r.includes("Error")?[Xx,r]:[Ba,r]},Ll=([e,t])=>e===gc&&(t==="function"||t==="symbol"),c5=(e,t,r,n)=>{const i=(o,l)=>{const a=n.push(o)-1;return r.set(l,a),a},s=o=>{if(r.has(o))return r.get(o);let[l,a]=Vs(o);switch(l){case gc:{let d=o;switch(a){case"bigint":l=Gx,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);d=null;break;case"undefined":return i([Yx],o)}return i([l,d],o)}case bo:{if(a){let f=o;return a==="DataView"?f=new Uint8Array(o.buffer):a==="ArrayBuffer"&&(f=new Uint8Array(o)),i([a,[...f]],o)}const d=[],u=i([l,d],o);for(const f of o)d.push(s(f));return u}case Ba:{if(a)switch(a){case"BigInt":return i([a,o.toString()],o);case"Boolean":case"Number":case"String":return i([a,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],u=i([l,d],o);for(const f of a5(o))(e||!Ll(Vs(o[f])))&&d.push([s(f),s(o[f])]);return u}case Bf:return i([l,o.toISOString()],o);case Of:{const{source:d,flags:u}=o;return i([l,{source:d,flags:u}],o)}case zf:{const d=[],u=i([l,d],o);for(const[f,p]of o)(e||!(Ll(Vs(f))||Ll(Vs(p))))&&d.push([s(f),s(p)]);return u}case $f:{const d=[],u=i([l,d],o);for(const f of o)(e||!Ll(Vs(f)))&&d.push(s(f));return u}}const{message:c}=o;return i([l,{name:a,message:c}],o)};return s},Qm=(e,{json:t,lossy:r}={})=>{const n=[];return c5(!(t||r),!!t,new Map,n)(e),n},Oa=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Gm(Qm(e,t)):structuredClone(e):(e,t)=>Gm(Qm(e,t));function u5(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function h5(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function d5(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||u5,n=e.options.footnoteBackLabel||h5,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let a=-1;for(;++a<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[a]);if(!c)continue;const d=e.all(c),u=String(c.identifier).toUpperCase(),f=Ls(u.toLowerCase());let p=0;const m=[],_=e.footnoteCounts.get(u);for(;_!==void 0&&++p<=_;){m.length>0&&m.push({type:"text",value:" "});let v=typeof r=="string"?r:r(a,p);typeof v=="string"&&(v={type:"text",value:v}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(a,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const v=b.children[b.children.length-1];v&&v.type==="text"?v.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...m)}else d.push(...m);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(c,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Oa(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
75
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
76
+ `}]}}const _c=function(e){if(e==null)return g5;if(typeof e=="function")return vc(e);if(typeof e=="object")return Array.isArray(e)?f5(e):p5(e);if(typeof e=="string")return m5(e);throw new Error("Expected function, string, or object as test")};function f5(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=_c(e[r]);return vc(n);function n(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function p5(e){const t=e;return vc(r);function r(n){const i=n;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function m5(e){return vc(t);function t(r){return r&&r.type===e}}function vc(e){return t;function t(r,n,i){return!!(_5(r)&&e.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function g5(){return!0}function _5(e){return e!==null&&typeof e=="object"&&"type"in e}const Qx=[],v5=!0,Oh=!1,x5="skip";function Jx(e,t,r,n){let i;typeof t=="function"&&typeof r!="function"?(n=r,r=t):i=t;const s=_c(i),o=n?-1:1;l(e,void 0,[])();function l(a,c,d){const u=a&&typeof a=="object"?a:{};if(typeof u.type=="string"){const p=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(a.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=Qx,m,_,b;if((!t||s(a,c,d[d.length-1]||void 0))&&(p=y5(r(a,d)),p[0]===Oh))return p;if("children"in a&&a.children){const g=a;if(g.children&&p[0]!==x5)for(_=(n?g.children.length:-1)+o,b=d.concat(g);_>-1&&_<g.children.length;){const v=g.children[_];if(m=l(v,_,b)(),m[0]===Oh)return m;_=typeof m[1]=="number"?m[1]:_+o}}return p}}}function y5(e){return Array.isArray(e)?e:typeof e=="number"?[v5,e]:e==null?Qx:[e]}function xc(e,t,r,n){let i,s,o;typeof t=="function"&&typeof r!="function"?(s=void 0,o=t,i=r):(s=t,o=r,i=n),Jx(e,s,l,i);function l(a,c){const d=c[c.length-1],u=d?d.children.indexOf(a):void 0;return o(a,u,d)}}const zh={}.hasOwnProperty,w5={};function b5(e,t){const r=t||w5,n=new Map,i=new Map,s=new Map,o={...s5,...r.handlers},l={all:c,applyData:k5,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:a,options:r,patch:S5,wrap:E5};return xc(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const u=d.type==="definition"?n:i,f=String(d.identifier).toUpperCase();u.has(f)||u.set(f,d)}}),l;function a(d,u){const f=d.type,p=l.handlers[f];if(zh.call(l.handlers,f)&&p)return p(l,d,u);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in d){const{children:_,...b}=d,g=Oa(b);return g.children=l.all(d),g}return Oa(d)}return(l.options.unknownHandler||C5)(l,d,u)}function c(d){const u=[];if("children"in d){const f=d.children;let p=-1;for(;++p<f.length;){const m=l.one(f[p],d);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Jm(m.value)),!Array.isArray(m)&&m.type==="element")){const _=m.children[0];_&&_.type==="text"&&(_.value=Jm(_.value))}Array.isArray(m)?u.push(...m):u.push(m)}}}return u}}function S5(e,t){e.position&&(t.position=hC(e))}function k5(e,t){let r=t;if(e&&e.data){const n=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,Oa(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function C5(e,t){const r=t.data||{},n="value"in t&&!(zh.call(r,"hProperties")||zh.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function E5(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
77
+ `});++n<e.length;)n&&r.push({type:"text",value:`
78
+ `}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:`
79
+ `}),r}function Jm(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Zm(e,t){const r=b5(e,t),n=r.one(e,void 0),i=d5(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
80
+ `},i),s}function N5(e,t){return e&&"run"in e?async function(r,n){const i=Zm(r,{file:n,...t});await e.run(i,n)}:function(r,n){return Zm(r,{file:n,...e||t})}}function eg(e){if(e)throw e}var ta=Object.prototype.hasOwnProperty,Zx=Object.prototype.toString,tg=Object.defineProperty,rg=Object.getOwnPropertyDescriptor,ng=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Zx.call(t)==="[object Array]"},ig=function(t){if(!t||Zx.call(t)!=="[object Object]")return!1;var r=ta.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&ta.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||ta.call(t,i)},sg=function(t,r){tg&&r.name==="__proto__"?tg(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},og=function(t,r){if(r==="__proto__")if(ta.call(t,r)){if(rg)return rg(t,r).value}else return;return t[r]},T5=function e(){var t,r,n,i,s,o,l=arguments[0],a=1,c=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},a=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});a<c;++a)if(t=arguments[a],t!=null)for(r in t)n=og(l,r),i=og(t,r),l!==i&&(d&&i&&(ig(i)||(s=ng(i)))?(s?(s=!1,o=n&&ng(n)?n:[]):o=n&&ig(n)?n:{},sg(l,{name:r,newValue:e(d,o,i)})):typeof i<"u"&&sg(l,{name:r,newValue:i}));return l};const nu=Pd(T5);function $h(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function P5(){const e=[],t={run:r,use:n};return t;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(a,...c){const d=e[++s];let u=-1;if(a){o(a);return}for(;++u<i.length;)(c[u]===null||c[u]===void 0)&&(c[u]=i[u]);i=c,d?L5(d,l)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function L5(e,t){let r;return n;function n(...o){const l=e.length>o.length;let a;l&&o.push(i);try{a=e.apply(this,o)}catch(c){const d=c;if(l&&r)throw d;return i(d)}l||(a&&a.then&&typeof a.then=="function"?a.then(s,i):a instanceof Error?i(a):s(a))}function i(o,...l){r||(r=!0,t(o,...l))}function s(o){i(null,o)}}const en={basename:R5,dirname:M5,extname:I5,join:D5,sep:"/"};function R5(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ol(e);let r=0,n=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(n=i):(l=-1,n=o));return r===n?n=o:n<0&&(n=e.length),e.slice(r,n)}function M5(e){if(ol(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function I5(e){ol(e);let t=e.length,r=-1,n=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){n=t+1;break}continue}r<0&&(o=!0,r=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function D5(...e){let t=-1,r;for(;++t<e.length;)ol(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":j5(r)}function j5(e){ol(e);const t=e.codePointAt(0)===47;let r=A5(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function A5(e,t){let r="",n=0,i=-1,s=0,o=-1,l,a;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(a=r.lastIndexOf("/"),a!==r.length-1){a<0?(r="",n=0):(r=r.slice(0,a),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,o):r=e.slice(i+1,o),n=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return r}function ol(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const B5={cwd:O5};function O5(){return"/"}function Fh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function z5(e){if(typeof e=="string")e=new URL(e);else if(!Fh(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return $5(e)}function $5(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const iu=["history","path","basename","stem","extname","dirname"];class ey{constructor(t){let r;t?Fh(t)?r={path:t}:typeof t=="string"||F5(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":B5.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<iu.length;){const s=iu[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)iu.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?en.basename(this.path):void 0}set basename(t){ou(t,"basename"),su(t,"basename"),this.path=en.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?en.dirname(this.path):void 0}set dirname(t){lg(this.basename,"dirname"),this.path=en.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?en.extname(this.path):void 0}set extname(t){if(su(t,"extname"),lg(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=en.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Fh(t)&&(t=z5(t)),ou(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?en.basename(this.path,this.extname):void 0}set stem(t){ou(t,"stem"),su(t,"stem"),this.path=en.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){const i=this.message(t,r,n);throw i.fatal=!0,i}info(t,r,n){const i=this.message(t,r,n);return i.fatal=void 0,i}message(t,r,n){const i=new Gt(t,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function su(e,t){if(e&&e.includes(en.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+en.sep+"`")}function ou(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function lg(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function F5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const W5=function(e){const n=this.constructor.prototype,i=n[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s},H5={}.hasOwnProperty;class Ff extends W5{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=P5()}copy(){const t=new Ff;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(nu(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(cu("data",this.frozen),this.namespace[t]=r,this):H5.call(this.namespace,t)&&this.namespace[t]||void 0:t?(cu("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(t,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=Rl(t),n=this.parser||this.Parser;return lu("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),lu("process",this.parser||this.Parser),au("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const l=Rl(t),a=n.parse(l);n.run(a,l,function(d,u,f){if(d||!u||!f)return c(d);const p=u,m=n.stringify(p,f);K5(m)?f.value=m:f.result=m,c(d,f)});function c(d,u){d||!u?o(d):s?s(u):r(void 0,u)}}}processSync(t){let r=!1,n;return this.freeze(),lu("processSync",this.parser||this.Parser),au("processSync",this.compiler||this.Compiler),this.process(t,i),cg("processSync","process",r),n;function i(s,o){r=!0,eg(s),n=o}}run(t,r,n){ag(t),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,l){const a=Rl(r);i.run(t,a,c);function c(d,u,f){const p=u||t;d?l(d):o?o(p):n(void 0,p,f)}}}runSync(t,r){let n=!1,i;return this.run(t,r,s),cg("runSync","run",n),i;function s(o,l){eg(o),i=l,n=!0}}stringify(t,r){this.freeze();const n=Rl(r),i=this.compiler||this.Compiler;return au("stringify",i),ag(t),i(t,n)}use(t,...r){const n=this.attachers,i=this.namespace;if(cu("use",this.frozen),t!=null)if(typeof t=="function")a(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")a(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...u]=c;a(d,u)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(i.settings=nu(!0,i.settings,c.settings))}function l(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const u=c[d];s(u)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function a(c,d){let u=-1,f=-1;for(;++u<n.length;)if(n[u][0]===c){f=u;break}if(f===-1)n.push([c,...d]);else if(d.length>0){let[p,...m]=d;const _=n[f][1];$h(_)&&$h(p)&&(p=nu(!0,_,p)),n[f]=[c,p,...m]}}}}const U5=new Ff().freeze();function lu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function au(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function cu(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ag(e){if(!$h(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function cg(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Rl(e){return V5(e)?e:new ey(e)}function V5(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function K5(e){return typeof e=="string"||q5(e)}function q5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Y5="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ug=[],hg={allowDangerousHtml:!0},X5=/^(https?|ircs?|mailto|xmpp)$/i,G5=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function dg(e){const t=Q5(e),r=J5(e);return Z5(t.runSync(t.parse(r),r),e)}function Q5(e){const t=e.rehypePlugins||ug,r=e.remarkPlugins||ug,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...hg}:hg;return U5().use(IE).use(r).use(N5,n).use(t)}function J5(e){const t=e.children||"",r=new ey;return typeof t=="string"&&(r.value=t),r}function Z5(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||eN;for(const d of G5)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Y5+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),xc(e,c),gC(e,{Fragment:h.Fragment,components:i,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(d,u,f){if(d.type==="raw"&&f&&typeof u=="number")return o?f.children.splice(u,1):f.children[u]={type:"text",value:d.value},u;if(d.type==="element"){let p;for(p in eu)if(Object.hasOwn(eu,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],_=eu[p];(_===null||_.includes(d.tagName))&&(d.properties[p]=a(String(m||""),p,d))}}if(d.type==="element"){let p=r?!r.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&n&&typeof u=="number"&&(p=!n(d,u,f)),p&&f&&typeof u=="number")return l&&d.children?f.children.splice(u,1,...d.children):f.children.splice(u,1),u}}}function eN(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||n!==-1&&t>n||X5.test(e.slice(0,t))?e:""}function fg(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}function tN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ty(e,t,r){const i=_c((r||{}).ignore||[]),s=rN(t);let o=-1;for(;++o<s.length;)Jx(e,"text",l);function l(c,d){let u=-1,f;for(;++u<d.length;){const p=d[u],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return a(c,d)}function a(c,d){const u=d[d.length-1],f=s[o][0],p=s[o][1];let m=0;const b=u.children.indexOf(c);let g=!1,v=[];f.lastIndex=0;let y=f.exec(c.value);for(;y;){const k=y.index,L={index:y.index,input:y.input,stack:[...d,c]};let S=p(...y,L);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?f.lastIndex=k+1:(m!==k&&v.push({type:"text",value:c.value.slice(m,k)}),Array.isArray(S)?v.push(...S):S&&v.push(S),m=k+y[0].length,g=!0),!f.global)break;y=f.exec(c.value)}return g?(m<c.value.length&&v.push({type:"text",value:c.value.slice(m)}),u.children.splice(b,1,...v)):v=[c],b+v.length}}function rN(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let n=-1;for(;++n<r.length;){const i=r[n];t.push([nN(i[0]),iN(i[1])])}return t}function nN(e){return typeof e=="string"?new RegExp(tN(e),"g"):e}function iN(e){return typeof e=="function"?e:function(){return e}}const uu="phrasing",hu=["autolink","link","image","label"];function sN(){return{transforms:[dN],enter:{literalAutolink:lN,literalAutolinkEmail:du,literalAutolinkHttp:du,literalAutolinkWww:du},exit:{literalAutolink:hN,literalAutolinkEmail:uN,literalAutolinkHttp:aN,literalAutolinkWww:cN}}}function oN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:uu,notInConstruct:hu},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:uu,notInConstruct:hu},{character:":",before:"[ps]",after:"\\/",inConstruct:uu,notInConstruct:hu}]}}function lN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function du(e){this.config.enter.autolinkProtocol.call(this,e)}function aN(e){this.config.exit.autolinkProtocol.call(this,e)}function cN(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function uN(e){this.config.exit.autolinkEmail.call(this,e)}function hN(e){this.exit(e)}function dN(e){ty(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,fN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),pN]],{ignore:["link","linkReference"]})}function fN(e,t,r,n,i){let s="";if(!ry(i)||(/^w/i.test(t)&&(r=t+r,t="",s="http://"),!mN(r)))return!1;const o=gN(r+n);if(!o[0])return!1;const l={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function pN(e,t,r,n){return!ry(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function mN(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function gN(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")");const i=fg(e,"(");let s=fg(e,")");for(;n!==-1&&i>s;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[e,r]}function ry(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Ai(r)||pc(r))&&(!t||r!==47)}ny.peek=CN;function _N(){this.buffer()}function vN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xN(){this.buffer()}function yN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function wN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Kr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function bN(e){this.exit(e)}function SN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Kr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function kN(e){this.exit(e)}function CN(){return"["}function ny(e,t,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),l=r.enter("reference");return s+=i.move(r.safe(r.associationId(e),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function EN(){return{enter:{gfmFootnoteCallString:_N,gfmFootnoteCall:vN,gfmFootnoteDefinitionLabelString:xN,gfmFootnoteDefinition:yN},exit:{gfmFootnoteCallString:wN,gfmFootnoteCall:bN,gfmFootnoteDefinitionLabelString:SN,gfmFootnoteDefinition:kN}}}function NN(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:ny},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const l=s.createTracker(o);let a=l.move("[^");const c=s.enter("footnoteDefinition"),d=s.enter("label");return a+=l.move(s.safe(s.associationId(n),{before:a,after:"]"})),d(),a+=l.move("]:"),n.children&&n.children.length>0&&(l.shift(4),a+=l.move((t?`
81
+ `:" ")+s.indentLines(s.containerFlow(n,l.current()),t?iy:TN))),c(),a}}function TN(e,t,r){return t===0?e:iy(e,t,r)}function iy(e,t,r){return(r?"":" ")+e}const PN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];sy.peek=DN;function LN(){return{canContainEols:["delete"],enter:{strikethrough:MN},exit:{strikethrough:IN}}}function RN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:PN}],handlers:{delete:sy}}}function MN(e){this.enter({type:"delete",children:[]},e)}function IN(e){this.exit(e)}function sy(e,t,r,n){const i=r.createTracker(n),s=r.enter("strikethrough");let o=i.move("~~");return o+=r.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function DN(){return"~"}function jN(e){return e.length}function AN(e,t){const r=t||{},n=(r.align||[]).concat(),i=r.stringLength||jN,s=[],o=[],l=[],a=[];let c=0,d=-1;for(;++d<e.length;){const _=[],b=[];let g=-1;for(e[d].length>c&&(c=e[d].length);++g<e[d].length;){const v=BN(e[d][g]);if(r.alignDelimiters!==!1){const y=i(v);b[g]=y,(a[g]===void 0||y>a[g])&&(a[g]=y)}_.push(v)}o[d]=_,l[d]=b}let u=-1;if(typeof n=="object"&&"length"in n)for(;++u<c;)s[u]=pg(n[u]);else{const _=pg(n);for(;++u<c;)s[u]=_}u=-1;const f=[],p=[];for(;++u<c;){const _=s[u];let b="",g="";_===99?(b=":",g=":"):_===108?b=":":_===114&&(g=":");let v=r.alignDelimiters===!1?1:Math.max(1,a[u]-b.length-g.length);const y=b+"-".repeat(v)+g;r.alignDelimiters!==!1&&(v=b.length+v+g.length,v>a[u]&&(a[u]=v),p[u]=v),f[u]=y}o.splice(1,0,f),l.splice(1,0,p),d=-1;const m=[];for(;++d<o.length;){const _=o[d],b=l[d];u=-1;const g=[];for(;++u<c;){const v=_[u]||"";let y="",k="";if(r.alignDelimiters!==!1){const L=a[u]-(b[u]||0),S=s[u];S===114?y=" ".repeat(L):S===99?L%2?(y=" ".repeat(L/2+.5),k=" ".repeat(L/2-.5)):(y=" ".repeat(L/2),k=y):k=" ".repeat(L)}r.delimiterStart!==!1&&!u&&g.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&v==="")&&(r.delimiterStart!==!1||u)&&g.push(" "),r.alignDelimiters!==!1&&g.push(y),g.push(v),r.alignDelimiters!==!1&&g.push(k),r.padding!==!1&&g.push(" "),(r.delimiterEnd!==!1||u!==c-1)&&g.push("|")}m.push(r.delimiterEnd===!1?g.join("").replace(/ +$/,""):g.join(""))}return m.join(`
82
+ `)}function BN(e){return e==null?"":String(e)}function pg(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function ON(e,t,r,n){const i=r.enter("blockquote"),s=r.createTracker(n);s.move("> "),s.shift(2);const o=r.indentLines(r.containerFlow(e,s.current()),zN);return i(),o}function zN(e,t,r){return">"+(r?"":" ")+e}function $N(e,t){return mg(e,t.inConstruct,!0)&&!mg(e,t.notInConstruct,!1)}function mg(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let n=-1;for(;++n<t.length;)if(e.includes(t[n]))return!0;return!1}function gg(e,t,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
83
+ `&&$N(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
84
+ `}function FN(e,t){const r=String(e);let n=r.indexOf(t),i=n,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++s>o&&(o=s):s=1,i=n+t.length,n=r.indexOf(t,i);return o}function WN(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function HN(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function UN(e,t,r,n){const i=HN(r),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(WN(e,r)){const u=r.enter("codeIndented"),f=r.indentLines(s,VN);return u(),f}const l=r.createTracker(n),a=i.repeat(Math.max(FN(s,i)+1,3)),c=r.enter("codeFenced");let d=l.move(a);if(e.lang){const u=r.enter(`codeFencedLang${o}`);d+=l.move(r.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),u()}if(e.lang&&e.meta){const u=r.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(r.safe(e.meta,{before:d,after:`
85
+ `,encode:["`"],...l.current()})),u()}return d+=l.move(`
86
+ `),s&&(d+=l.move(s+`
87
+ `)),d+=l.move(a),c(),d}function VN(e,t,r){return(r?"":" ")+e}function Wf(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function KN(e,t,r,n){const i=Wf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let l=r.enter("label");const a=r.createTracker(n);let c=a.move("[");return c+=a.move(r.safe(r.associationId(e),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":`
88
+ `,...a.current()}))),l(),e.title&&(l=r.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(r.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),o(),c}function qN(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Vo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function za(e,t,r){const n=Ss(e),i=Ss(t);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}oy.peek=YN;function oy(e,t,r,n){const i=qN(r),s=r.enter("emphasis"),o=r.createTracker(n),l=o.move(i);let a=o.move(r.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),d=za(n.before.charCodeAt(n.before.length-1),c,i);d.inside&&(a=Vo(c)+a.slice(1));const u=a.charCodeAt(a.length-1),f=za(n.after.charCodeAt(0),u,i);f.inside&&(a=a.slice(0,-1)+Vo(u));const p=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},l+a+p}function YN(e,t,r){return r.options.emphasis||"*"}function XN(e,t){let r=!1;return xc(e,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Oh}),!!((!e.depth||e.depth<3)&&Df(e)&&(t.options.setext||r))}function GN(e,t,r,n){const i=Math.max(Math.min(6,e.depth||1),1),s=r.createTracker(n);if(XN(e,r)){const d=r.enter("headingSetext"),u=r.enter("phrasing"),f=r.containerPhrasing(e,{...s.current(),before:`
89
+ `,after:`
90
+ `});return u(),d(),f+`
91
+ `+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
92
+ `))+1))}const o="#".repeat(i),l=r.enter("headingAtx"),a=r.enter("phrasing");s.move(o+" ");let c=r.containerPhrasing(e,{before:"# ",after:`
93
+ `,...s.current()});return/^[\t ]/.test(c)&&(c=Vo(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),a(),l(),c}ly.peek=QN;function ly(e){return e.value||""}function QN(){return"<"}ay.peek=JN;function ay(e,t,r,n){const i=Wf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let l=r.enter("label");const a=r.createTracker(n);let c=a.move("![");return c+=a.move(r.safe(e.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=r.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(r.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function JN(){return"!"}cy.peek=ZN;function cy(e,t,r,n){const i=e.referenceType,s=r.enter("imageReference");let o=r.enter("label");const l=r.createTracker(n);let a=l.move("![");const c=r.safe(e.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const d=r.stack;r.stack=[],o=r.enter("reference");const u=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=d,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function ZN(){return"!"}uy.peek=eT;function uy(e,t,r){let n=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s<r.unsafe.length;){const o=r.unsafe[s],l=r.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(n);){let c=a.index;n.charCodeAt(c)===10&&n.charCodeAt(c-1)===13&&c--,n=n.slice(0,c)+" "+n.slice(a.index+1)}}return i+n+i}function eT(){return"`"}function hy(e,t){const r=Df(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}dy.peek=tT;function dy(e,t,r,n){const i=Wf(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let l,a;if(hy(e,r)){const d=r.stack;r.stack=[],l=r.enter("autolink");let u=o.move("<");return u+=o.move(r.containerPhrasing(e,{before:u,after:">",...o.current()})),u+=o.move(">"),l(),r.stack=d,u}l=r.enter("link"),a=r.enter("label");let c=o.move("[");return c+=o.move(r.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=r.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(r.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(a=r.enter("destinationRaw"),c+=o.move(r.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),a(),e.title&&(a=r.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(r.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),a()),c+=o.move(")"),l(),c}function tT(e,t,r){return hy(e,r)?"<":"["}fy.peek=rT;function fy(e,t,r,n){const i=e.referenceType,s=r.enter("linkReference");let o=r.enter("label");const l=r.createTracker(n);let a=l.move("[");const c=r.containerPhrasing(e,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const d=r.stack;r.stack=[],o=r.enter("reference");const u=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=d,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function rT(){return"["}function Hf(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function nT(e){const t=Hf(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function iT(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function py(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function sT(e,t,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=e.ordered?iT(r):Hf(r);const l=e.ordered?o==="."?")":".":nT(r);let a=t&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(a=!0),py(r)===o&&d){let u=-1;for(;++u<e.children.length;){const f=e.children[u];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(o=l),r.bulletCurrent=o;const c=r.containerFlow(e,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),c}function oT(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function lT(e,t,r,n){const i=oT(r);let s=r.bulletCurrent||Hf(r);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=r.createTracker(n);l.move(s+" ".repeat(o-s.length)),l.shift(o);const a=r.enter("listItem"),c=r.indentLines(r.containerFlow(e,l.current()),d);return a(),c;function d(u,f,p){return f?(p?"":" ".repeat(o))+u:(p?s:s+" ".repeat(o-s.length))+u}}function aT(e,t,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(e,n);return s(),i(),o}const cT=_c(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function uT(e,t,r,n){return(e.children.some(function(o){return cT(o)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function hT(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}my.peek=dT;function my(e,t,r,n){const i=hT(r),s=r.enter("strong"),o=r.createTracker(n),l=o.move(i+i);let a=o.move(r.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),d=za(n.before.charCodeAt(n.before.length-1),c,i);d.inside&&(a=Vo(c)+a.slice(1));const u=a.charCodeAt(a.length-1),f=za(n.after.charCodeAt(0),u,i);f.inside&&(a=a.slice(0,-1)+Vo(u));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},l+a+p}function dT(e,t,r){return r.options.strong||"*"}function fT(e,t,r,n){return r.safe(e.value,n)}function pT(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function mT(e,t,r){const n=(py(r)+(r.options.ruleSpaces?" ":"")).repeat(pT(r));return r.options.ruleSpaces?n.slice(0,-1):n}const gy={blockquote:ON,break:gg,code:UN,definition:KN,emphasis:oy,hardBreak:gg,heading:GN,html:ly,image:ay,imageReference:cy,inlineCode:uy,link:dy,linkReference:fy,list:sT,listItem:lT,paragraph:aT,root:uT,strong:my,text:fT,thematicBreak:mT};function gT(){return{enter:{table:_T,tableData:_g,tableHeader:_g,tableRow:xT},exit:{codeText:yT,table:vT,tableData:fu,tableHeader:fu,tableRow:fu}}}function _T(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function vT(e){this.exit(e),this.data.inTable=void 0}function xT(e){this.enter({type:"tableRow",children:[]},e)}function fu(e){this.exit(e)}function _g(e){this.enter({type:"tableCell",children:[]},e)}function yT(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,wT));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function wT(e,t){return t==="|"?t:e}function bT(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
94
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:a,tableRow:l}};function o(p,m,_,b){return c(d(p,_,b),p.align)}function l(p,m,_,b){const g=u(p,_,b),v=c([g]);return v.slice(0,v.indexOf(`
95
+ `))}function a(p,m,_,b){const g=_.enter("tableCell"),v=_.enter("phrasing"),y=_.containerPhrasing(p,{...b,before:s,after:s});return v(),g(),y}function c(p,m){return AN(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function d(p,m,_){const b=p.children;let g=-1;const v=[],y=m.enter("table");for(;++g<b.length;)v[g]=u(b[g],m,_);return y(),v}function u(p,m,_){const b=p.children;let g=-1;const v=[],y=m.enter("tableRow");for(;++g<b.length;)v[g]=a(b[g],p,m,_);return y(),v}function f(p,m,_){let b=gy.inlineCode(p,m,_);return _.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function ST(){return{exit:{taskListCheckValueChecked:vg,taskListCheckValueUnchecked:vg,paragraph:CT}}}function kT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ET}}}function vg(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function CT(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const l=i[s];if(l.type==="paragraph"){o=l;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function ET(e,t,r,n){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=r.createTracker(n);s&&l.move(o);let a=gy.listItem(e,t,r,{...n,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(d){return d+o}}function NT(){return[sN(),EN(),LN(),gT(),ST()]}function TT(e){return{extensions:[oN(),NN(e),RN(),bT(e),kT()]}}const PT={tokenize:jT,partial:!0},_y={tokenize:AT,partial:!0},vy={tokenize:BT,partial:!0},xy={tokenize:OT,partial:!0},LT={tokenize:zT,partial:!0},yy={name:"wwwAutolink",tokenize:IT,previous:by},wy={name:"protocolAutolink",tokenize:DT,previous:Sy},Nn={name:"emailAutolink",tokenize:MT,previous:ky},cn={};function RT(){return{text:cn}}let di=48;for(;di<123;)cn[di]=Nn,di++,di===58?di=65:di===91&&(di=97);cn[43]=Nn;cn[45]=Nn;cn[46]=Nn;cn[95]=Nn;cn[72]=[Nn,wy];cn[104]=[Nn,wy];cn[87]=[Nn,yy];cn[119]=[Nn,yy];function MT(e,t,r){const n=this;let i,s;return o;function o(u){return!Wh(u)||!ky.call(n,n.previous)||Uf(n.events)?r(u):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(u))}function l(u){return Wh(u)?(e.consume(u),l):u===64?(e.consume(u),a):r(u)}function a(u){return u===46?e.check(LT,d,c)(u):u===45||u===95||Yt(u)?(s=!0,e.consume(u),a):d(u)}function c(u){return e.consume(u),i=!0,a}function d(u){return s&&i&&Zt(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):r(u)}}function IT(e,t,r){const n=this;return i;function i(o){return o!==87&&o!==119||!by.call(n,n.previous)||Uf(n.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(PT,e.attempt(_y,e.attempt(vy,s),r),r)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function DT(e,t,r){const n=this;let i="",s=!1;return o;function o(u){return(u===72||u===104)&&Sy.call(n,n.previous)&&!Uf(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(u),e.consume(u),l):r(u)}function l(u){if(Zt(u)&&i.length<5)return i+=String.fromCodePoint(u),e.consume(u),l;if(u===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(u),a}return r(u)}function a(u){return u===47?(e.consume(u),s?c:(s=!0,a)):r(u)}function c(u){return u===null||Aa(u)||Ze(u)||Ai(u)||pc(u)?r(u):e.attempt(_y,e.attempt(vy,d),r)(u)}function d(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function jT(e,t,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,e.consume(o),i):o===46&&n===3?(e.consume(o),s):r(o)}function s(o){return o===null?r(o):t(o)}}function AT(e,t,r){let n,i,s;return o;function o(c){return c===46||c===95?e.check(xy,a,l)(c):c===null||Ze(c)||Ai(c)||c!==45&&pc(c)?a(c):(s=!0,e.consume(c),o)}function l(c){return c===95?n=!0:(i=n,n=void 0),e.consume(c),o}function a(c){return i||n||!s?r(c):t(c)}}function BT(e,t){let r=0,n=0;return i;function i(o){return o===40?(r++,e.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(xy,t,s)(o):o===null||Ze(o)||Ai(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&n++,e.consume(o),i}}function OT(e,t,r){return n;function n(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),n):l===38?(e.consume(l),s):l===93?(e.consume(l),i):l===60||l===null||Ze(l)||Ai(l)?t(l):r(l)}function i(l){return l===null||l===40||l===91||Ze(l)||Ai(l)?t(l):n(l)}function s(l){return Zt(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),n):Zt(l)?(e.consume(l),o):r(l)}}function zT(e,t,r){return n;function n(s){return e.consume(s),i}function i(s){return Yt(s)?r(s):t(s)}}function by(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ze(e)}function Sy(e){return!Zt(e)}function ky(e){return!(e===47||Wh(e))}function Wh(e){return e===43||e===45||e===46||e===95||Yt(e)}function Uf(e){let t=e.length,r=!1;for(;t--;){const n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const $T={tokenize:YT,partial:!0};function FT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:VT,continuation:{tokenize:KT},exit:qT}},text:{91:{name:"gfmFootnoteCall",tokenize:UT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:WT,resolveTo:HT}}}}function WT(e,t,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const a=n.events[i][1];if(a.type==="labelImage"){o=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return l;function l(a){if(!o||!o._balanced)return r(a);const c=Kr(n.sliceSerialize({start:o.end,end:n.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?r(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function HT(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...l),e}function UT(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return l;function l(u){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),a}function a(u){return u!==94?r(u):(e.enter("gfmFootnoteCallMarker"),e.consume(u),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(u){if(s>999||u===93&&!o||u===null||u===91||Ze(u))return r(u);if(u===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(Kr(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(u)}return Ze(u)||(o=!0),s++,e.consume(u),u===92?d:c}function d(u){return u===91||u===92||u===93?(e.consume(u),s++,c):c(u)}}function VT(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,l;return a;function a(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):r(m)}function d(m){if(o>999||m===93&&!l||m===null||m===91||Ze(m))return r(m);if(m===93){e.exit("chunkString");const _=e.exit("gfmFootnoteDefinitionLabelString");return s=Kr(n.sliceSerialize(_)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ze(m)||(l=!0),o++,e.consume(m),m===92?u:d}function u(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),Ue(e,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return t(m)}}function KT(e,t,r){return e.check(sl,t,e.attempt($T,t,r))}function qT(e){e.exit("gfmFootnoteDefinition")}function YT(e,t,r){const n=this;return Ue(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):r(s)}}function XT(e){let r=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,l){let a=-1;for(;++a<o.length;)if(o[a][0]==="enter"&&o[a][1].type==="strikethroughSequenceTemporary"&&o[a][1]._close){let c=a;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[a][1].end.offset-o[a][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[a][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[a][1].end)},u={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[a][1].start)},f=[["enter",d,l],["enter",o[c][1],l],["exit",o[c][1],l],["enter",u,l]],p=l.parser.constructs.insideSpan.null;p&&wr(f,f.length,0,mc(p,o.slice(c+1,a),l)),wr(f,f.length,0,[["exit",u,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",d,l]]),wr(o,c-1,a-c+3,f),a=c+f.length-2;break}}for(a=-1;++a<o.length;)o[a][1].type==="strikethroughSequenceTemporary"&&(o[a][1].type="data");return o}function s(o,l,a){const c=this.previous,d=this.events;let u=0;return f;function f(m){return c===126&&d[d.length-1][1].type!=="characterEscape"?a(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const _=Ss(c);if(m===126)return u>1?a(m):(o.consume(m),u++,p);if(u<2&&!r)return a(m);const b=o.exit("strikethroughSequenceTemporary"),g=Ss(m);return b._open=!g||g===2&&!!_,b._close=!_||_===2&&!!g,l(m)}}}class GT{constructor(){this.map=[]}add(t,r,n){QT(this,t,r,n)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let i=n.pop();for(;i;){for(const s of i)t.push(s);i=n.pop()}this.map.length=0}}function QT(e,t,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...n);return}i+=1}e.map.push([t,r,n])}}function JT(e,t){let r=!1;const n=[];for(;t<e.length;){const i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return n}function ZT(){return{flow:{null:{name:"table",tokenize:eP,resolveAll:tP}}}}function eP(e,t,r){const n=this;let i=0,s=0,o;return l;function l(E){let O=n.events.length-1;for(;O>-1;){const P=n.events[O][1].type;if(P==="lineEnding"||P==="linePrefix")O--;else break}const R=O>-1?n.events[O][1].type:null,C=R==="tableHead"||R==="tableRow"?S:a;return C===S&&n.parser.lazy[n.now().line]?r(E):C(E)}function a(E){return e.enter("tableHead"),e.enter("tableRow"),c(E)}function c(E){return E===124||(o=!0,s+=1),d(E)}function d(E){return E===null?r(E):we(E)?s>1?(s=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):r(E):ze(E)?Ue(e,d,"whitespace")(E):(s+=1,o&&(o=!1,i+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),u(E)))}function u(E){return E===null||E===124||Ze(E)?(e.exit("data"),d(E)):(e.consume(E),E===92?f:u)}function f(E){return E===92||E===124?(e.consume(E),u):u(E)}function p(E){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(E):(e.enter("tableDelimiterRow"),o=!1,ze(E)?Ue(e,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):m(E))}function m(E){return E===45||E===58?b(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),_):L(E)}function _(E){return ze(E)?Ue(e,b,"whitespace")(E):b(E)}function b(E){return E===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),g):E===45?(s+=1,g(E)):E===null||we(E)?k(E):L(E)}function g(E){return E===45?(e.enter("tableDelimiterFiller"),v(E)):L(E)}function v(E){return E===45?(e.consume(E),v):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(E))}function y(E){return ze(E)?Ue(e,k,"whitespace")(E):k(E)}function k(E){return E===124?m(E):E===null||we(E)?!o||i!==s?L(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):L(E)}function L(E){return r(E)}function S(E){return e.enter("tableRow"),j(E)}function j(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),j):E===null||we(E)?(e.exit("tableRow"),t(E)):ze(E)?Ue(e,j,"whitespace")(E):(e.enter("data"),T(E))}function T(E){return E===null||E===124||Ze(E)?(e.exit("data"),j(E)):(e.consume(E),E===92?B:T)}function B(E){return E===92||E===124?(e.consume(E),T):T(E)}}function tP(e,t){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,a=0,c,d,u;const f=new GT;for(;++r<e.length;){const p=e[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(l=!1,a!==0&&(xg(f,t,a,c,d),d=void 0,a=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,u=void 0,s=[0,0,0,0],o=[0,r+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",d,t]])),i=m.type==="tableDelimiterRow"?2:d?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],u=Ml(f,t,s,i,void 0,u),s=[0,0,0,0]),o[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],u=Ml(f,t,s,i,void 0,u)),s=o,o=[s[1],r,0,0])):m.type==="tableHead"?(l=!0,a=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(a=r,s[1]!==0?(o[0]=o[1],u=Ml(f,t,s,i,r,u)):o[1]!==0&&(u=Ml(f,t,o,i,r,u)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(a!==0&&xg(f,t,a,c,d),f.consume(t.events),r=-1;++r<t.events.length;){const p=t.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=JT(t.events,r))}return e}function Ml(e,t,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(s.end=Object.assign({},Yi(t.events,r[0])),e.add(r[0],0,[["exit",s,t]]));const a=Yi(t.events,r[1]);if(s={type:o,start:Object.assign({},a),end:Object.assign({},a)},e.add(r[1],0,[["enter",s,t]]),r[2]!==0){const c=Yi(t.events,r[2]),d=Yi(t.events,r[3]),u={type:l,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(r[2],0,[["enter",u,t]]),n!==2){const f=t.events[r[2]],p=t.events[r[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){const m=r[2]+1,_=r[3]-r[2]-1;e.add(m,_,[])}}e.add(r[3]+1,0,[["exit",u,t]])}return i!==void 0&&(s.end=Object.assign({},Yi(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function xg(e,t,r,n,i){const s=[],o=Yi(t.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),n.end=Object.assign({},o),s.push(["exit",n,t]),e.add(r+1,0,s)}function Yi(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const rP={name:"tasklistCheck",tokenize:iP};function nP(){return{text:{91:rP}}}function iP(e,t,r){const n=this;return i;function i(a){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),s)}function s(a){return Ze(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),o):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),o):r(a)}function o(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):r(a)}function l(a){return we(a)?t(a):ze(a)?e.check({tokenize:sP},t,r)(a):r(a)}}function sP(e,t,r){return Ue(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function oP(e){return Ix([RT(),FT(),XT(e),ZT(),nP()])}const lP={};function yg(e){const t=this,r=e||lP,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(oP(r)),s.push(NT()),o.push(TT(r))}const aP=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,cP=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,uP=({legacyTitle:e=!1,tagName:t="div"}={})=>r=>{xc(r,"blockquote",(n,i,s)=>{let o="",l="",a=!0,c=n.children.map(d=>{if(a&&d.type==="paragraph"){const u=d.children[0],f=u.type==="text"?u.value:"",p=e?cP:aP,m=f.match(p);if(m&&(a=!1,o=m[1].toLocaleLowerCase(),l=e&&m[2]||o.toLocaleUpperCase(),f.includes(`
96
+ `)&&(d.children[0]={type:"text",value:f.replace(p,"").replace(/^\n+/,"")}),!f.includes(`
97
+ `))){const _=[];d.children.forEach((b,g)=>{g!=0&&(g==1&&b.type==="break"||_.push(b))}),d.children=[..._]}}return d});o&&(n.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[hP(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),n.children=[...c]})};function hP(e){let t=dP[e]??"";return{type:"emphasis",data:{hName:"svg",hProperties:{className:["octicon"],viewBox:"0 0 16 16",width:"16",height:"16",ariaHidden:"true"}},children:[{type:"emphasis",data:{hName:"path",hProperties:{d:t}},children:[]}]}}const dP={note:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",tip:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",important:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",warning:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",caution:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"};function fP(e){ty(e,[/\r?\n|\r/g,pP])}function pP(){return{type:"break"}}function mP(){return function(e){fP(e)}}const lt={size:18};function gP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),h.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),h.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),h.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}function _P({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2"}),h.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2"}),h.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),h.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),h.jsx("line",{x1:"10",y1:"6",x2:"18",y2:"6"}),h.jsx("line",{x1:"10",y1:"18",x2:"18",y2:"18"})]})}function vP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),h.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}),h.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),h.jsx("line",{x1:"8",y1:"14",x2:"14",y2:"14"}),h.jsx("line",{x1:"8",y1:"18",x2:"12",y2:"18"})]})}function Cy({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function xP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),h.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}function $a({size:e=lt.size,className:t}){return h.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:h.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function ll({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),h.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),h.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function yP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"}),h.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),h.jsx("line",{x1:"8",y1:"17",x2:"13",y2:"17"})]})}function wP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("circle",{cx:"11",cy:"11",r:"8"}),h.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function Fa({size:e=lt.size,className:t}){return h.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:h.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function bP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("polyline",{points:"23 4 23 10 17 10"}),h.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})}function Ey({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),h.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),h.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function Ny({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("path",{d:"M12 22v-5"}),h.jsx("path",{d:"M9 8V2"}),h.jsx("path",{d:"M15 8V2"}),h.jsx("path",{d:"M18 8v5a6 6 0 0 1-12 0V8z"})]})}function SP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),h.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function wg({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function kP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),h.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),h.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})}function CP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("polyline",{points:"4 17 10 11 4 5"}),h.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function EP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),h.jsx("path",{d:"M12 15l-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),h.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),h.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]})}function NP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("rect",{x:"3",y:"8",width:"18",height:"12",rx:"2"}),h.jsx("path",{d:"M12 2v6"}),h.jsx("circle",{cx:"8.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"}),h.jsx("circle",{cx:"15.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"})]})}function TP({size:e=lt.size,className:t}){return h.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:h.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"})})}function PP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("rect",{x:"9",y:"10",width:"6",height:"12",rx:"1"}),h.jsx("path",{d:"M12 2c-1.5 2-3 3.5-3 5a3 3 0 0 0 6 0c0-1.5-1.5-3-3-5z"})]})}function LP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("circle",{cx:"12",cy:"12",r:"5"}),h.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),h.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),h.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),h.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),h.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),h.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),h.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),h.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})}function RP({size:e=lt.size,className:t}){return h.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:h.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function MP({size:e=lt.size,className:t}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[h.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),h.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),h.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function IP(e){const r=e.split(`
98
+ `).map(l=>{if(!l.includes("\r"))return l;const a=l.split("\r").map(u=>u.trim()).filter(Boolean);if(a.length===0)return"";const c=a.filter(u=>u.startsWith("⏺"));if(c.length>0)return c[c.length-1];const d=a.filter(u=>!(/^[❯›>]\s*$/.test(u)||/^[^a-zA-Z0-9\s]\s*\S+[…\.]{1,3}\s*$/.test(u)&&u.length<40||/^[╭╰│├╮╯─═]+$/.test(u)));return d.length>0?d[d.length-1]:a[a.length-1]}).join(`
99
+ `).split(`
100
+ `),n={},i=[];let s=!1;for(const l of r){const a=l.trim();if(a===""){s=!1,i.push("");continue}if(/^❯\s*$/.test(a)||/^>\s*$/.test(a)||/^[✡-✩✪-✿⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◆◇◐◑◒◓]\s*\S+[…\.]{1,3}\s*$/.test(a)||/^◐\s/.test(a)||/\/effort/.test(a)||/^⎿\s+(Tip|Note|Hint):/.test(a)||/^\?\s*(for\s*shortcuts|shortcuts)/.test(a)||/esc\s+to\s+interrupt|shift\+tab\s+to\s+cycle|accept\s+edits\s+on/i.test(a)||/Brewing[…\.]{0,3}\s*\d*$/i.test(a)||/^[✢✳✶✻⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◆◇✦\s]+$/.test(a)||/^Auto-updating/i.test(a))continue;if(/^[⏺●·⏵]/.test(l)){const d=l.match(/^[⏺●·]\s*([A-Za-z][A-Za-z0-9_]*)\s*[\(\[]/);if(d)n[d[1]]=(n[d[1]]||0)+1;else{const u=l.replace(/^[⏺●·⏵]\s*/,"").trim().slice(0,40);u&&(n[u]=(n[u]||0)+1)}s=!0;continue}if(/^[\s]*[╭╰│├╮╯]/.test(l)||/^[╭╰│├╮╯─]+/.test(a)||/^\s+[⊙✓✗○◎▸►✦]/.test(l)||s&&/^\s{2,}/.test(l))continue;s=!1;const c=l.replace(/^❯\s+/,"");i.push(c)}const o=i.join(`
101
+ `).replace(/\n{3,}/g,`
102
+
103
+ `).trim();return{toolCounts:n,textContent:o,hasTools:Object.keys(n).length>0}}function pu(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const DP=x.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",userName:i,isCliMode:s=!1,isWorking:o=!1,contextKey:l="",receivedAtMap:a={},emptyState:c,onLoadMore:d,isLoadingMore:u,hasMoreHistory:f},p){var z;const m=x.useRef(null),_=x.useRef(null),b=x.useRef(0),g=x.useRef(""),v=x.useRef(!1),[y,k]=x.useState(new Set),[L,S]=x.useState(new Set),j=x.useRef(!1),T=()=>{const A=m.current;return A?A.scrollHeight-A.scrollTop-A.clientHeight<200:!0},B=t.length>0?`${t.length}:${(((z=t[t.length-1])==null?void 0:z.content)||"").length}`:"0:0";x.useEffect(()=>{var V,w;const A=!v.current,U=g.current!==l;if(g.current=l,A||U){v.current=!0,j.current=!1;const Z=()=>{var oe;(oe=_.current)==null||oe.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(Z)),setTimeout(Z,100),setTimeout(Z,300),b.current=t.length;return}t.length>b.current?j.current||(V=_.current)==null||V.scrollIntoView({behavior:"instant"}):T()&&!j.current&&((w=_.current)==null||w.scrollIntoView({behavior:"instant"})),b.current=t.length},[B,l,o]),x.useImperativeHandle(p,()=>({scrollToBottom:(A="smooth")=>{var U;(U=_.current)==null||U.scrollIntoView({behavior:A})}})),x.useEffect(()=>{const A=m.current;if(!A)return;let U;const D=()=>{clearTimeout(U),U=setTimeout(()=>{j.current=!T()},50)};return A.addEventListener("scroll",D,{passive:!0}),()=>{A.removeEventListener("scroll",D),clearTimeout(U)}},[]);const E=x.useRef(!1),O=x.useRef(0),R=x.useRef(!1);x.useEffect(()=>{const A=m.current;if(!A||!R.current||O.current===0)return;const D=A.scrollHeight-O.current;D>0&&(A.scrollTop=D),O.current=0,R.current=!1},[t.length]),x.useEffect(()=>{const A=m.current;if(!A||!d)return;const U=()=>{A.scrollTop<60&&f&&!u&&!E.current&&(E.current=!0,O.current=A.scrollHeight,d(),setTimeout(()=>{E.current=!1},1500))};return A.addEventListener("scroll",U,{passive:!0}),()=>A.removeEventListener("scroll",U)},[d,f,u]);const C=(()=>{const A=t.map((w,Z)=>({type:"message",data:w,index:Z,ts:w.receivedAt||a[w.id??`i-${Z}`]||0}));if(!r||r.length===0)return A;const U=[...r].sort((w,Z)=>w.timestamp-Z.timestamp).map((w,Z)=>({type:"action",data:w,index:Z,ts:w.timestamp})),D=[];let V=0;for(const w of A){for(;V<U.length&&w.ts>0&&U[V].ts<w.ts;)D.push(U[V++]);D.push(w)}for(;V<U.length;)D.push(U[V++]);return D})(),P=700;return h.jsxs("div",{ref:m,"data-chat-scroll":!0,className:"flex-1 min-h-0 overflow-y-auto px-5 py-6 flex flex-col gap-4 bg-bg-primary",children:[u&&h.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60",children:"⏳ Loading older messages..."}),f&&!u&&h.jsx("div",{className:"text-center py-2",children:h.jsx("button",{onClick:d,className:"bg-transparent border border-border-subtle text-text-muted text-[11px] rounded-xl px-4 py-1 cursor-pointer opacity-70",children:"↑ Load older messages"})}),C.length===0&&!f&&(c||h.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),C.map(A=>{var Ke;if(A.type==="action"){const ue=A.data;return h.jsxs("div",{className:"self-center max-w-[80%] bg-indigo-500/[0.08] text-accent px-3.5 py-1.5 rounded-[20px] text-xs text-center border border-indigo-500/15 opacity-85",children:[h.jsx(dg,{remarkPlugins:[yg],children:ue.text}),h.jsx("span",{className:"text-[10px] opacity-50 ml-2",children:pu(ue.timestamp)})]},`action-${A.index}`)}const U=A.data,D=A.index,V=(U.role||"").toLowerCase(),w=V==="user"||V==="human",Z=U.kind||(V==="tool"?"tool":"standard"),oe=U.receivedAt||a[U.id??`i-${D}`],N=`${l}-${D}`,q=y.has(N),I=L.has(N),$=typeof U.content=="string"?U.content:(U.content||[]).map(ue=>ue.text||"").join(`
104
+ `);if(Z==="thought"){const ue=((Ke=U.meta)==null?void 0:Ke.label)||"Thought";return h.jsxs("div",{className:"self-start max-w-[88%] min-w-0 rounded-lg flex-shrink-0 bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-border-subtle",children:[h.jsx("span",{className:"text-[11px] text-indigo-400",children:h.jsx(TP,{size:13})}),h.jsx("span",{className:"text-[11px] text-indigo-400 font-medium",children:ue})]}),h.jsx("div",{className:"px-3 py-2 text-xs text-text-muted italic leading-relaxed opacity-75",style:{maxHeight:200,overflowY:"auto",whiteSpace:"pre-wrap"},children:$})]},`msg-${D}`)}if(Z==="tool")return h.jsxs("div",{className:"self-start max-w-[88%] min-w-0 flex items-center gap-1.5 text-[11px] text-text-muted py-0.5 px-2.5 pl-2 bg-bg-secondary border border-border-subtle rounded-md font-mono flex-shrink-0",style:{maxHeight:200,overflowY:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere"},children:[h.jsx("span",{className:"text-emerald-500 text-[10px]",children:"⏺"}),h.jsx("span",{className:"text-emerald-500 opacity-80",children:$.split(`
105
+ `)[0].slice(0,80)})]},`msg-${D}`);if(Z==="terminal"){const ue=U.meta||{},ve=ue.isRunning?"⏳":"✅",Q=ue.label||"Ran command";return h.jsxs("div",{className:"self-start max-w-[88%] min-w-0 rounded-lg flex-shrink-0 bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-border-subtle",children:[h.jsx("span",{className:"text-[11px]",children:ve}),h.jsx("span",{className:"text-[11px] text-emerald-500 font-medium",children:Q})]}),h.jsx("pre",{className:"px-3 py-2 text-[11px] text-text-muted font-mono leading-relaxed m-0",style:{maxHeight:250,overflowY:"auto",overflowX:"hidden",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere",background:"transparent"},children:$})]},`msg-${D}`)}if(Z==="system")return h.jsx("div",{className:"self-center text-[11px] text-text-muted opacity-60 px-3 py-0.5 rounded-[20px] border border-border-subtle",children:$.slice(0,100)},`msg-${D}`);const Y=!w&&s?IP($):null,he=Y?Y.textContent:$,me=Y?Object.entries(Y.toolCounts):[],Ce=s&&!w&&!q&&he.length>P,ke=q?$:Ce&&!I?he.slice(0,P):he;return h.jsxs("div",{className:`max-w-[88%] min-w-0 flex flex-col gap-1 ${w?"self-end":"self-start"}`,children:[me.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1 items-center mb-0.5",children:[me.map(([ue,ve])=>h.jsxs("span",{className:"text-[10px] font-mono text-emerald-500 bg-bg-secondary border border-border-subtle rounded px-[7px] py-0.5",children:["⏺ ",ue,ve>1?` ×${ve}`:""]},ue)),(Y==null?void 0:Y.hasTools)&&h.jsx("button",{onClick:()=>k(ue=>{const ve=new Set(ue);return q?ve.delete(N):ve.add(N),ve}),className:"text-[10px] text-text-muted bg-transparent border-none cursor-pointer px-1 py-px opacity-50",children:q?"Collapse":"Original"}),!he&&oe!=null&&h.jsx("span",{className:"text-[10px] opacity-35 ml-0.5",children:pu(oe)})]}),(he||w)&&h.jsxs("div",{className:w?"chat-bubble-user":"",style:{background:w?"linear-gradient(135deg, var(--accent-primary), #4f46e5)":"var(--bg-secondary)",color:w?"#fff":"var(--text-primary)",padding:"12px 16px",borderRadius:w?"16px 16px 4px 16px":"16px 16px 16px 4px",fontSize:13,lineHeight:1.65,border:w?"none":"1px solid var(--border-subtle)"},children:[h.jsxs("div",{className:`flex justify-between items-baseline gap-2 ${he?"mb-1.5":"mb-0"}`,children:[h.jsx("span",{className:"text-[10px] font-bold opacity-60 tracking-wide uppercase",children:w?i||"You":n}),oe!=null&&h.jsx("span",{className:"text-[10px] opacity-45",children:pu(oe)})]}),he&&h.jsx("div",{className:"chat-markdown",children:h.jsx(dg,{remarkPlugins:[yg,uP,mP],children:ke})}),Ce&&h.jsx("button",{onClick:()=>S(ue=>{const ve=new Set(ue);return I?ve.delete(N):ve.add(N),ve}),className:"mt-1.5 text-[11px] font-semibold text-[var(--accent-primary)] bg-transparent border-none cursor-pointer p-0 opacity-80",children:I?"Collapse ↑":`Show more (${Math.round(he.length/100)*100} chars) ↓`})]})]},`msg-${D}`)}),o&&h.jsx("div",{className:"self-start max-w-[90%] bg-bg-secondary rounded-[16px_16px_16px_4px] border border-border-subtle",children:h.jsxs("div",{className:"typing-indicator",children:[h.jsx("div",{className:"dot"}),h.jsx("div",{className:"dot"}),h.jsx("div",{className:"dot"}),h.jsx("span",{className:"text-[11px] text-text-muted ml-1",children:"Agent working..."})]})}),h.jsx("div",{className:"min-h-10",ref:_})]})});/**
106
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
107
+ * @license MIT
108
+ *
109
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
110
+ * @license MIT
111
+ *
112
+ * Originally forked from (with the author's permission):
113
+ * Fabrice Bellard's javascript vt100 for jslinux:
114
+ * http://bellard.org/jslinux/
115
+ * Copyright (c) 2011 Fabrice Bellard
116
+ */var Ty=Object.defineProperty,jP=Object.getOwnPropertyDescriptor,AP=(e,t)=>{for(var r in t)Ty(e,r,{get:t[r],enumerable:!0})},mt=(e,t,r,n)=>{for(var i=n>1?void 0:n?jP(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Ty(t,r,i),i},ce=(e,t)=>(r,n)=>t(r,n,e),bg="Terminal input",Hh={get:()=>bg,set:e=>bg=e},Sg="Too much output to announce, navigate to rows manually to read",Uh={get:()=>Sg,set:e=>Sg=e};function BP(e){return e.replace(/\r?\n/g,"\r")}function OP(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function zP(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function $P(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");Py(i,t,r,n)}}function Py(e,t,r,n){e=BP(e),e=OP(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function Ly(e,t,r){let n=r.getBoundingClientRect(),i=e.clientX-n.left-10,s=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function kg(e,t,r,n,i){Ly(e,t,r),i&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function $n(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function yc(e,t=0,r=e.length){let n="";for(let i=t;i<r;++i){let s=e[i];s>65535?(s-=65536,n+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):n+=String.fromCharCode(s)}return n}var FP=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let n=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[n++]=(this._interim-55296)*1024+s-56320+65536:(t[n++]=this._interim,t[n++]=s),this._interim=0}for(let s=i;s<r;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=r)return this._interim=o,n;let l=e.charCodeAt(s);56320<=l&&l<=57343?t[n++]=(o-55296)*1024+l-56320+65536:(t[n++]=o,t[n++]=l);continue}o!==65279&&(t[n++]=o)}return n}},WP=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let n=0,i,s,o,l,a=0,c=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,_;for(;(_=this.interim[++m]&63)&&m<4;)p<<=6,p|=_;let b=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,g=b-m;for(;c<g;){if(c>=r)return 0;if(_=e[c++],(_&192)!==128){c--,f=!0;break}else this.interim[m++]=_,p<<=6,p|=_&63}f||(b===2?p<128?c--:t[n++]=p:b===3?p<2048||p>=55296&&p<=57343||p===65279||(t[n++]=p):p<65536||p>1114111||(t[n++]=p)),this.interim.fill(0)}let d=r-4,u=c;for(;u<r;){for(;u<d&&!((i=e[u])&128)&&!((s=e[u+1])&128)&&!((o=e[u+2])&128)&&!((l=e[u+3])&128);)t[n++]=i,t[n++]=s,t[n++]=o,t[n++]=l,u+=4;if(i=e[u++],i<128)t[n++]=i;else if((i&224)===192){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(a=(i&31)<<6|s&63,a<128){u--;continue}t[n++]=a}else if((i&240)===224){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[u++],(o&192)!==128){u--;continue}if(a=(i&15)<<12|(s&63)<<6|o&63,a<2048||a>=55296&&a<=57343||a===65279)continue;t[n++]=a}else if((i&248)===240){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[u++],(o&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,n;if(l=e[u++],(l&192)!==128){u--;continue}if(a=(i&7)<<18|(s&63)<<12|(o&63)<<6|l&63,a<65536||a>1114111)continue;t[n++]=a}}return n}},Ry="",Kn=" ",al=class My{constructor(){this.fg=0,this.bg=0,this.extended=new Wa}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new My;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Wa=class Iy{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Iy(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},jr=class Dy extends al{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Wa,this.combinedData=""}static fromCharData(t){let r=new Dy;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?$n(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Cg="di$target",Vh="di$dependencies",mu=new Map;function HP(e){return e[Vh]||[]}function Bt(e){if(mu.has(e))return mu.get(e);let t=function(r,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");UP(t,r,i)};return t._id=e,mu.set(e,t),t}function UP(e,t,r){t[Cg]===t?t[Vh].push({id:e,index:r}):(t[Vh]=[{id:e,index:r}],t[Cg]=t)}var nr=Bt("BufferService"),jy=Bt("CoreMouseService"),Wi=Bt("CoreService"),VP=Bt("CharsetService"),Vf=Bt("InstantiationService"),Ay=Bt("LogService"),ir=Bt("OptionsService"),By=Bt("OscLinkService"),KP=Bt("UnicodeService"),cl=Bt("DecorationService"),Kh=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var d;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,s=new jr,o=r.getTrimmedLength(),l=-1,a=-1,c=!1;for(let u=0;u<o;u++)if(!(a===-1&&!r.hasContent(u))){if(r.loadCell(u,s),s.hasExtendedAttrs()&&s.extended.urlId)if(a===-1){a=u,l=s.extended.urlId;continue}else c=s.extended.urlId!==l;else a!==-1&&(c=!0);if(c||a!==-1&&u===o-1){let f=(d=this._oscLinkService.getLinkData(l))==null?void 0:d.uri;if(f){let p={start:{x:a+1,y:e},end:{x:u+(!c&&u===o-1?1:0),y:e}},m=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let _=new URL(f);["http:","https:"].includes(_.protocol)||(m=!0)}catch{m=!0}m||n.push({text:f,range:p,activate:(_,b)=>i?i.activate(_,b,p):qP(_,b),hover:(_,b)=>{var g;return(g=i==null?void 0:i.hover)==null?void 0:g.call(i,_,b,p)},leave:(_,b)=>{var g;return(g=i==null?void 0:i.leave)==null?void 0:g.call(i,_,b,p)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(a=u,l=s.extended.urlId):(a=-1,l=-1)}}t(n)}};Kh=mt([ce(0,nr),ce(1,ir),ce(2,By)],Kh);function qP(e,t){if(confirm(`Do you want to navigate to ${t}?
117
+
118
+ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var wc=Bt("CharSizeService"),Tn=Bt("CoreBrowserService"),Kf=Bt("MouseService"),Pn=Bt("RenderService"),YP=Bt("SelectionService"),Oy=Bt("CharacterJoinerService"),Rs=Bt("ThemeService"),zy=Bt("LinkProviderService"),XP=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Eg.isErrorNoTelemetry(e)?new Eg(e.message+`
119
+
120
+ `+e.stack):new Error(e.message+`
121
+
122
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},GP=new XP;function ra(e){QP(e)||GP.onUnexpectedError(e)}var qh="Canceled";function QP(e){return e instanceof JP?!0:e instanceof Error&&e.name===qh&&e.message===qh}var JP=class extends Error{constructor(){super(qh),this.name=this.message}};function ZP(e){return new Error(`Illegal argument: ${e}`)}var Eg=class Yh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Yh)return t;let r=new Yh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Xh=class $y extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,$y.prototype)}};function pr(e,t=0){return e[e.length-(1+t)]}var eL;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function n(s){return s>0}e.isGreaterThan=n;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(eL||(eL={}));function tL(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var Fy;(e=>{function t(k){return k&&typeof k=="object"&&typeof k[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*i(k){yield k}e.single=i;function s(k){return t(k)?k:i(k)}e.wrap=s;function o(k){return k||r}e.from=o;function*l(k){for(let L=k.length-1;L>=0;L--)yield k[L]}e.reverse=l;function a(k){return!k||k[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(k){return k[Symbol.iterator]().next().value}e.first=c;function d(k,L){let S=0;for(let j of k)if(L(j,S++))return!0;return!1}e.some=d;function u(k,L){for(let S of k)if(L(S))return S}e.find=u;function*f(k,L){for(let S of k)L(S)&&(yield S)}e.filter=f;function*p(k,L){let S=0;for(let j of k)yield L(j,S++)}e.map=p;function*m(k,L){let S=0;for(let j of k)yield*L(j,S++)}e.flatMap=m;function*_(...k){for(let L of k)yield*L}e.concat=_;function b(k,L,S){let j=S;for(let T of k)j=L(j,T);return j}e.reduce=b;function*g(k,L,S=k.length){for(L<0&&(L+=k.length),S<0?S+=k.length:S>k.length&&(S=k.length);L<S;L++)yield k[L]}e.slice=g;function v(k,L=Number.POSITIVE_INFINITY){let S=[];if(L===0)return[S,k];let j=k[Symbol.iterator]();for(let T=0;T<L;T++){let B=j.next();if(B.done)return[S,e.empty()];S.push(B.value)}return[S,{[Symbol.iterator](){return j}}]}e.consume=v;async function y(k){let L=[];for await(let S of k)L.push(S);return Promise.resolve(L)}e.asyncToArray=y})(Fy||(Fy={}));function Bi(e){if(Fy.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function rL(...e){return ot(()=>Bi(e))}function ot(e){return{dispose:tL(()=>{e()})}}var Wy=class Hy{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{Bi(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Hy.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};Wy.DISABLE_DISPOSED_WARNING=!1;var ti=Wy,je=class{constructor(){this._store=new ti,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};je.None=Object.freeze({dispose(){}});var ks=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},xn=typeof window=="object"?window:globalThis,Gh=class Qh{constructor(t){this.element=t,this.next=Qh.Undefined,this.prev=Qh.Undefined}};Gh.Undefined=new Gh(void 0);var at=Gh,Ng=class{constructor(){this._first=at.Undefined,this._last=at.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===at.Undefined}clear(){let e=this._first;for(;e!==at.Undefined;){let t=e.next;e.prev=at.Undefined,e.next=at.Undefined,e=t}this._first=at.Undefined,this._last=at.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new at(e);if(this._first===at.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==at.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==at.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==at.Undefined&&e.next!==at.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===at.Undefined&&e.next===at.Undefined?(this._first=at.Undefined,this._last=at.Undefined):e.next===at.Undefined?(this._last=this._last.prev,this._last.next=at.Undefined):e.prev===at.Undefined&&(this._first=this._first.next,this._first.prev=at.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==at.Undefined;)yield e.element,e=e.next}},nL=globalThis.performance&&typeof globalThis.performance.now=="function",iL=class Uy{static create(t){return new Uy(t)}constructor(t){this._now=nL&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ft;(e=>{e.None=()=>je.None;function t(R,C){return u(R,()=>{},0,void 0,!0,void 0,C)}e.defer=t;function r(R){return(C,P=null,z)=>{let A=!1,U;return U=R(D=>{if(!A)return U?U.dispose():A=!0,C.call(P,D)},null,z),A&&U.dispose(),U}}e.once=r;function n(R,C,P){return c((z,A=null,U)=>R(D=>z.call(A,C(D)),null,U),P)}e.map=n;function i(R,C,P){return c((z,A=null,U)=>R(D=>{C(D),z.call(A,D)},null,U),P)}e.forEach=i;function s(R,C,P){return c((z,A=null,U)=>R(D=>C(D)&&z.call(A,D),null,U),P)}e.filter=s;function o(R){return R}e.signal=o;function l(...R){return(C,P=null,z)=>{let A=rL(...R.map(U=>U(D=>C.call(P,D))));return d(A,z)}}e.any=l;function a(R,C,P,z){let A=P;return n(R,U=>(A=C(A,U),A),z)}e.reduce=a;function c(R,C){let P,z={onWillAddFirstListener(){P=R(A.fire,A)},onDidRemoveLastListener(){P==null||P.dispose()}},A=new ie(z);return C==null||C.add(A),A.event}function d(R,C){return C instanceof Array?C.push(R):C&&C.add(R),R}function u(R,C,P=100,z=!1,A=!1,U,D){let V,w,Z,oe=0,N,q={leakWarningThreshold:U,onWillAddFirstListener(){V=R($=>{oe++,w=C(w,$),z&&!Z&&(I.fire(w),w=void 0),N=()=>{let Y=w;w=void 0,Z=void 0,(!z||oe>1)&&I.fire(Y),oe=0},typeof P=="number"?(clearTimeout(Z),Z=setTimeout(N,P)):Z===void 0&&(Z=0,queueMicrotask(N))})},onWillRemoveListener(){A&&oe>0&&(N==null||N())},onDidRemoveLastListener(){N=void 0,V.dispose()}},I=new ie(q);return D==null||D.add(I),I.event}e.debounce=u;function f(R,C=0,P){return e.debounce(R,(z,A)=>z?(z.push(A),z):[A],C,void 0,!0,void 0,P)}e.accumulate=f;function p(R,C=(z,A)=>z===A,P){let z=!0,A;return s(R,U=>{let D=z||!C(U,A);return z=!1,A=U,D},P)}e.latch=p;function m(R,C,P){return[e.filter(R,C,P),e.filter(R,z=>!C(z),P)]}e.split=m;function _(R,C=!1,P=[],z){let A=P.slice(),U=R(w=>{A?A.push(w):V.fire(w)});z&&z.add(U);let D=()=>{A==null||A.forEach(w=>V.fire(w)),A=null},V=new ie({onWillAddFirstListener(){U||(U=R(w=>V.fire(w)),z&&z.add(U))},onDidAddFirstListener(){A&&(C?setTimeout(D):D())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return z&&z.add(V),V.event}e.buffer=_;function b(R,C){return(P,z,A)=>{let U=C(new v);return R(function(D){let V=U.evaluate(D);V!==g&&P.call(z,V)},void 0,A)}}e.chain=b;let g=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(C){return this.steps.push(C),this}forEach(C){return this.steps.push(P=>(C(P),P)),this}filter(C){return this.steps.push(P=>C(P)?P:g),this}reduce(C,P){let z=P;return this.steps.push(A=>(z=C(z,A),z)),this}latch(C=(P,z)=>P===z){let P=!0,z;return this.steps.push(A=>{let U=P||!C(A,z);return P=!1,z=A,U?A:g}),this}evaluate(C){for(let P of this.steps)if(C=P(C),C===g)break;return C}}function y(R,C,P=z=>z){let z=(...V)=>D.fire(P(...V)),A=()=>R.on(C,z),U=()=>R.removeListener(C,z),D=new ie({onWillAddFirstListener:A,onDidRemoveLastListener:U});return D.event}e.fromNodeEventEmitter=y;function k(R,C,P=z=>z){let z=(...V)=>D.fire(P(...V)),A=()=>R.addEventListener(C,z),U=()=>R.removeEventListener(C,z),D=new ie({onWillAddFirstListener:A,onDidRemoveLastListener:U});return D.event}e.fromDOMEventEmitter=k;function L(R){return new Promise(C=>r(R)(C))}e.toPromise=L;function S(R){let C=new ie;return R.then(P=>{C.fire(P)},()=>{C.fire(void 0)}).finally(()=>{C.dispose()}),C.event}e.fromPromise=S;function j(R,C){return R(P=>C.fire(P))}e.forward=j;function T(R,C,P){return C(P),R(z=>C(z))}e.runAndSubscribe=T;class B{constructor(C,P){this._observable=C,this._counter=0,this._hasChanged=!1;let z={onWillAddFirstListener:()=>{C.addObserver(this)},onDidRemoveLastListener:()=>{C.removeObserver(this)}};this.emitter=new ie(z),P&&P.add(this.emitter)}beginUpdate(C){this._counter++}handlePossibleChange(C){}handleChange(C,P){this._hasChanged=!0}endUpdate(C){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(R,C){return new B(R,C).emitter.event}e.fromObservable=E;function O(R){return(C,P,z)=>{let A=0,U=!1,D={beginUpdate(){A++},endUpdate(){A--,A===0&&(R.reportChanges(),U&&(U=!1,C.call(P)))},handlePossibleChange(){},handleChange(){U=!0}};R.addObserver(D),R.reportChanges();let V={dispose(){R.removeObserver(D)}};return z instanceof ti?z.add(V):Array.isArray(z)&&z.push(V),V}}e.fromObservableLight=O})(Ft||(Ft={}));var Jh=class Zh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Zh._idPool++}`,Zh.all.add(this)}start(t){this._stopWatch=new iL,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Jh.all=new Set,Jh._idPool=0;var sL=Jh,oL=-1,Vy=class Ky{constructor(t,r,n=(Ky._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let n=this.threshold;if(n<=0||r<n)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(s);let a=new cL(l,s);this._errorHandler(a)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,i]of this._stacks)(!t||r<i)&&(t=[n,i],r=i);return t}};Vy._idPool=1;var lL=Vy,aL=class qy{constructor(t){this.value=t}static create(){let t=new Error;return new qy(t.stack??"")}print(){console.warn(this.value.split(`
123
+ `).slice(2).join(`
124
+ `))}},cL=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},uL=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},hL=0,gu=class{constructor(e){this.value=e,this.id=hL++}},dL=2,fL,ie=class{constructor(t){var r,n,i,s;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new lL((t==null?void 0:t.onListenerError)??ra,((n=this._options)==null?void 0:n.leakWarningThreshold)??oL):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new sL(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,r,n,i;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||n.call(r),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(t,r,n)=>{var l,a,c,d,u;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 p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new uL(`${f}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((l=this._options)==null?void 0:l.onListenerError)||ra)(m),je.None}if(this._disposed)return je.None;r&&(t=t.bind(r));let i=new gu(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=aL.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof gu?(this._deliveryQueue??(this._deliveryQueue=new pL),this._listeners=[this._listeners,i]):this._listeners.push(i):((c=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||c.call(a,this),this._listeners=i,(u=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||u.call(d,this)),this._size++;let o=ot(()=>{s==null||s(),this._removeListener(i)});return n instanceof ti?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(t){var s,o,l,a;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||a.call(l,this),this._size=0;return}let r=this._listeners,n=r.indexOf(t);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--,r[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*dL<=r.length){let c=0;for(let d=0;d<r.length;d++)r[d]?r[c++]=r[d]:i&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=c}}_deliver(t,r){var i;if(!t)return;let n=((i=this._options)==null?void 0:i.onListenerError)||ra;if(!n){t.value(r);return}try{t.value(r)}catch(s){n(s)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,n,i,s;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof gu)this._deliver(this._listeners,t);else{let o=this._deliveryQueue;o.enqueue(this,t,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},pL=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ed=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ie,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ie,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};ed.INSTANCE=new ed;var qf=ed;function mL(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}qf.INSTANCE.onDidChangeZoomLevel;function gL(e){return qf.INSTANCE.getZoomFactor(e)}qf.INSTANCE.onDidChangeFullscreen;var Ms=typeof navigator=="object"?navigator.userAgent:"",td=Ms.indexOf("Firefox")>=0,_L=Ms.indexOf("AppleWebKit")>=0,Yf=Ms.indexOf("Chrome")>=0,vL=!Yf&&Ms.indexOf("Safari")>=0;Ms.indexOf("Electron/")>=0;Ms.indexOf("Android")>=0;var _u=!1;if(typeof xn.matchMedia=="function"){let e=xn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=xn.matchMedia("(display-mode: fullscreen)");_u=e.matches,mL(xn,e,({matches:r})=>{_u&&t.matches||(_u=r)})}var as="en",rd=!1,nd=!1,na=!1,Yy=!1,Il,ia=as,Tg=as,xL,$r,Li=globalThis,$t,O_;typeof Li.vscode<"u"&&typeof Li.vscode.process<"u"?$t=Li.vscode.process:typeof process<"u"&&typeof((O_=process==null?void 0:process.versions)==null?void 0:O_.node)=="string"&&($t=process);var z_,yL=typeof((z_=$t==null?void 0:$t.versions)==null?void 0:z_.electron)=="string",wL=yL&&($t==null?void 0:$t.type)==="renderer",$_;if(typeof $t=="object"){rd=$t.platform==="win32",nd=$t.platform==="darwin",na=$t.platform==="linux",na&&$t.env.SNAP&&$t.env.SNAP_REVISION,$t.env.CI||$t.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Il=as,ia=as;let e=$t.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Il=t.userLocale,Tg=t.osLocale,ia=t.resolvedLanguage||as,xL=($_=t.languagePack)==null?void 0:$_.translationsConfigFile}catch{}Yy=!0}else typeof navigator=="object"&&!wL?($r=navigator.userAgent,rd=$r.indexOf("Windows")>=0,nd=$r.indexOf("Macintosh")>=0,($r.indexOf("Macintosh")>=0||$r.indexOf("iPad")>=0||$r.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,na=$r.indexOf("Linux")>=0,($r==null?void 0:$r.indexOf("Mobi"))>=0,ia=globalThis._VSCODE_NLS_LANGUAGE||as,Il=navigator.language.toLowerCase(),Tg=Il):console.error("Unable to resolve platform.");var Xy=rd,on=nd,bL=na,Pg=Yy,an=$r,In=ia,SL;(e=>{function t(){return In}e.value=t;function r(){return In.length===2?In==="en":In.length>=3?In[0]==="e"&&In[1]==="n"&&In[2]==="-":!1}e.isDefaultVariant=r;function n(){return In==="en"}e.isDefault=n})(SL||(SL={}));var kL=typeof Li.postMessage=="function"&&!Li.importScripts;(()=>{if(kL){let e=[];Li.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,i=e.length;n<i;n++){let s=e[n];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(n,1),s.callback();return}}});let t=0;return r=>{let n=++t;e.push({id:n,callback:r}),Li.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var CL=!!(an&&an.indexOf("Chrome")>=0);an&&an.indexOf("Firefox")>=0;!CL&&an&&an.indexOf("Safari")>=0;an&&an.indexOf("Edg/")>=0;an&&an.indexOf("Android")>=0;var Ki=typeof navigator=="object"?navigator:{};Pg||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ki&&Ki.clipboard&&Ki.clipboard.writeText,Pg||Ki&&Ki.clipboard&&Ki.clipboard.readText;var Xf=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},vu=new Xf,Lg=new Xf,Rg=new Xf,EL=new Array(230),Gy;(e=>{function t(l){return vu.keyCodeToStr(l)}e.toString=t;function r(l){return vu.strToKeyCode(l)}e.fromString=r;function n(l){return Lg.keyCodeToStr(l)}e.toUserSettingsUS=n;function i(l){return Rg.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return Lg.strToKeyCode(l)||Rg.strToKeyCode(l)}e.fromUserSettings=s;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return vu.keyCodeToStr(l)}e.toElectronAccelerator=o})(Gy||(Gy={}));var NL=class Qy{constructor(t,r,n,i,s){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof Qy&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",n=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${r}${n}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new TL([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},TL=class{constructor(e){if(e.length===0)throw ZP("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function PL(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return Gy.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(td)switch(t){case 59:return 85;case 60:if(bL)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(on)return 57;break}else if(_L&&(on&&t===93||!on&&t===92))return 57;return EL[t]||0}var LL=on?256:2048,RL=512,ML=1024,IL=on?2048:256,Mg=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=PL(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=LL),this.altKey&&(t|=RL),this.shiftKey&&(t|=ML),this.metaKey&&(t|=IL),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new NL(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Ig=new WeakMap;function DL(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var jL=class{static getSameOriginWindowChain(e){let t=Ig.get(e);if(!t){t=[],Ig.set(e,t);let r=e,n;do n=DL(r),n?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=n;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,n=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,n+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let l=s.iframeElement.getBoundingClientRect();r+=l.top,n+=l.left}return{top:r,left:n}}},Dl=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=jL.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Dg=class{constructor(e,t=0,r=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let n=!1;if(Yf){let s=navigator.userAgent.match(/Chrome\/(\d+)/);n=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,l=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")n?this.deltaY=s.wheelDeltaY/(120*l):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?td&&!on?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")vL&&Xy?this.deltaX=-(s.wheelDeltaX/120):n?this.deltaX=s.wheelDeltaX/(120*l):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?td&&!on?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Jy=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),AL;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof BL?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ft.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Jy})})(AL||(AL={}));var BL=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?Jy:(this._emitter||(this._emitter=new ie),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Gf=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Xh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Xh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},OL=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new Xh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=ot(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},zL;(e=>{async function t(n){let i,s=await Promise.all(n.map(o=>o.then(l=>l,l=>{i||(i=l)})));if(typeof i<"u")throw i;return s}e.settled=t;function r(n){return new Promise(async(i,s)=>{try{await n(i,s)}catch(o){s(o)}})}e.withAsyncBody=r})(zL||(zL={}));var jg=class Nr{static fromArray(t){return new Nr(r=>{r.emitMany(t)})}static fromPromise(t){return new Nr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Nr(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new Nr(async r=>{await Promise.all(t.map(async n=>{for await(let i of n)r.emitOne(i)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new ie,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(n)),this.resolve()}catch(i){this.reject(i)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ft.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new Nr(async n=>{for await(let i of t)n.emitOne(r(i))})}map(t){return Nr.map(this,t)}static filter(t,r){return new Nr(async n=>{for await(let i of t)r(i)&&n.emitOne(i)})}filter(t){return Nr.filter(this,t)}static coalesce(t){return Nr.filter(t,r=>!!r)}coalesce(){return Nr.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return Nr.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};jg.EMPTY=jg.fromArray([]);var{getWindow:rn,getWindowId:$L,onDidRegisterWindow:FL}=function(){let e=new Map,t={window:xn,disposables:new ti};e.set(xn.vscodeWindowId,t);let r=new ie,n=new ie,i=new ie;function s(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:n.event,registerWindow(o){if(e.has(o.vscodeWindowId))return je.None;let l=new ti,a={window:o,disposables:l.add(new ti)};return e.set(o.vscodeWindowId,a),l.add(ot(()=>{e.delete(o.vscodeWindowId),n.fire(o)})),l.add(Se(o,Rt.BEFORE_UNLOAD,()=>{i.fire(o)})),r.fire(a),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let l=o;if((c=l==null?void 0:l.ownerDocument)!=null&&c.defaultView)return l.ownerDocument.defaultView.window;let a=o;return a!=null&&a.view?a.view.window:xn},getDocument(o){return rn(o).document}}}(),WL=class{constructor(e,t,r,n){this._node=e,this._type=t,this._handler=r,this._options=n||!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 Se(e,t,r,n){return new WL(e,t,r,n)}var Ag=function(e,t,r,n){return Se(e,t,r,n)},Qf,HL=class extends OL{constructor(e){super(),this.defaultTarget=e&&rn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},Bg=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ra(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,n=new Map,i=s=>{r.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),n.set(s,!0);o.length>0;)o.sort(Bg.sort),o.shift().execute();n.set(s,!1)};Qf=(s,o,l=0)=>{let a=$L(s),c=new Bg(o,l),d=e.get(a);return d||(d=[],e.set(a,d)),d.push(c),r.get(a)||(r.set(a,!0),s.requestAnimationFrame(()=>i(a))),c}})();function UL(e){let t=e.getBoundingClientRect(),r=rn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var Rt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},VL=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=sr(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=sr(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=sr(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=sr(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=sr(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=sr(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=sr(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=sr(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=sr(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=sr(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=sr(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=sr(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=sr(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=sr(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function sr(e){return typeof e=="number"?`${e}px`:e}function So(e){return new VL(e)}var Zy=class{constructor(){this._hooks=new ti,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,n,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(ot(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=rn(e)}this._hooks.add(Se(s,Rt.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Se(s,Rt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function KL(e,t,r){let n=null,i=null;if(typeof r.value=="function"?(n="value",i=r.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",i=r.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;r[n]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var Jr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Jr||(Jr={}));var so=class Kt extends je{constructor(){super(),this.dispatched=!1,this.targets=new Ng,this.ignoreTargets=new Ng,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ft.runAndSubscribe(FL,({window:t,disposables:r})=>{r.add(Se(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(Se(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(Se(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:xn,disposables:this._store}))}static addTarget(t){if(!Kt.isTouchDevice())return je.None;Kt.INSTANCE||(Kt.INSTANCE=new Kt);let r=Kt.INSTANCE.targets.push(t);return ot(r)}static ignoreTarget(t){if(!Kt.isTouchDevice())return je.None;Kt.INSTANCE||(Kt.INSTANCE=new Kt);let r=Kt.INSTANCE.ignoreTargets.push(t);return ot(r)}static isTouchDevice(){return"ontouchstart"in xn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,i=t.targetTouches.length;n<i;n++){let s=t.targetTouches.item(n);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:r,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[r],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(Jr.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let n=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=r.changedTouches.length;s<o;s++){let l=r.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let a=this.activeTouches[l.identifier],c=Date.now()-a.initialTimeStamp;if(c<Kt.HOLD_DELAY&&Math.abs(a.initialPageX-pr(a.rollingPageX))<30&&Math.abs(a.initialPageY-pr(a.rollingPageY))<30){let d=this.newGestureEvent(Jr.Tap,a.initialTarget);d.pageX=pr(a.rollingPageX),d.pageY=pr(a.rollingPageY),this.dispatchEvent(d)}else if(c>=Kt.HOLD_DELAY&&Math.abs(a.initialPageX-pr(a.rollingPageX))<30&&Math.abs(a.initialPageY-pr(a.rollingPageY))<30){let d=this.newGestureEvent(Jr.Contextmenu,a.initialTarget);d.pageX=pr(a.rollingPageX),d.pageY=pr(a.rollingPageY),this.dispatchEvent(d)}else if(i===1){let d=pr(a.rollingPageX),u=pr(a.rollingPageY),f=pr(a.rollingTimestamps)-a.rollingTimestamps[0],p=d-a.rollingPageX[0],m=u-a.rollingPageY[0],_=[...this.targets].filter(b=>a.initialTarget instanceof Node&&b.contains(a.initialTarget));this.inertia(t,_,n,Math.abs(p)/f,p>0?1:-1,d,Math.abs(m)/f,m>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Jr.End,a.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=r,n.tapCount=0,n}dispatchEvent(t){if(t.type===Jr.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Kt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===Jr.Change||t.type===Jr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let r=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==n;)i++,s=s.parentElement;r.push([i,n])}r.sort((n,i)=>n[0]-i[0]);for(let[n,i]of r)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,i,s,o,l,a,c){this.handle=Qf(t,()=>{let d=Date.now(),u=d-n,f=0,p=0,m=!0;i+=Kt.SCROLL_FRICTION*u,l+=Kt.SCROLL_FRICTION*u,i>0&&(m=!1,f=s*i*u),l>0&&(m=!1,p=a*l*u);let _=this.newGestureEvent(Jr.Change);_.translationX=f,_.translationY=p,r.forEach(b=>b.dispatchEvent(_)),m||this.inertia(t,r,d,i,s,o+f,l,a,c+p)})}onTouchMove(t){let r=Date.now();for(let n=0,i=t.changedTouches.length;n<i;n++){let s=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],l=this.newGestureEvent(Jr.Change,o.initialTarget);l.translationX=s.pageX-pr(o.rollingPageX),l.translationY=s.pageY-pr(o.rollingPageY),l.pageX=s.pageX,l.pageY=s.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};so.SCROLL_FRICTION=-.005,so.HOLD_DELAY=700,so.CLEAR_TAP_COUNT_TIME=400,mt([KL],so,"isTouchDevice",1);var qL=so,Jf=class extends je{onclick(e,t){this._register(Se(e,Rt.CLICK,r=>t(new Dl(rn(e),r))))}onmousedown(e,t){this._register(Se(e,Rt.MOUSE_DOWN,r=>t(new Dl(rn(e),r))))}onmouseover(e,t){this._register(Se(e,Rt.MOUSE_OVER,r=>t(new Dl(rn(e),r))))}onmouseleave(e,t){this._register(Se(e,Rt.MOUSE_LEAVE,r=>t(new Dl(rn(e),r))))}onkeydown(e,t){this._register(Se(e,Rt.KEY_DOWN,r=>t(new Mg(r))))}onkeyup(e,t){this._register(Se(e,Rt.KEY_UP,r=>t(new Mg(r))))}oninput(e,t){this._register(Se(e,Rt.INPUT,t))}onblur(e,t){this._register(Se(e,Rt.BLUR,t))}onfocus(e,t){this._register(Se(e,Rt.FOCUS,t))}onchange(e,t){this._register(Se(e,Rt.CHANGE,t))}ignoreGesture(e){return qL.ignoreTarget(e)}},Og=11,YL=class extends Jf{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Og+"px",this.domNode.style.height=Og+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Zy),this._register(Ag(this.bgDomNode,Rt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Ag(this.domNode,Rt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new HL),this._pointerdownScheduleRepeatTimer=this._register(new Gf)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,rn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},XL=class id{constructor(t,r,n,i,s,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,i=i|0,s=s|0,o=o|0,l=l|0),this.rawScrollLeft=i,this.rawScrollTop=l,r<0&&(r=0),i+r>n&&(i=n-r),i<0&&(i=0),s<0&&(s=0),l+s>o&&(l=o-s),l<0&&(l=0),this.width=r,this.scrollWidth=n,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new id(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new id(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let n=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,a=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},GL=class extends je{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ie),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new XL(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var n;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(n=this._smoothScrolling)==null||n.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;t?n=new $g(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=$g.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},zg=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function xu(e,t){let r=t-e;return function(n){return e+r*ZL(n)}}function QL(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var $g=class sd{constructor(t,r,n,i){this.from=t,this.to=r,this.duration=i,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,n){if(Math.abs(t-r)>2.5*n){let i,s;return t<r?(i=t+.75*n,s=r-.75*n):(i=t-.75*n,s=r+.75*n),QL(xu(t,i),xu(s,r),.33)}return xu(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let n=this.scrollLeft(r),i=this.scrollTop(r);return new zg(n,i,!1)}return new zg(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return sd.start(t,r,n)}static start(t,r,n){n=n+10;let i=Date.now()-10;return new sd(t,r,i,n)}};function JL(e){return Math.pow(e,3)}function ZL(e){return 1-JL(1-e)}var e3=class extends je{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Gf)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},t3=140,e1=class extends Jf{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new e3(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Zy),this._shouldRender=!0,this.domNode=So(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Se(this.domNode.domNode,Rt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new YL(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=So(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Se(this.slider.domNode,Rt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);r<=i&&i<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let i=UL(this.domNode.domNode);t=e.pageX-i.left,r=e.pageY-i.top}let n=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-r);if(Xy&&o>t3){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let l=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},t1=class od{constructor(t,r,n,i,s,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new od(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,n,i,s){let o=Math.max(0,n-t),l=Math.max(0,o-2*r),a=i>0&&i>n;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*l/i))),d=(l-c)/(i-n),u=s*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(c),computedSliderRatio:d,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=od._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,n=this._scrollPosition;return r<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},r3=class extends e1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new t1(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},n3=class extends e1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new t1(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},i3=500,Fg=50,s3=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},ld=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,n=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-n);if(t-=s,r+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,n++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(Yf){let r=rn(t.browserEvent),n=gL(r);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,n){let i=null,s=new s3(t,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,i)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),r){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(r.deltaX),l=Math.abs(r.deltaY),a=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,l),1),d=Math.max(i,o),u=Math.max(s,l);d%a===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};ld.INSTANCE=new ld;var o3=ld,l3=class extends Jf{constructor(e,t,r){super(),this._onScroll=this._register(new ie),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ie),this.onWillScroll=this._onWillScroll.event,this._options=c3(t),this._scrollable=r,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let n={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new n3(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new r3(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=So(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=So(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=So(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new Gf),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Bi(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,on&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Dg(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Bi(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Dg(r))};this._mouseWheelToDispose.push(Se(this._listenOnDomNode,Rt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=o3.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let l=!on&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),c={};if(s){let d=Fg*s,u=a.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(c,u)}if(o){let d=Fg*o,u=a.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(c,u)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",i=t?" top":"",s=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),i3)}},a3=class extends l3{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function c3(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,on&&(t.className+=" mac"),t}var ad=class extends je{constructor(e,t,r,n,i,s,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new ie),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new GL({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Qf(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new a3(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ft.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ot(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ot(()=>this._styleElement.remove())),this._register(Ft.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
125
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};ad=mt([ce(2,nr),ce(3,Tn),ce(4,jy),ce(5,Rs),ce(6,ir),ce(7,Pn)],ad);var cd=class extends je{constructor(e,t,r,n,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=n,this._renderService=i,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(s=>this._removeDecoration(s))),this._register(ot(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var n;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((n=e==null?void 0:e.options)==null?void 0:n.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};cd=mt([ce(1,nr),ce(2,Tn),ce(3,cl),ce(4,Pn)],cd);var u3=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Gr={full:0,left:0,center:0,right:0},Dn={full:0,left:0,center:0,right:0},Ks={full:0,left:0,center:0,right:0},Ha=class extends je{constructor(e,t,r,n,i,s,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new u3,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(ot(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let a=this._canvas.getContext("2d");if(a)this._ctx=a;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Dn.full=this._canvas.width,Dn.left=e,Dn.center=t,Dn.right=e,this._refreshDrawHeightConstants(),Ks.full=1,Ks.left=1,Ks.center=1+Dn.left,Ks.right=1+Dn.left+Dn.center}_refreshDrawHeightConstants(){Gr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Gr.left=t,Gr.center=t,Gr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Gr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Gr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Gr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Gr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Ks[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Gr[e.position||"full"]/2),Dn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Gr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Ha=mt([ce(2,nr),ce(3,cl),ce(4,Pn),ce(5,ir),ce(6,Rs),ce(7,Tn)],Ha);var X;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
126
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(X||(X={}));var sa;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(sa||(sa={}));var r1;(e=>e.ST=`${X.ESC}\\`)(r1||(r1={}));var ud=class{constructor(e,t,r,n,i,s){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=i,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${X.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ud=mt([ce(2,nr),ce(3,ir),ce(4,Wi),ce(5,Pn)],ud);var It=0,Dt=0,jt=0,ft=0,Wg={css:"#00000000",rgba:0},wt;(e=>{function t(i,s,o,l){return l!==void 0?`#${fi(i)}${fi(s)}${fi(o)}${fi(l)}`:`#${fi(i)}${fi(s)}${fi(o)}`}e.toCss=t;function r(i,s,o,l=255){return(i<<24|s<<16|o<<8|l)>>>0}e.toRgba=r;function n(i,s,o,l){return{css:e.toCss(i,s,o,l),rgba:e.toRgba(i,s,o,l)}}e.toColor=n})(wt||(wt={}));var nt;(e=>{function t(a,c){if(ft=(c.rgba&255)/255,ft===1)return{css:c.css,rgba:c.rgba};let d=c.rgba>>24&255,u=c.rgba>>16&255,f=c.rgba>>8&255,p=a.rgba>>24&255,m=a.rgba>>16&255,_=a.rgba>>8&255;It=p+Math.round((d-p)*ft),Dt=m+Math.round((u-m)*ft),jt=_+Math.round((f-_)*ft);let b=wt.toCss(It,Dt,jt),g=wt.toRgba(It,Dt,jt);return{css:b,rgba:g}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function n(a,c,d){let u=oa.ensureContrastRatio(a.rgba,c.rgba,d);if(u)return wt.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=n;function i(a){let c=(a.rgba|255)>>>0;return[It,Dt,jt]=oa.toChannels(c),{css:wt.toCss(It,Dt,jt),rgba:c}}e.opaque=i;function s(a,c){return ft=Math.round(c*255),[It,Dt,jt]=oa.toChannels(a.rgba),{css:wt.toCss(It,Dt,jt,ft),rgba:wt.toRgba(It,Dt,jt,ft)}}e.opacity=s;function o(a,c){return ft=a.rgba&255,s(a,ft*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(nt||(nt={}));var ct;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return It=parseInt(i.slice(1,2).repeat(2),16),Dt=parseInt(i.slice(2,3).repeat(2),16),jt=parseInt(i.slice(3,4).repeat(2),16),wt.toColor(It,Dt,jt);case 5:return It=parseInt(i.slice(1,2).repeat(2),16),Dt=parseInt(i.slice(2,3).repeat(2),16),jt=parseInt(i.slice(3,4).repeat(2),16),ft=parseInt(i.slice(4,5).repeat(2),16),wt.toColor(It,Dt,jt,ft);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return It=parseInt(s[1]),Dt=parseInt(s[2]),jt=parseInt(s[3]),ft=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),wt.toColor(It,Dt,jt,ft);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[It,Dt,jt,ft]=t.getImageData(0,0,1,1).data,ft!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:wt.toRgba(It,Dt,jt,ft),css:i}}e.toColor=n})(ct||(ct={}));var Qt;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,s){let o=n/255,l=i/255,a=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),u=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return c*.2126+d*.7152+u*.0722}e.relativeLuminance2=r})(Qt||(Qt={}));var oa;(e=>{function t(o,l){if(ft=(l&255)/255,ft===1)return l;let a=l>>24&255,c=l>>16&255,d=l>>8&255,u=o>>24&255,f=o>>16&255,p=o>>8&255;return It=u+Math.round((a-u)*ft),Dt=f+Math.round((c-f)*ft),jt=p+Math.round((d-p)*ft),wt.toRgba(It,Dt,jt)}e.blend=t;function r(o,l,a){let c=Qt.relativeLuminance(o>>8),d=Qt.relativeLuminance(l>>8);if(un(c,d)<a){if(d<c){let p=n(o,l,a),m=un(c,Qt.relativeLuminance(p>>8));if(m<a){let _=i(o,l,a),b=un(c,Qt.relativeLuminance(_>>8));return m>b?p:_}return p}let u=i(o,l,a),f=un(c,Qt.relativeLuminance(u>>8));if(f<a){let p=n(o,l,a),m=un(c,Qt.relativeLuminance(p>>8));return f>m?u:p}return u}}e.ensureContrastRatio=r;function n(o,l,a){let c=o>>24&255,d=o>>16&255,u=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,_=un(Qt.relativeLuminance2(f,p,m),Qt.relativeLuminance2(c,d,u));for(;_<a&&(f>0||p>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m-=Math.max(0,Math.ceil(m*.1)),_=un(Qt.relativeLuminance2(f,p,m),Qt.relativeLuminance2(c,d,u));return(f<<24|p<<16|m<<8|255)>>>0}e.reduceLuminance=n;function i(o,l,a){let c=o>>24&255,d=o>>16&255,u=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,_=un(Qt.relativeLuminance2(f,p,m),Qt.relativeLuminance2(c,d,u));for(;_<a&&(f<255||p<255||m<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),_=un(Qt.relativeLuminance2(f,p,m),Qt.relativeLuminance2(c,d,u));return(f<<24|p<<16|m<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(oa||(oa={}));function fi(e){let t=e.toString(16);return t.length<2?"0"+t:t}function un(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var h3=class extends al{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ua=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new jr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],n=t.translateToString(!0),i=0,s=0,o=0,l=t.getFg(0),a=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==a){if(c-i>1){let d=this._getJoinedRanges(n,o,s,t,i);for(let u=0;u<d.length;u++)r.push(d[u])}i=c,o=s,l=this._workCell.fg,a=this._workCell.bg}s+=this._workCell.getChars().length||Kn.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(n,o,s,t,i);for(let d=0;d<c.length;d++)r.push(c[d])}return r}_getJoinedRanges(e,t,r,n,i){let s=e.substring(t,r),o=[];try{o=this._characterJoiners[0].handler(s)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let a=this._characterJoiners[l].handler(s);for(let c=0;c<a.length;c++)Ua._mergeRanges(o,a[c])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,n,i),o}_stringRangesToCellRanges(e,t,r){let n=0,i=!1,s=0,o=e[n];if(o){for(let l=r;l<this._bufferService.cols;l++){let a=t.getWidth(l),c=t.getString(l).length||Kn.length;if(a!==0){if(!i&&o[0]<=s&&(o[0]=l,i=!0),o[1]<=s){if(o[1]=l,o=e[++n],!o)break;o[0]<=s?(o[0]=l,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(r){if(t[1]<=i[0])return e[n-1][1]=t[1],e;if(t[1]<=i[1])return e[n-1][1]=Math.max(t[1],i[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=i[0])return e.splice(n,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Ua=mt([ce(0,nr)],Ua);function d3(e){return 57508<=e&&e<=57558}function f3(e){return 9472<=e&&e<=9631}function p3(e){return d3(e)||f3(e)}function m3(){return{css:{canvas:jl(),cell:jl()},device:{canvas:jl(),cell:jl(),char:{width:0,height:0,left:0,top:0}}}}function jl(){return{width:0,height:0}}var hd=class{constructor(e,t,r,n,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new jr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,i,s,o,l,a,c,d){let u=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<s+1&&(m=s+1);let _,b=0,g="",v=0,y=0,k=0,L=0,S=!1,j=0,T=!1,B=0,E=0,O=[],R=c!==-1&&d!==-1;for(let C=0;C<m;C++){e.loadCell(C,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let z=!1,A=C>=E,U=C,D=this._workCell;if(f.length>0&&C===f[0][0]&&A){let ue=f.shift(),ve=this._isCellInSelection(ue[0],t);for(v=ue[0]+1;v<ue[1];v++)A&&(A=ve===this._isCellInSelection(v,t));A&&(A=!r||s<ue[0]||s>=ue[1]),A?(z=!0,D=new h3(this._workCell,e.translateToString(!0,ue[0],ue[1]),ue[1]-ue[0]),U=ue[1]-1,P=D.getWidth()):E=ue[1]}let V=this._isCellInSelection(C,t),w=r&&C===s,Z=R&&C>=c&&C<=d,oe=!1;this._decorationService.forEachDecorationAtCell(C,t,void 0,ue=>{oe=!0});let N=D.getChars()||Kn;if(N===" "&&(D.isUnderline()||D.isOverline())&&(N=" "),B=P*l-a.get(N,D.isBold(),D.isItalic()),!_)_=this._document.createElement("span");else if(b&&(V&&T||!V&&!T&&D.bg===y)&&(V&&T&&p.selectionForeground||D.fg===k)&&D.extended.ext===L&&Z===S&&B===j&&!w&&!z&&!oe&&A){D.isInvisible()?g+=Kn:g+=N,b++;continue}else b&&(_.textContent=g),_=this._document.createElement("span"),b=0,g="";if(y=D.bg,k=D.fg,L=D.extended.ext,S=Z,j=B,T=V,z&&s>=C&&s<=U&&(s=C),!this._coreService.isCursorHidden&&w&&this._coreService.isCursorInitialized){if(O.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&O.push("xterm-cursor-blink"),O.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":O.push("xterm-cursor-outline");break;case"block":O.push("xterm-cursor-block");break;case"bar":O.push("xterm-cursor-bar");break;case"underline":O.push("xterm-cursor-underline");break}}if(D.isBold()&&O.push("xterm-bold"),D.isItalic()&&O.push("xterm-italic"),D.isDim()&&O.push("xterm-dim"),D.isInvisible()?g=Kn:g=D.getChars()||Kn,D.isUnderline()&&(O.push(`xterm-underline-${D.extended.underlineStyle}`),g===" "&&(g=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())_.style.textDecorationColor=`rgb(${al.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let ue=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&ue<8&&(ue+=8),_.style.textDecorationColor=p.ansi[ue].css}D.isOverline()&&(O.push("xterm-overline"),g===" "&&(g=" ")),D.isStrikethrough()&&O.push("xterm-strikethrough"),Z&&(_.style.textDecoration="underline");let q=D.getFgColor(),I=D.getFgColorMode(),$=D.getBgColor(),Y=D.getBgColorMode(),he=!!D.isInverse();if(he){let ue=q;q=$,$=ue;let ve=I;I=Y,Y=ve}let me,Ce,ke=!1;this._decorationService.forEachDecorationAtCell(C,t,void 0,ue=>{ue.options.layer!=="top"&&ke||(ue.backgroundColorRGB&&(Y=50331648,$=ue.backgroundColorRGB.rgba>>8&16777215,me=ue.backgroundColorRGB),ue.foregroundColorRGB&&(I=50331648,q=ue.foregroundColorRGB.rgba>>8&16777215,Ce=ue.foregroundColorRGB),ke=ue.options.layer==="top")}),!ke&&V&&(me=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,$=me.rgba>>8&16777215,Y=50331648,ke=!0,p.selectionForeground&&(I=50331648,q=p.selectionForeground.rgba>>8&16777215,Ce=p.selectionForeground)),ke&&O.push("xterm-decoration-top");let Ke;switch(Y){case 16777216:case 33554432:Ke=p.ansi[$],O.push(`xterm-bg-${$}`);break;case 50331648:Ke=wt.toColor($>>16,$>>8&255,$&255),this._addStyle(_,`background-color:#${Hg(($>>>0).toString(16),"0",6)}`);break;case 0:default:he?(Ke=p.foreground,O.push("xterm-bg-257")):Ke=p.background}switch(me||D.isDim()&&(me=nt.multiplyOpacity(Ke,.5)),I){case 16777216:case 33554432:D.isBold()&&q<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(q+=8),this._applyMinimumContrast(_,Ke,p.ansi[q],D,me,void 0)||O.push(`xterm-fg-${q}`);break;case 50331648:let ue=wt.toColor(q>>16&255,q>>8&255,q&255);this._applyMinimumContrast(_,Ke,ue,D,me,Ce)||this._addStyle(_,`color:#${Hg(q.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(_,Ke,p.foreground,D,me,Ce)||he&&O.push("xterm-fg-257")}O.length&&(_.className=O.join(" "),O.length=0),!w&&!z&&!oe&&A?b++:_.textContent=g,B!==this.defaultSpacing&&(_.style.letterSpacing=`${B}px`),u.push(_),C=U}return _&&b&&(_.textContent=g),u}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||p3(n.getCode()))return!1;let o=this._getContrastCache(n),l;if(!i&&!s&&(l=o.getColor(t.rgba,r.rgba)),l===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);l=nt.ensureContrastRatio(i||t,s||r,a),o.setColor((i||t).rgba,(s||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,n=this._selectionEnd;return!r||!n?!1:this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&t>=r[1]&&e<n[0]&&t<=n[1]:e<r[0]&&t>=r[1]&&e>=n[0]&&t<=n[1]:t>r[1]&&t<n[1]||r[1]===n[1]&&t===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&t===n[1]&&e<n[0]||r[1]<n[1]&&t===r[1]&&e>=r[0]}};hd=mt([ce(1,Oy),ce(2,ir),ce(3,Tn),ce(4,Wi),ce(5,cl),ce(6,Rs)],hd);function Hg(e,t,r){for(;e.length<r;)e=t+e;return e}var g3=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[r,n,i,s],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,r,n){e===this._font&&t===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,r){let n=0;if(!t&&!r&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let o=this._measure(e,0);return o>0&&(this._flat[n]=o),o}let i=e;t&&(i+="B"),r&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),r&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},_3=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,n=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=r[1]-i,l=Math.max(s,0),a=Math.min(o,e.rows-1);if(l>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function v3(){return new _3}var yu="xterm-dom-renderer-owner-",Cr="xterm-rows",Al="xterm-fg-",Ug="xterm-bg-",qs="xterm-focus",Bl="xterm-selection",x3=1,dd=class extends je{constructor(e,t,r,n,i,s,o,l,a,c,d,u,f,p){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=a,this._optionsService=c,this._bufferService=d,this._coreService=u,this._coreBrowserService=f,this._themeService=p,this._terminalClass=x3++,this._rowElements=[],this._selectionRenderModel=v3(),this.onRequestRedraw=this._register(new ie).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Cr),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(Bl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=m3(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(hd,document),this._element.classList.add(yu+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(ot(()=>{this._element.classList.remove(yu+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new g3(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Cr} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Cr} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Cr} .xterm-dim { color: ${nt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Cr}.${qs} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Cr}.${qs} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Cr}.${qs} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Cr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Cr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Cr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Cr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Cr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Bl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Bl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Bl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${Al}${s} { color: ${o.css}; }${this._terminalSelector} .${Al}${s}.xterm-dim { color: ${nt.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Ug}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${Al}257 { color: ${nt.opaque(e.background).css}; }${this._terminalSelector} .${Al}257.xterm-dim { color: ${nt.multiplyOpacity(nt.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ug}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(qs),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(qs),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let a=e[0]>t[0];l.appendChild(this._createSelectionElement(s,a?t[0]:e[0],a?e[0]:t[0],o-s+1))}else{let a=n===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(s,a,c));let d=o-s-1;if(l.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,d)),s!==o){let u=i===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,u))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,r,n=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${n*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,n=r.ybase+r.y,i=Math.min(r.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=t;a++){let c=a+r.ydisp,d=this._rowElements[a],u=r.lines.get(c);if(!d||!u)break;d.replaceChildren(...this._rowFactory.createRow(u,c,c===n,o,l,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${yu}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,n,i,s){r<0&&(e=0),n<0&&(t=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),n=Math.max(Math.min(n,o),0),i=Math.min(i,this._bufferService.cols);let l=this._bufferService.buffer,a=l.ybase+l.y,c=Math.min(l.x,i-1),d=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=r;p<=n;++p){let m=p+l.ydisp,_=this._rowElements[p],b=l.lines.get(m);if(!_||!b)break;_.replaceChildren(...this._rowFactory.createRow(b,m,m===a,u,f,c,d,this.dimensions.css.cell.width,this._widthCache,s?p===r?e:0:-1,s?(p===n?t:i)-1:-1))}}};dd=mt([ce(7,Vf),ce(8,wc),ce(9,ir),ce(10,nr),ce(11,Wi),ce(12,Tn),ce(13,Rs)],dd);var fd=class extends je{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ie),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new w3(this._optionsService))}catch{this._measureStrategy=this._register(new y3(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};fd=mt([ce(2,ir)],fd);var n1=class extends je{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},y3=class extends n1{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},w3=class extends n1{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},b3=class extends je{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new S3(this._window)),this._onDprChange=this._register(new ie),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ie),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Ft.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Se(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Se(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},S3=class extends je{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ks),this._onDprChange=this._register(new ie),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ot(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Se(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},k3=class extends je{constructor(){super(),this.linkProviders=[],this._register(ot(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Zf(e,t,r){let n=r.getBoundingClientRect(),i=e.getComputedStyle(r),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-n.left-s,t.clientY-n.top-o]}function C3(e,t,r,n,i,s,o,l,a){if(!s)return;let c=Zf(e,t,r);if(c)return c[0]=Math.ceil((c[0]+(a?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),n+(a?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var pd=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return C3(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let r=Zf(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};pd=mt([ce(0,Pn),ce(1,wc)],pd);var E3=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},i1={};AP(i1,{getSafariVersion:()=>T3,isChromeOS:()=>a1,isFirefox:()=>s1,isIpad:()=>P3,isIphone:()=>L3,isLegacyEdge:()=>N3,isLinux:()=>ep,isMac:()=>Va,isNode:()=>bc,isSafari:()=>o1,isWindows:()=>l1});var bc=typeof process<"u"&&"title"in process,ul=bc?"node":navigator.userAgent,hl=bc?"node":navigator.platform,s1=ul.includes("Firefox"),N3=ul.includes("Edge"),o1=/^((?!chrome|android).)*safari/i.test(ul);function T3(){if(!o1)return 0;let e=ul.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Va=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(hl),P3=hl==="iPad",L3=hl==="iPhone",l1=["Windows","Win16","Win32","WinCE"].includes(hl),ep=hl.indexOf("Linux")>=0,a1=/\bCrOS\b/.test(ul),c1=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,n=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),i=e.timeRemaining(),r*1.5>i){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=i}this.clear()}},R3=class extends c1{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},M3=class extends c1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ka=!bc&&"requestIdleCallback"in window?M3:R3,I3=class{constructor(){this._queue=new Ka}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},md=class extends je{constructor(e,t,r,n,i,s,o,l,a){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=i,this._coreBrowserService=l,this._renderer=this._register(new ks),this._pausedResizeTask=new I3,this._observerDisposable=this._register(new ks),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 ie),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ie),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ie),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ie),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new E3((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new D3(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ot(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=ot(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(n=this._renderer.value)==null||n.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};md=mt([ce(2,ir),ce(3,wc),ce(4,Wi),ce(5,cl),ce(6,nr),ce(7,Tn),ce(8,Rs)],md);var D3=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function j3(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return O3(i,s,e,t,r,n)+Sc(s,t,r,n)+z3(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",qo(Math.abs(i-e),Ko(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),a=B3(s>t?e:i,r)+(l-1)*r.cols+1+A3(s>t?i:e);return qo(a,Ko(o,n))}function A3(e,t){return e-1}function B3(e,t){return t.cols-e}function O3(e,t,r,n,i,s){return Sc(t,n,i,s).length===0?"":qo(h1(e,t,e,t-Oi(t,i),!1,i).length,Ko("D",s))}function Sc(e,t,r,n){let i=e-Oi(e,r),s=t-Oi(t,r),o=Math.abs(i-s)-$3(e,t,r);return qo(o,Ko(u1(e,t),n))}function z3(e,t,r,n,i,s){let o;Sc(t,n,i,s).length>0?o=n-Oi(n,i):o=t;let l=n,a=F3(e,t,r,n,i,s);return qo(h1(e,o,r,l,a==="C",i).length,Ko(a,s))}function $3(e,t,r){var o;let n=0,i=e-Oi(e,r),s=t-Oi(t,r);for(let l=0;l<Math.abs(i-s);l++){let a=u1(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&n++}return n}function Oi(e,t){let r=0,n=t.buffer.lines.get(e),i=n==null?void 0:n.isWrapped;for(;i&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),i=n==null?void 0:n.isWrapped;return r}function F3(e,t,r,n,i,s){let o;return Sc(r,n,i,s).length>0?o=n-Oi(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function u1(e,t){return e>t?"A":"B"}function h1(e,t,r,n,i,s){let o=e,l=t,a="";for(;(o!==r||l!==n)&&l>=0&&l<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(a+=s.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!i&&o<0&&(a+=s.buffer.translateBufferLineToString(l,!1,0,e+1),o=s.cols-1,e=o,l--);return a+s.buffer.translateBufferLineToString(l,!1,e,o)}function Ko(e,t){let r=t?"O":"[";return X.ESC+r+e}function qo(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var W3=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Vg(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var wu=50,H3=15,U3=50,V3=500,K3=" ",q3=new RegExp(K3,"g"),gd=class extends je{constructor(e,t,r,n,i,s,o,l,a){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=l,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new jr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ie),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ie),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ie),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ie),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new W3(this._bufferService),this._activeSelectionMode=0,this._register(ot(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=r.translateBufferLineToString(o,!0,i,s);n.push(l)}}else{let i=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=r.lines.get(s),l=r.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?n[n.length-1]+=l:n.push(l)}if(e[1]!==t[1]){let s=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?n[n.length-1]+=o:n.push(o)}}return n.map(i=>i.replace(q3," ")).join(l1?`\r
127
+ `:`
128
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),ep&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!t?!1:this._areCoordsInSelection(t,r,n)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,t],r,n)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let r=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=Vg(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Zf(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-wu),wu),t/=wu,t/Math.abs(t)+Math.round(t*(H3-1)))}shouldForceSelection(e){return Va?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(),U3)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Va&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let n=r.lines.get(this._model.selectionEnd[1]);n&&n.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<V3&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let n=j3(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){let i=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:i>1&&t!==n&&(r+=i-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(s,e[0]),a=l,c=e[0]-l,d=0,u=0,f=0,p=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;a<o.length&&o.charAt(a+1)===" ";)a++}else{let b=e[0],g=e[0];s.getWidth(b)===0&&(d++,b--),s.getWidth(g)===2&&(u++,g++);let v=s.getString(g).length;for(v>1&&(p+=v-1,a+=v-1);b>0&&l>0&&!this._isCharWordSeparator(s.loadCell(b-1,this._workCell));){s.loadCell(b-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,b--):y>1&&(f+=y-1,l-=y-1),l--,b--}for(;g<s.length&&a+1<o.length&&!this._isCharWordSeparator(s.loadCell(g+1,this._workCell));){s.loadCell(g+1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,g++):y>1&&(p+=y-1,a+=y-1),a++,g++}}a++;let m=l+c-d+f,_=Math.min(this._bufferService.cols,a-l+d+u-f-p);if(!(!t&&o.slice(l,a).trim()==="")){if(r&&m===0&&s.getCodePoint(0)!==32){let b=i.lines.get(e[1]-1);if(b&&s.isWrapped&&b.getCodePoint(this._bufferService.cols-1)!==32){let g=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(g){let v=this._bufferService.cols-g.start;m-=v,_+=v}}}if(n&&m+_===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let b=i.lines.get(e[1]+1);if(b!=null&&b.isWrapped&&b.getCodePoint(0)!==32){let g=this._getWordAt([0,e[1]+1],!1,!1,!0);g&&(_+=g.length)}}return{start:m,length:_}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Vg(r,this._bufferService.cols)}};gd=mt([ce(3,nr),ce(4,Wi),ce(5,Kf),ce(6,ir),ce(7,Pn),ce(8,Tn)],gd);var Kg=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},qg=class{constructor(){this._color=new Kg,this._css=new Kg}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},kt=Object.freeze((()=>{let e=[ct.toColor("#2e3436"),ct.toColor("#cc0000"),ct.toColor("#4e9a06"),ct.toColor("#c4a000"),ct.toColor("#3465a4"),ct.toColor("#75507b"),ct.toColor("#06989a"),ct.toColor("#d3d7cf"),ct.toColor("#555753"),ct.toColor("#ef2929"),ct.toColor("#8ae234"),ct.toColor("#fce94f"),ct.toColor("#729fcf"),ct.toColor("#ad7fa8"),ct.toColor("#34e2e2"),ct.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],i=t[r/6%6|0],s=t[r%6];e.push({css:wt.toCss(n,i,s),rgba:wt.toRgba(n,i,s)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:wt.toCss(n,n,n),rgba:wt.toRgba(n,n,n)})}return e})()),yi=ct.toColor("#ffffff"),oo=ct.toColor("#000000"),Yg=ct.toColor("#ffffff"),Xg=oo,Ys={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Y3=yi,_d=class extends je{constructor(e){super(),this._optionsService=e,this._contrastCache=new qg,this._halfContrastCache=new qg,this._onChangeColors=this._register(new ie),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:yi,background:oo,cursor:Yg,cursorAccent:Xg,selectionForeground:void 0,selectionBackgroundTransparent:Ys,selectionBackgroundOpaque:nt.blend(oo,Ys),selectionInactiveBackgroundTransparent:Ys,selectionInactiveBackgroundOpaque:nt.blend(oo,Ys),scrollbarSliderBackground:nt.opacity(yi,.2),scrollbarSliderHoverBackground:nt.opacity(yi,.4),scrollbarSliderActiveBackground:nt.opacity(yi,.5),overviewRulerBorder:yi,ansi:kt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Qe(e.foreground,yi),t.background=Qe(e.background,oo),t.cursor=nt.blend(t.background,Qe(e.cursor,Yg)),t.cursorAccent=nt.blend(t.background,Qe(e.cursorAccent,Xg)),t.selectionBackgroundTransparent=Qe(e.selectionBackground,Ys),t.selectionBackgroundOpaque=nt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Qe(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=nt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Qe(e.selectionForeground,Wg):void 0,t.selectionForeground===Wg&&(t.selectionForeground=void 0),nt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=nt.opacity(t.selectionBackgroundTransparent,.3)),nt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=nt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Qe(e.scrollbarSliderBackground,nt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Qe(e.scrollbarSliderHoverBackground,nt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Qe(e.scrollbarSliderActiveBackground,nt.opacity(t.foreground,.5)),t.overviewRulerBorder=Qe(e.overviewRulerBorder,Y3),t.ansi=kt.slice(),t.ansi[0]=Qe(e.black,kt[0]),t.ansi[1]=Qe(e.red,kt[1]),t.ansi[2]=Qe(e.green,kt[2]),t.ansi[3]=Qe(e.yellow,kt[3]),t.ansi[4]=Qe(e.blue,kt[4]),t.ansi[5]=Qe(e.magenta,kt[5]),t.ansi[6]=Qe(e.cyan,kt[6]),t.ansi[7]=Qe(e.white,kt[7]),t.ansi[8]=Qe(e.brightBlack,kt[8]),t.ansi[9]=Qe(e.brightRed,kt[9]),t.ansi[10]=Qe(e.brightGreen,kt[10]),t.ansi[11]=Qe(e.brightYellow,kt[11]),t.ansi[12]=Qe(e.brightBlue,kt[12]),t.ansi[13]=Qe(e.brightMagenta,kt[13]),t.ansi[14]=Qe(e.brightCyan,kt[14]),t.ansi[15]=Qe(e.brightWhite,kt[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<r;n++)t.ansi[n+16]=Qe(e.extendedAnsi[n],kt[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};_d=mt([ce(0,ir)],_d);function Qe(e,t){if(e!==void 0)try{return ct.toColor(e)}catch{}return t}var X3=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},G3=class{constructor(){this._services=new X3,this._services.set(Vf,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=HP(e).sort((s,o)=>s.index-o.index),n=[];for(let s of r){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);n.push(o)}let i=r.length>0?r[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},Q3={trace:0,debug:1,info:2,warn:3,error:4,off:5},J3="xterm.js: ",vd=class extends je{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Q3[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":J3)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};vd=mt([ce(0,ir)],vd);var Gg=class extends je{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ie),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ie),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ie),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));let n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ie=3,yt=Object.freeze(new al),Ol=0,bu=2,lo=class d1{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ie);let i=r||jr.fromCharData([0,Ry,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let r=this._data[t*Ie+0],n=r&2097151;return[this._data[t*Ie+1],r&2097152?this._combined[t]:n?$n(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*Ie+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Ie+0]=t|2097152|r[2]<<22):this._data[t*Ie+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Ie+0]>>22}hasWidth(t){return this._data[t*Ie+0]&12582912}getFg(t){return this._data[t*Ie+1]}getBg(t){return this._data[t*Ie+2]}hasContent(t){return this._data[t*Ie+0]&4194303}getCodePoint(t){let r=this._data[t*Ie+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Ie+0]&2097152}getString(t){let r=this._data[t*Ie+0];return r&2097152?this._combined[t]:r&2097151?$n(r&2097151):""}isProtected(t){return this._data[t*Ie+2]&536870912}loadCell(t,r){return Ol=t*Ie,r.content=this._data[Ol+0],r.fg=this._data[Ol+1],r.bg=this._data[Ol+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Ie+0]=r.content,this._data[t*Ie+1]=r.fg,this._data[t*Ie+2]=r.bg}setCellFromCodepoint(t,r,n,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Ie+0]=r|n<<22,this._data[t*Ie+1]=i.fg,this._data[t*Ie+2]=i.bg}addCodepointToCell(t,r,n){let i=this._data[t*Ie+0];i&2097152?this._combined[t]+=$n(r):i&2097151?(this._combined[t]=$n(i&2097151)+$n(r),i&=-2097152,i|=2097152):i=r|1<<22,n&&(i&=-12582913,i|=n<<22),this._data[t*Ie+0]=i}insertCells(t,r,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length-t){let i=new jr;for(let s=this.length-t-r-1;s>=0;--s)this.setCell(t+r+s,this.loadCell(t+s,i));for(let s=0;s<r;++s)this.setCell(t+s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,r,n){if(t%=this.length,r<this.length-t){let i=new jr;for(let s=0;s<this.length-t-r;++s)this.setCell(t+s,this.loadCell(t+r+s,i));for(let s=this.length-r;s<this.length;++s)this.setCell(s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,r,n,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.setCell(t++,n)}resize(t,r){if(t===this.length)return this._data.length*4*bu<this._data.buffer.byteLength;let n=t*Ie;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let i=new Uint32Array(n);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,r)}else{this._data=this._data.subarray(0,n);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let l=parseInt(i[o],10);l>=t&&delete this._combined[l]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,n*4*bu<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*bu<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new d1(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ie+0]&4194303)return t+(this._data[t*Ie+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ie+0]&4194303||this._data[t*Ie+2]&50331648)return t+(this._data[t*Ie+0]>>22);return 0}copyCellsFrom(t,r,n,i,s){let o=t._data;if(s)for(let a=i-1;a>=0;a--){for(let c=0;c<Ie;c++)this._data[(n+a)*Ie+c]=o[(r+a)*Ie+c];o[(r+a)*Ie+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}else for(let a=0;a<i;a++){for(let c=0;c<Ie;c++)this._data[(n+a)*Ie+c]=o[(r+a)*Ie+c];o[(r+a)*Ie+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}let l=Object.keys(t._combined);for(let a=0;a<l.length;a++){let c=parseInt(l[a],10);c>=r&&(this._combined[c-r+n]=t._combined[c])}}translateToString(t,r,n,i){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;r<n;){let o=this._data[r*Ie+0],l=o&2097151,a=o&2097152?this._combined[r]:l?$n(l):Kn;if(s+=a,i)for(let c=0;c<a.length;++c)i.push(r);r+=o>>22||1}return i&&i.push(r),s}};function Z3(e,t,r,n,i,s){let o=[];for(let l=0;l<e.length-1;l++){let a=l,c=e.get(++a);if(!c.isWrapped)continue;let d=[e.get(l)];for(;a<e.length&&c.isWrapped;)d.push(c),c=e.get(++a);if(!s&&n>=l&&n<a){l+=d.length-1;continue}let u=0,f=Yo(d,u,t),p=1,m=0;for(;p<d.length;){let b=Yo(d,p,t),g=b-m,v=r-f,y=Math.min(g,v);d[u].copyCellsFrom(d[p],m,f,y,!1),f+=y,f===r&&(u++,f=0),m+=y,m===b&&(p++,m=0),f===0&&u!==0&&d[u-1].getWidth(r-1)===2&&(d[u].copyCellsFrom(d[u-1],r-1,f++,1,!1),d[u-1].setCell(r-1,i))}d[u].replaceCells(f,r,i);let _=0;for(let b=d.length-1;b>0&&(b>u||d[b].getTrimmedLength()===0);b--)_++;_>0&&(o.push(l+d.length-_),o.push(_)),l+=d.length-1}return o}function e4(e,t){let r=[],n=0,i=t[n],s=0;for(let o=0;o<e.length;o++)if(i===o){let l=t[++n];e.onDeleteEmitter.fire({index:o-s,amount:l}),o+=l-1,s+=l,i=t[++n]}else r.push(o);return{layout:r,countRemoved:s}}function t4(e,t){let r=[];for(let n=0;n<t.length;n++)r.push(e.get(t[n]));for(let n=0;n<r.length;n++)e.set(n,r[n]);e.length=t.length}function r4(e,t,r){let n=[],i=e.map((a,c)=>Yo(e,c,t)).reduce((a,c)=>a+c),s=0,o=0,l=0;for(;l<i;){if(i-l<r){n.push(i-l);break}s+=r;let a=Yo(e,o,t);s>a&&(s-=a,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let d=c?r-1:r;n.push(d),l+=d}return n}function Yo(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,i=e[t+1].getWidth(0)===2;return n&&i?r-1:r}var f1=class p1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=p1._nextId++,this._onDispose=this.register(new ie),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Bi(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};f1._nextId=1;var n4=f1,Pt={},wi=Pt.B;Pt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Pt.A={"#":"£"};Pt.B=void 0;Pt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Pt.C=Pt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Pt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Pt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Pt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Pt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Pt.E=Pt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Pt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Pt.H=Pt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Pt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Qg=4294967295,Jg=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=yt.clone(),this.savedCharset=wi,this.markers=[],this._nullCell=jr.fromCharData([0,Ry,1,0]),this._whitespaceCell=jr.fromCharData([0,Kn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ka,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Gg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Wa),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Wa),this._whitespaceCell}getBlankLine(e,t){return new lo(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Qg?Qg:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=yt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Gg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(yt),n=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)n+=+this.lines.get(o).resize(e,r);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new lo(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new lo(e,r)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let o=this.lines.length-i;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s<this.lines.length;s++)n+=+this.lines.get(s).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=Z3(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(yt),r);if(n.length>0){let i=e4(this.lines,n);t4(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(yt),i=r;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new lo(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(yt),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let a=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),a.unshift(l);if(!r){let y=this.ybase+this.y;if(y>=o&&y<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),d=r4(a,this._cols,e),u=d.length-a.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+u):f=Math.max(0,this.lines.length-this.lines.maxLength+u);let p=[];for(let y=0;y<u;y++){let k=this.getBlankLine(yt,!0);p.push(k)}p.length>0&&(i.push({start:o+a.length+s,newLines:p}),s+=p.length),a.push(...p);let m=d.length-1,_=d[m];_===0&&(m--,_=d[m]);let b=a.length-u-1,g=c;for(;b>=0;){let y=Math.min(g,_);if(a[m]===void 0)break;if(a[m].copyCellsFrom(a[b],g-y,_-y,y,!0),_-=y,_===0&&(m--,_=d[m]),g-=y,g===0){b--;let k=Math.max(b,0);g=Yo(a,k,this._cols)}}for(let y=0;y<a.length;y++)d[y]<e&&a[y].setCell(d[y],n);let v=u-f;for(;v-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+t-1)}if(i.length>0){let o=[],l=[];for(let _=0;_<this.lines.length;_++)l.push(this.lines.get(_));let a=this.lines.length,c=a-1,d=0,u=i[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let f=0;for(let _=Math.min(this.lines.maxLength-1,a+s-1);_>=0;_--)if(u&&u.start>c+f){for(let b=u.newLines.length-1;b>=0;b--)this.lines.set(_--,u.newLines[b]);_++,o.push({index:c+1,amount:u.newLines.length}),f+=u.newLines.length,u=i[++d]}else this.lines.set(_,l[c--]);let p=0;for(let _=o.length-1;_>=0;_--)o[_].index+=p,this.lines.onInsertEmitter.fire(o[_]),p+=o[_].amount;let m=Math.max(0,a+s-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,r=0,n){let i=this.lines.get(e);return i?i.translateToString(t,r,n):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new n4(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},i4=class extends je{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ie),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 Jg(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Jg(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},m1=2,g1=1,xd=class extends je{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ie),this.onResize=this._onResize.event,this._onScroll=this._register(new ie),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,m1),this.rows=Math.max(e.rawOptions.rows||0,g1),this.buffers=this._register(new i4(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let i=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(r.scrollTop===0){let o=r.lines.isFull;s===r.lines.length-1?o?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(s+1,0,n.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=s-i+1;r.lines.shiftElements(i+1,o-1,-1),r.lines.set(s,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};xd=mt([ce(0,ir)],xd);var qi={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Va,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},s4=["normal","bold","100","200","300","400","500","600","700","800","900"],o4=class extends je{constructor(e){super(),this._onOptionChange=this._register(new ie),this.onOptionChange=this._onOptionChange.event;let t={...qi};for(let r in e)if(r in t)try{let n=e[r];t[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ot(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in qi))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in qi))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=qi[e]),!l4(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=qi[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=s4.includes(t)?t:qi[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function l4(e){return e==="block"||e==="underline"||e==="bar"}function ao(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let n in e)r[n]=t<=1?e[n]:e[n]&&ao(e[n],t-1);return r}var Zg=Object.freeze({insertMode:!1}),e_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),yd=class extends je{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ie),this.onData=this._onData.event,this._onUserInput=this._register(new ie),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ie),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ie),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ao(Zg),this.decPrivateModes=ao(e_)}reset(){this.modes=ao(Zg),this.decPrivateModes=ao(e_)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};yd=mt([ce(0,nr),ce(1,Ay),ce(2,ir)],yd);var t_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Su(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var ku=String.fromCharCode,r_={DEFAULT:e=>{let t=[Su(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${ku(t[0])}${ku(t[1])}${ku(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Su(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Su(e,!0)};${e.x};${e.y}${t}`}},wd=class extends je{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ie),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(t_))this.addProtocol(n,t_[n]);for(let n of Object.keys(r_))this.addEncoding(n,r_[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let n=t/r,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=n+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};wd=mt([ce(0,nr),ce(1,Wi),ce(2,ir)],wd);var Cu=[[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]],a4=[[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]],Ct;function c4(e,t){let r=0,n=t.length-1,i;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(i=r+n>>1,e>t[i][1])r=i+1;else if(e<t[i][0])n=i-1;else return!0;return!1}var u4=class{constructor(){if(this.version="6",!Ct){Ct=new Uint8Array(65536),Ct.fill(1),Ct[0]=0,Ct.fill(0,1,32),Ct.fill(0,127,160),Ct.fill(2,4352,4448),Ct[9001]=2,Ct[9002]=2,Ct.fill(2,11904,42192),Ct[12351]=1,Ct.fill(2,44032,55204),Ct.fill(2,63744,64256),Ct.fill(2,65040,65050),Ct.fill(2,65072,65136),Ct.fill(2,65280,65377),Ct.fill(2,65504,65511);for(let e=0;e<Cu.length;++e)Ct.fill(0,Cu[e][0],Cu[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ct[e]:c4(e,a4)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let i=Ei.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return Ei.createPropertyValue(0,r,n)}},Ei=class la{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ie,this.onChange=this._onChange.event;let t=new u4;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return r+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:r+=this.wcwidth(c)}let l=this.charProperties(o,n),a=la.extractWidth(l);la.extractShouldJoin(l)&&(a-=la.extractWidth(n)),r+=a,n=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},h4=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function n_(e){var n;let t=(n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:n.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var Xs=2147483647,d4=256,_1=class bd{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>d4)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new bd;if(!t.length)return r;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let i=t[n];if(Array.isArray(i))for(let s=0;s<i.length;++s)r.addSubParam(i[s]);else r.addParam(i)}return r}clone(){let t=new bd(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let n=this._subParamsIdx[r]>>8,i=this._subParamsIdx[r]&255;i-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Xs?Xs:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Xs?Xs:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-r>0?this._subParams.subarray(r,n):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let n=this._subParamsIdx[r]>>8,i=this._subParamsIdx[r]&255;i-n>0&&(t[r]=this._subParams.slice(n,i))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,i=n[r-1];n[r-1]=~i?Math.min(i*10+t,Xs):t}},Gs=[],f4=class{constructor(){this._state=0,this._active=Gs,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gs}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Gs,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Gs,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",yc(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&r===!1){for(;n>=0&&(r=this._active[n].end(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=Gs,this._id=-1,this._state=0}}},mr=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=yc(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},Qs=[],p4=class{constructor(){this._handlers=Object.create(null),this._active=Qs,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Qs}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Qs,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Qs,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",yc(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&r===!1){for(;n>=0&&(r=this._active[n].unhook(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=Qs,this._ident=0}},co=new _1;co.addParam(0);var i_=class{constructor(e){this._handler=e,this._data="",this._params=co,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():co,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=yc(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=co,this._data="",this._hitLimit=!1,r));return this._params=co,this._data="",this._hitLimit=!1,t}},m4=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,n){this.table[t<<8|e]=r<<4|n}addMany(e,t,r,n){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=r<<4|n}},Tr=160,g4=function(){let e=new m4(4095),t=Array.apply(null,Array(256)).map((l,a)=>a),r=(l,a)=>t.slice(l,a),n=r(32,127),i=r(0,24);i.push(25),i.push.apply(i,r(28,32));let s=r(0,14),o;e.setDefault(1,0),e.addMany(n,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Tr,0,2,0),e.add(Tr,8,5,8),e.add(Tr,6,0,6),e.add(Tr,11,0,11),e.add(Tr,13,13,13),e}(),_4=class extends je{constructor(e=g4){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ot(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new f4),this._dcsParser=this._register(new p4),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,n,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=i}parse(e,t,r){let n=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](this._params),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],o=this._oscParser.end(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=s;l<t;++l){switch(n=e[l],i=this._transitions.table[this.currentState<<8|(n<160?n:Tr)],i>>4){case 2:for(let f=l+1;;++f){if(f>=t||(n=e[f])<32||n>126&&n<Tr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Tr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Tr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Tr){this._printHandler(e,l,f),l=f-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|n],c=a?a.length-1:-1;for(;c>=0&&(o=a[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,a,c,i,l),o;c<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++l<t&&(n=e[l])>47&&n<60);l--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let d=this._escHandlers[this._collect<<8|n],u=d?d.length-1:-1;for(;u>=0&&(o=d[u](),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(4,d,u,i,l),o;u<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let f=l+1;;++f)if(f>=t||(n=e[f])===24||n===26||n===27||n>127&&n<Tr){this._dcsParser.put(e,l,f),l=f-1;break}break;case 14:if(o=this._dcsParser.unhook(n!==24&&n!==26),o)return this._preserveStack(6,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=l+1;;f++)if(f>=t||(n=e[f])<32||n>127&&n<Tr){this._oscParser.put(e,l,f),l=f-1;break}break;case 6:if(o=this._oscParser.end(n!==24&&n!==26),o)return this._preserveStack(5,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},v4=/^([\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})$/,x4=/^[\da-f]+$/;function s_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=v4.exec(t);if(r){let n=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/n*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/n*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),x4.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,n=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(r*i,r*i+r),16);n[i]=r===1?s<<4:r===2?s:r===3?s>>4:s>>8}return n}}function Eu(e,t){let r=e.toString(16),n=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function y4(e,t=16){let[r,n,i]=e;return`rgb:${Eu(r,t)}/${Eu(n,t)}/${Eu(i,t)}`}var w4={"(":0,")":1,"*":2,"+":3,"-":1,".":2},jn=131072,o_=10;function l_(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var a_=5e3,c_=0,b4=class extends je{constructor(e,t,r,n,i,s,o,l,a=new _4){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=l,this._parser=a,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new FP,this._utf8Decoder=new WP,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=yt.clone(),this._eraseAttrDataInternal=yt.clone(),this._onRequestBell=this._register(new ie),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ie),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ie),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ie),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ie),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ie),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ie),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ie),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ie),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ie),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ie),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ie),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ie),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 Sd(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:d.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,d,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:d,data:u})}),this._parser.setDcsHandlerFallback((c,d,u)=>{d==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:d,payload:u})}),this._parser.setPrintHandler((c,d,u)=>this.print(c,d,u)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(X.BEL,()=>this.bell()),this._parser.setExecuteHandler(X.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(X.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(X.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(X.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(X.BS,()=>this.backspace()),this._parser.setExecuteHandler(X.HT,()=>this.tab()),this._parser.setExecuteHandler(X.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(X.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(sa.IND,()=>this.index()),this._parser.setExecuteHandler(sa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(sa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new mr(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new mr(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new mr(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new mr(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new mr(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new mr(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new mr(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new mr(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new mr(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new mr(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new mr(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new mr(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in Pt)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new i_((c,d)=>this.requestStatusString(c,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),a_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${a_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>jn&&(s=this._parseStack.position+jn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<jn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,jn))),o||this._dirtyRowTracker.clearRange(),e.length>jn)for(let c=s;c<e.length;c+=jn){let d=c+jn<e.length?c+jn:e.length,u=typeof e=="string"?this._stringDecoder.decode(e.substring(c,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,d),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,u))return this._preserveStack(n,i,u,c),this._logSlowResolvingAsync(r),r}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,c))return this._preserveStack(n,i,c,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),a=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);a<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(a,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,r){let n,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,a=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,d=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let p=t;p<r;++p){if(n=e[p],n<127&&s){let g=s[String.fromCharCode(n)];g&&(n=g.charCodeAt(0))}let m=this._unicodeService.charProperties(n,f);i=Ei.extractWidth(m);let _=Ei.extractShouldJoin(m),b=_?Ei.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire($n(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-b>l){if(a){let g=u,v=this._activeBuffer.x-b;for(this._activeBuffer.x=b,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),b>0&&u instanceof lo&&u.copyCellsFrom(g,v,0,b,!1);v<l;)g.setCellFromCodepoint(v++,0,1,d)}else if(this._activeBuffer.x=l-1,i===2)continue}if(_&&this._activeBuffer.x){let g=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-g,n,i);for(let v=i-b;--v>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(u.insertCells(this._activeBuffer.x,i-b,this._activeBuffer.getNullCell(d)),u.getWidth(l-1)===2&&u.setCellFromCodepoint(l-1,0,1,d)),u.setCellFromCodepoint(this._activeBuffer.x++,n,i,d),i>0)for(;--i;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&r-t>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>l_(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new i_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new mr(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,n=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),i),n&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&n.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(yt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,n=Ei.extractWidth(t),i=this._activeBuffer.x-n,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*r),l=0;for(let c=0;c<s.length;){let d=s.codePointAt(c)||0;o[l++]=d,c+=d>65535?2:1}let a=l;for(let c=1;c<r;++c)o.copyWithin(a,0,l),a+=l;return this.print(o,0,a),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(X.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(X.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(X.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(X.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(X.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,wi),this._charsetService.setgCharset(1,wi),this._charsetService.setgCharset(2,wi),this._charsetService.setgCharset(3,wi);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(_=>(_[_.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",_[_.SET=1]="SET",_[_.RESET=2]="RESET",_[_.PERMANENTLY_SET=3]="PERMANENTLY_SET",_[_.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:l,cols:a}=this._bufferService,{active:c,alt:d}=l,u=this._optionsService.rawOptions,f=(_,b)=>(o.triggerDataEvent(`${X.ESC}[${t?"":"?"}${_};${b}$y`),!0),p=_=>_?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(u.convertEol)):f(m,0):m===1?f(m,p(n.applicationCursorKeys)):m===3?f(m,u.windowOptions.setWinLines?a===80?2:a===132?1:0:0):m===6?f(m,p(n.origin)):m===7?f(m,p(n.wraparound)):m===8?f(m,3):m===9?f(m,p(i==="X10")):m===12?f(m,p(u.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(n.reverseWraparound)):m===66?f(m,p(n.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i==="VT200")):m===1002?f(m,p(i==="DRAG")):m===1003?f(m,p(i==="ANY")):m===1004?f(m,p(n.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(s==="SGR")):m===1015?f(m,4):m===1016?f(m,p(s==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(c===d)):m===2004?f(m,p(n.bracketedPasteMode)):m===2026?f(m,p(n.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,r,n,i){return t===2?(e|=50331648,e&=-16777216,e|=al.fromColorRGB([r,n,i])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],i=0,s=0;do{if(n[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),l=0;do n[1]===5&&(i=1),n[s+l+1+i]=o[l];while(++l<o.length&&l+s+1+i<n.length);break}if(n[1]===5&&s+i>=2||n[1]===2&&s+i>=5)break;n[1]&&(i=1)}while(++s+t<e.length&&s+i<n.length);for(let o=2;o<n.length;++o)n[o]===-1&&(n[o]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=yt.fg,e.bg=yt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,n=this._curAttrData;for(let i=0;i<t;i++)r=e.params[i],r>=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=yt.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=yt.bg&16777215):r===38||r===48||r===58?i+=this._extractColor(e,i,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):r===100?(n.fg&=-67108864,n.fg|=yt.fg&16777215,n.bg&=-67108864,n.bg|=yt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${X.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${X.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${X.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=yt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!l_(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${X.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>o_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>o_&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),i=r.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(u_(s))if(i==="?")t.push({type:0,index:s});else{let o=s_(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,i=r.findIndex(s=>s.startsWith("id="));return i!==-1&&(n=r[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let n=0;n<r.length&&!(t>=this._specialColors.length);++n,++t)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=s_(r[n]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let n=0;n<r.length;++n)if(/^\d+$/.exec(r[n])){let i=parseInt(r[n]);u_(i)&&t.push({type:2,index:i})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,wi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(w4[e[0]],Pt[e[1]]||wi),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=yt.clone(),this._eraseAttrDataInternal=yt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new jr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=o=>(this._coreService.triggerDataEvent(`${X.ESC}${o}${X.ESC}\\`),!0),n=this._bufferService.buffer,i=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Sd=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(c_=e,e=t,t=c_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Sd=mt([ce(0,nr)],Sd);function u_(e){return 0<=e&&e<256}var S4=5e7,h_=12,k4=50,C4=class extends je{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ie),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>S4)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],i=this._action(n,t);if(i){let o=l=>performance.now()-r>=h_?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);i.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=h_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>k4&&(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()}},kd=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),a={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(a,l)),this._dataByLinkId.set(a.id,a),a.id}let r=e,n=this._getEntryIdKey(r),i=this._entriesWithId.get(n);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);r.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(r,n))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};kd=mt([ce(0,nr)],kd);var d_=!1,E4=class extends je{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ks),this._onBinary=this._register(new ie),this.onBinary=this._onBinary.event,this._onData=this._register(new ie),this.onData=this._onData.event,this._onLineFeed=this._register(new ie),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ie),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ie),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ie),this._instantiationService=new G3,this.optionsService=this._register(new o4(e)),this._instantiationService.setService(ir,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(xd)),this._instantiationService.setService(nr,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(vd)),this._instantiationService.setService(Ay,this._logService),this.coreService=this._register(this._instantiationService.createInstance(yd)),this._instantiationService.setService(Wi,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(wd)),this._instantiationService.setService(jy,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ei)),this._instantiationService.setService(KP,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h4),this._instantiationService.setService(VP,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(kd),this._instantiationService.setService(By,this._oscLinkService),this._inputHandler=this._register(new b4(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ft.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ft.forward(this._bufferService.onResize,this._onResize)),this._register(Ft.forward(this.coreService.onData,this._onData)),this._register(Ft.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new C4((t,r)=>this._inputHandler.parse(t,r))),this._register(Ft.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ie),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!d_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),d_=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,m1),t=Math.max(t,g1),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(n_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(n_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ot(()=>{for(let t of e)t.dispose()})}}},N4={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function T4(e,t,r,n){var o;let i={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=X.ESC+"OA":i.key=X.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=X.ESC+"OD":i.key=X.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=X.ESC+"OC":i.key=X.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=X.ESC+"OB":i.key=X.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":X.DEL,e.altKey&&(i.key=X.ESC+i.key);break;case 9:if(e.shiftKey){i.key=X.ESC+"[Z";break}i.key=X.HT,i.cancel=!0;break;case 13:i.key=e.altKey?X.ESC+X.CR:X.CR,i.cancel=!0;break;case 27:i.key=X.ESC,e.altKey&&(i.key=X.ESC+X.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=X.ESC+"[1;"+(s+1)+"D":t?i.key=X.ESC+"OD":i.key=X.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=X.ESC+"[1;"+(s+1)+"C":t?i.key=X.ESC+"OC":i.key=X.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=X.ESC+"[1;"+(s+1)+"A":t?i.key=X.ESC+"OA":i.key=X.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=X.ESC+"[1;"+(s+1)+"B":t?i.key=X.ESC+"OB":i.key=X.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=X.ESC+"[2~");break;case 46:s?i.key=X.ESC+"[3;"+(s+1)+"~":i.key=X.ESC+"[3~";break;case 36:s?i.key=X.ESC+"[1;"+(s+1)+"H":t?i.key=X.ESC+"OH":i.key=X.ESC+"[H";break;case 35:s?i.key=X.ESC+"[1;"+(s+1)+"F":t?i.key=X.ESC+"OF":i.key=X.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=X.ESC+"[5;"+(s+1)+"~":i.key=X.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=X.ESC+"[6;"+(s+1)+"~":i.key=X.ESC+"[6~";break;case 112:s?i.key=X.ESC+"[1;"+(s+1)+"P":i.key=X.ESC+"OP";break;case 113:s?i.key=X.ESC+"[1;"+(s+1)+"Q":i.key=X.ESC+"OQ";break;case 114:s?i.key=X.ESC+"[1;"+(s+1)+"R":i.key=X.ESC+"OR";break;case 115:s?i.key=X.ESC+"[1;"+(s+1)+"S":i.key=X.ESC+"OS";break;case 116:s?i.key=X.ESC+"[15;"+(s+1)+"~":i.key=X.ESC+"[15~";break;case 117:s?i.key=X.ESC+"[17;"+(s+1)+"~":i.key=X.ESC+"[17~";break;case 118:s?i.key=X.ESC+"[18;"+(s+1)+"~":i.key=X.ESC+"[18~";break;case 119:s?i.key=X.ESC+"[19;"+(s+1)+"~":i.key=X.ESC+"[19~";break;case 120:s?i.key=X.ESC+"[20;"+(s+1)+"~":i.key=X.ESC+"[20~";break;case 121:s?i.key=X.ESC+"[21;"+(s+1)+"~":i.key=X.ESC+"[21~";break;case 122:s?i.key=X.ESC+"[23;"+(s+1)+"~":i.key=X.ESC+"[23~";break;case 123:s?i.key=X.ESC+"[24;"+(s+1)+"~":i.key=X.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=X.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=X.DEL:e.keyCode===219?i.key=X.ESC:e.keyCode===220?i.key=X.FS:e.keyCode===221&&(i.key=X.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let l=(o=N4[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=X.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(a);e.shiftKey&&(c=c.toUpperCase()),i.key=X.ESC+c}else if(e.keyCode===32)i.key=X.ESC+(e.ctrlKey?X.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),i.key=X.ESC+a,i.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=X.US),e.key==="@"&&(i.key=X.NUL));break}return i}var _t=0,P4=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ka,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ka,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,r=0,n=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<n.length;i++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(n[i]=e[t],t++):n[i]=this._array[r++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(_t=this._search(t),_t===-1)||this._getKey(this._array[_t])!==t)return!1;do if(this._array[_t]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(_t),!0;while(++_t<this._array.length&&this._getKey(this._array[_t])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,r=new Array(this._array.length-e.length),n=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:r[n++]=this._array[i];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(_t=this._search(e),!(_t<0||_t>=this._array.length)&&this._getKey(this._array[_t])===e))do yield this._array[_t];while(++_t<this._array.length&&this._getKey(this._array[_t])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(_t=this._search(e),!(_t<0||_t>=this._array.length)&&this._getKey(this._array[_t])===e))do t(this._array[_t]);while(++_t<this._array.length&&this._getKey(this._array[_t])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let n=t+r>>1,i=this._getKey(this._array[n]);if(i>e)r=n-1;else if(i<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},Nu=0,f_=0,L4=class extends je{constructor(){super(),this._decorations=new P4(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ie),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ie),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ot(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new R4(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let n=0,i=0;for(let s of this._decorations.getKeyIterator(t))n=s.options.x??0,i=n+(s.options.width??1),e>=n&&e<i&&(!r||(s.options.layer??"bottom")===r)&&(yield s)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,i=>{Nu=i.options.x??0,f_=Nu+(i.options.width??1),e>=Nu&&e<f_&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},R4=class extends ti{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ie),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ie),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ct.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ct.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},M4=1e3,I4=class{constructor(e,t=M4){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=n-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},p_=20,qa=class extends je{constructor(e,t,r,n){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new I4(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(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
129
+ `))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Se(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ot(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<p_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
130
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===p_+1&&(this._liveRegion.textContent+=Uh.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,n=r.lines.length.toString();for(let i=e;i<=t;i++){let s=r.lines.get(r.ydisp+i),o=[],l=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",a=(r.ydisp+i+1).toString(),c=this._rowElements[i];c&&(l.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=l,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",a),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],i=r.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==n)return;let o,l;if(t===0?(o=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let a=this._createAccessibilityTreeNode();this._rowElements.unshift(a),this._rowContainer.insertAdjacentElement("afterbegin",a)}else{let a=this._createAccessibilityTreeNode();this._rowElements.push(a),this._rowContainer.appendChild(a)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:((l=n.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let i=({node:a,offset:c})=>{let d=a instanceof Text?a.parentNode:a,u=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(d);if(!f)return console.warn("columns is null. Race condition?"),null;let p=c<f.length?f[c]:f.slice(-1)[0]+1;return p>=this._terminal.cols&&(++u,p=0),{row:u,column:p}},s=i(t),o=i(r);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,r=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};qa=mt([ce(1,Vf),ce(2,Tn),ce(3,Pn)],qa);var Cd=class extends je{constructor(e,t,r,n,i){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ie),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ie),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ot(()=>{var s;Bi(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Se(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Se(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Se(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Se(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let n=0;n<r.length;n++){let i=r[n];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var n,i;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):o.provideLinks(e.y,l=>{var c,d;if(this._isMouseOut)return;let a=l==null?void 0:l.map(u=>({link:u}));(c=this._activeProviderReplies)==null||c.set(s,a),r=this._checkLinkProviderResult(s,e,r),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let n=0;n<t.size;n++){let i=t.get(n);if(i)for(let s=0;s<i.length;s++){let o=i[s],l=o.link.range.start.y<e?0:o.link.range.start.x,a=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=l;c<=a;c++){if(r.has(c)){i.splice(s--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,t,r){var s;if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&n){let o=n.find(l=>this._linkAtPosition(l.link,t));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(a=>this._linkAtPosition(a.link,t));if(l){r=!0,this._handleNewLink(l);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&D4(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Bi(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.pointerCursor},set:r=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline},set:r=>{var n,i,s;(n=this._currentLink)!=null&&n.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(n,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,r){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,n=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,r){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return r<=i&&i<=n}_positionFromMouseEvent(e,t,r){let n=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,n,i){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:i}}};Cd=mt([ce(1,Kf),ce(2,Pn),ce(3,nr),ce(4,zy)],Cd);function D4(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var j4=class extends E4{constructor(e={}){super(e),this._linkifier=this._register(new ks),this.browser=i1,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ks),this._onCursorMove=this._register(new ie),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ie),this.onKey=this._onKey.event,this._onRender=this._register(new ie),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ie),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ie),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ie),this.onBell=this._onBell.event,this._onFocus=this._register(new ie),this._onBlur=this._register(new ie),this._onA11yCharEmitter=this._register(new ie),this._onA11yTabEmitter=this._register(new ie),this._onWillOpen=this._register(new ie),this._setup(),this._decorationService=this._instantiationService.createInstance(L4),this._instantiationService.setService(cl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(k3),this._instantiationService.setService(zy,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Kh)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Ft.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ft.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ft.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ft.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ot(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,n="";switch(t.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+t.index}switch(t.type){case 0:let i=nt.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${X.ESC}]${n};${y4(i)}${r1.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=wt.toColor(...t.color));else{let s=r;this._themeService.modifyColors(o=>o[s]=wt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(qa,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,i=t.getWidth(r),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Se(this.element,"copy",t=>{this.hasSelection()&&zP(t,this._selectionService)}));let e=t=>$P(t,this.textarea,this.coreService,this.optionsService);this._register(Se(this.textarea,"paste",e)),this._register(Se(this.element,"paste",e)),s1?this._register(Se(this.element,"mousedown",t=>{t.button===2&&kg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Se(this.element,"contextmenu",t=>{kg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ep&&this._register(Se(this.element,"auxclick",t=>{t.button===1&&Ly(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Se(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Se(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Se(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Se(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Se(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Se(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Se(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((i=this.element)==null?void 0:i.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Se(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Hh.get()),a1||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(b3,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Tn,this._coreBrowserService),this._register(Se(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(Se(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(fd,this._document,this._helperContainer),this._instantiationService.setService(wc,this._charSizeService),this._themeService=this._instantiationService.createInstance(_d),this._instantiationService.setService(Rs,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ua),this._instantiationService.setService(Oy,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(md,this.rows,this.screenElement)),this._instantiationService.setService(Pn,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ud,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(pd),this._instantiationService.setService(Kf,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Cd,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(ad,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(gd,this.element,this.screenElement,n)),this._instantiationService.setService(YP,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(Ft.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(cd,this.screenElement)),this._register(Se(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),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(qa,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ha,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ha,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(dd,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(s){var c,d,u,f,p;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let l,a;switch(s.overrideType||s.type){case"mousemove":a=32,s.buttons===void 0?(l=3,s.button!==void 0&&(l=s.button<3?s.button:3)):l=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":a=0,l=s.button<3?s.button:3;break;case"mousedown":a=1,l=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let m=s.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(s,(f=(u=(d=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:d.device)==null?void 0:u.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;a=m<0?0:1,l=4;break;default:return!1}return a===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:a,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(r(s),s.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(s)),wheel:s=>(r(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&r(s)},mousemove:s=>{s.buttons||r(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),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()),s&8?n.mousemove||(t.addEventListener("mousemove",i.mousemove),n.mousemove=i.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),s&16?n.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),n.wheel=i.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),s&2?n.mouseup||(n.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),s&4?n.mousedrag||(n.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Se(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return r(s),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(s)})),this._register(Se(t,"wheel",s=>{var o,l,a,c,d;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(a=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:a.cell)==null?void 0:c.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(s,!0);let u=X.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Py(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=T4(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===X.ETX||r.key===X.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(A4(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(yt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(X.ESC+"[I"):this.coreService.triggerDataEvent(X.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${X.ESC}[4;${r};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.ESC}[6;${i};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function A4(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var B4=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},O4=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new jr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},m_=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new O4(t)}getNullCell(){return new jr}},z4=class extends je{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ie),this.onBufferChange=this._onBufferChange.event,this._normal=new m_(this._core.buffers.normal,"normal"),this._alternate=new m_(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)}},$4=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,n)=>t(r,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},F4=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},W4=["cols","rows"],Qr=0,H4=class extends je{constructor(e){super(),this._core=this._register(new j4(e)),this._addonManager=this._register(new B4),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],r=(n,i)=>{this._checkReadonlyOptions(n),this._core.options[n]=i};for(let n in this._core.options){let i={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,i)}}_checkReadonlyOptions(e){if(W4.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new $4(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new F4(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 z4(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
131
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Hh.get()},set promptLabel(e){Hh.set(e)},get tooMuchOutput(){return Uh.get()},set tooMuchOutput(e){Uh.set(e)}}}_verifyIntegers(...e){for(Qr of e)if(Qr===1/0||isNaN(Qr)||Qr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Qr of e)if(Qr&&(Qr===1/0||isNaN(Qr)||Qr%1!==0||Qr<0))throw new Error("This API only accepts positive integers")}};/**
132
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
133
+ * @license MIT
134
+ *
135
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
136
+ * @license MIT
137
+ *
138
+ * Originally forked from (with the author's permission):
139
+ * Fabrice Bellard's javascript vt100 for jslinux:
140
+ * http://bellard.org/jslinux/
141
+ * Copyright (c) 2011 Fabrice Bellard
142
+ */var U4=2,V4=1,K4=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var u;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((u=this._terminal.options.overviewRuler)==null?void 0:u.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},l=o.top+o.bottom,a=o.right+o.left,c=n-l,d=i-a-t;return{cols:Math.max(U4,Math.floor(d/e.css.cell.width)),rows:Math.max(V4,Math.floor(c/e.css.cell.height))}}};/**
143
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
144
+ * @license MIT
145
+ *
146
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
147
+ * @license MIT
148
+ *
149
+ * Originally forked from (with the author's permission):
150
+ * Fabrice Bellard's javascript vt100 for jslinux:
151
+ * http://bellard.org/jslinux/
152
+ * Copyright (c) 2011 Fabrice Bellard
153
+ */var q4=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let r=X4.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,n)=>{if(this._options.hover){let{range:i}=t;this._options.hover(r,n,i)}},t))}};function Y4(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var X4=class aa{static computeLink(t,r,n,i){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=aa._getWindowedLineStrings(t-1,n),a=o.join(""),c,d=[];for(;c=s.exec(a);){let u=c[0];if(!Y4(u))continue;let[f,p]=aa._mapStrIdx(n,l,0,c.index),[m,_]=aa._mapStrIdx(n,f,p,u.length);if(f===-1||p===-1||m===-1||_===-1)continue;let b={start:{x:p+1,y:f+1},end:{x:_,y:m+1}};d.push({range:b,text:u,activate:i})}return d}static _getWindowedLineStrings(t,r){let n,i=t,s=t,o=0,l="",a=[];if(n=r.buffer.active.getLine(t)){let c=n.translateToString(!0);if(n.isWrapped&&c[0]!==" "){for(o=0;(n=r.buffer.active.getLine(--i))&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),!(!n.isWrapped||l.indexOf(" ")!==-1)););a.reverse()}for(a.push(c),o=0;(n=r.buffer.active.getLine(++s))&&n.isWrapped&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),l.indexOf(" ")===-1););}return[a,i]}static _mapStrIdx(t,r,n,i){let s=t.buffer.active,o=s.getNullCell(),l=n;for(;i;){let a=s.getLine(r);if(!a)return[-1,-1];for(let c=l;c<a.length;++c){a.getCell(c,o);let d=o.getChars();if(o.getWidth()&&(i-=d.length||1,c===a.length-1&&d==="")){let u=s.getLine(r+1);u&&u.isWrapped&&(u.getCell(0,o),o.getWidth()===2&&(i+=1))}if(i<0)return[r,c]}r++,l=0}return[r,l]}},G4=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Q4(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var J4=class{constructor(e=Q4,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||G4;this._linkProvider=this._terminal.registerLinkProvider(new q4(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const g_={background:"#0f1117",foreground:"#cdd6f4",cursor:"#f38ba8",cursorAccent:"#0f1117",selectionBackground:"rgba(166, 227, 161, 0.3)",selectionForeground:"#cdd6f4",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#cba6f7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#cba6f7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"},v1=x.forwardRef(({onInput:e,onResize:t,fontSize:r=13},n)=>{const i=x.useRef(null),s=x.useRef(null),o=x.useRef(null),[l,a]=x.useState(!1);return x.useImperativeHandle(n,()=>({write:c=>{var d;(d=s.current)==null||d.write(c)},clear:()=>{var c;(c=s.current)==null||c.clear()},fit:()=>{var c;try{(c=o.current)==null||c.fit(),s.current&&(t==null||t(s.current.cols,s.current.rows))}catch{}},bumpResize:()=>{var c;try{(c=o.current)==null||c.fit();const d=s.current;if(!d)return;const u=d.cols,f=d.rows;t==null||t(u+5,f),setTimeout(()=>{t==null||t(u,f)},100)}catch{}}})),x.useEffect(()=>{if(!i.current)return;const c=new H4({cursorBlink:!0,cursorStyle:"bar",fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:g_,allowTransparency:!0,scrollback:5e3,convertEol:!1}),d=new K4,u=new J4;c.loadAddon(d),c.loadAddon(u),c.open(i.current),requestAnimationFrame(()=>{d.fit(),t==null||t(c.cols,c.rows),a(!0)});const f=c.onData(m=>{e(m)}),p=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{d.fit(),t==null||t(c.cols,c.rows)}catch{}})});return p.observe(i.current),s.current=c,o.current=d,()=>{f.dispose(),p.disconnect(),c.dispose(),s.current=null,o.current=null}},[r]),h.jsx("div",{ref:i,className:"w-full h-full rounded-lg overflow-hidden transition-opacity duration-200",style:{background:g_.background,opacity:l?1:0}})});v1.displayName="CliTerminal";function __({label:e,value:t,sub:r,icon:n}){return h.jsxs("div",{className:"px-4 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[h.jsx("span",{className:"text-base flex items-center",children:n}),h.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide font-semibold",children:e})]}),h.jsx("div",{className:"text-[22px] font-bold text-text-primary tracking-tight",children:t}),r&&h.jsx("div",{className:"text-[11px] text-text-muted mt-0.5",children:r})]})}function v_({value:e,max:t,label:r,color:n="#8b5cf6",detail:i,compact:s=!1}){const o=t>0?Math.min(Math.round(e/t*100),100):0,l=o>85?"#ef4444":o>60?"#f59e0b":n;return s?h.jsxs("div",{className:"flex-1",children:[h.jsxs("div",{className:"flex justify-between mb-0.5",children:[h.jsx("span",{className:"text-[9px] text-text-muted uppercase tracking-wide font-semibold",children:r}),h.jsxs("span",{className:"text-[10px] text-text-secondary font-semibold",children:[o,"%"]})]}),h.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:h.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${o}%`,background:l}})})]}):h.jsxs("div",{className:"flex-1",children:[h.jsxs("div",{className:"flex justify-between mb-1.5",children:[h.jsx("span",{className:"text-[11px] text-text-secondary font-medium",children:r}),h.jsxs("span",{className:"text-[13px] text-text-primary font-bold",children:[o,"%"]})]}),h.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:h.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${o}%`,background:`linear-gradient(90deg, ${l}, ${l}cc)`}})}),i&&h.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:i})]})}function Z4({screenshot:e,isCapturing:t,onRefresh:r,onAction:n,addLog:i,connState:s,connScreenshot:o}){const l=x.useRef(null),a=x.useRef(null),c=x.useRef(null),[d,u]=x.useState(!0),[f,p]=x.useState(2e3),[m,_]=x.useState(null),[b,g]=x.useState(""),[,v]=x.useState(!1),[y,k]=x.useState([]),L=x.useRef(0),[S,j]=x.useState(!1),[T,B]=x.useState(!1),E=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[O,R]=x.useState(E?"mouse":"touch"),[C,P]=x.useState(1),z=x.useRef(!1),[A,U]=x.useState(1),[D,V]=x.useState(0),[w,Z]=x.useState(0),oe=x.useRef(0),N=x.useRef(t),q=x.useRef(r),I=x.useRef(n),$=x.useRef(null),Y=x.useRef(null),he=x.useRef(!1),me=x.useRef(null),Ce=x.useRef(0),ke=x.useRef(null),Ke=x.useRef(1),ue=x.useRef({x:0,y:0}),ve=x.useRef(!1),Q=x.useRef(A),ge=x.useRef(D),_e=x.useRef(w),Te=x.useRef(O);x.useEffect(()=>{N.current=t},[t]),x.useEffect(()=>{q.current=r},[r]),x.useEffect(()=>{Q.current=A},[A]),x.useEffect(()=>{ge.current=D},[D]),x.useEffect(()=>{_e.current=w},[w]),x.useEffect(()=>{I.current=n},[n]),x.useEffect(()=>{Te.current=O},[O]),x.useEffect(()=>{var G;(G=l.current)==null||G.focus()},[]);const J=s==="connected",xe=s!=="connected"&&s!=="connecting",Fe=J&&o?o:e;x.useEffect(()=>{if(!E||z.current||!Fe)return;const G=c.current,le=a.current;if(!G||!le)return;const ne=()=>{const be=le.clientWidth,Be=le.clientHeight,Oe=G.naturalWidth,Lt=G.naturalHeight;if(!Oe||!Lt||!be||!Be)return;const M=Math.min(be/Oe,Be/Lt),H=Math.max(be/Oe,Be/Lt)/M;H>1.01&&(P(H),U(H),Q.current=H),z.current=!0};G.complete&&G.naturalWidth?ne():G.addEventListener("load",ne,{once:!0})},[Fe,E]);const We=.5;x.useEffect(()=>{A<=We&&(V(0),Z(0))},[A,We]);const Pe=(G,le,ne)=>{if(ne<=We)return{x:0,y:0};const be=(ne-1)/(2*ne)*100,Be=(ne-1)/(2*ne)*100;return{x:Math.max(-be,Math.min(be,G)),y:Math.max(-Be,Math.min(Be,le))}};x.useEffect(()=>{if(!d||!xe)return;let G=null;const le=()=>{G&&clearInterval(G),!document.hidden&&(G=setInterval(()=>{var be;if(!N.current){const Be=((be=l.current)==null?void 0:be.clientWidth)||0,Oe=Math.max(400,Math.ceil(Be/100)*100);q.current(Oe)}},f))},ne=()=>{document.hidden?(G&&clearInterval(G),G=null):le()};return le(),document.addEventListener("visibilitychange",ne),()=>{G&&clearInterval(G),document.removeEventListener("visibilitychange",ne)}},[d,xe,f]);const Je=(G,le)=>{if(!c.current)return null;const ne=c.current.getBoundingClientRect();return!ne.width||!ne.height?null:{nx:Math.max(0,Math.min(1,(G-ne.left)/ne.width)),ny:Math.max(0,Math.min(1,(le-ne.top)/ne.height))}},Ae=(G,le,ne)=>{const be=a.current;if(!be)return;const Be=be.getBoundingClientRect(),Oe=++L.current;k(Lt=>[...Lt,{id:Oe,x:G-Be.left,y:le-Be.top,type:ne}]),setTimeout(()=>k(Lt=>Lt.filter(M=>M.id!==Oe)),600)},W=(G,le,ne)=>{const be=c.current,Be=a.current;if(!be||!Be)return;const Oe=be.getBoundingClientRect(),Lt=Be.getBoundingClientRect(),M=be.naturalWidth||Oe.width,F=be.naturalHeight||Oe.height,H=M/F,K=Oe.width/Oe.height;let ae,se,Me,Le;H>K?(ae=Oe.width,se=Oe.width/H,Me=0,Le=(Oe.height-se)/2):(se=Oe.height,ae=Oe.height*H,Me=(Oe.width-ae)/2,Le=0);const Ee=Oe.left-Lt.left+Me+ae*G,qe=Oe.top-Lt.top+Le+se*le,Xe=++L.current;k(Ge=>[...Ge,{id:Xe,x:Ee,y:qe,type:ne}]),setTimeout(()=>k(Ge=>Ge.filter(Yr=>Yr.id!==Xe)),600)},ee=async G=>{var ne;const le=Je(G.clientX,G.clientY);if(le){_(`Click: ${Math.round(le.nx*100)}%, ${Math.round(le.ny*100)}%`),Ae(G.clientX,G.clientY,"left"),(ne=l.current)==null||ne.focus();try{const be=await n("input_click",{nx:le.nx,ny:le.ny});be!=null&&be.success||i(`❌ Click failed: ${be==null?void 0:be.error}`)}catch(be){i(`❌ Click error: ${be.message||be}`)}}},ye=async(G,le,ne,be=0)=>{try{await n("input_key",{type:ne?"char":"keyDown",key:G,code:le,text:ne?G:void 0,unmodifiedText:ne?G:void 0,modifiers:be})}catch(Be){i(`❌ Key error: ${Be.message||Be}`)}},Ne=async G=>{if(G.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(G.key)&&G.preventDefault();let ne=0;G.altKey&&(ne|=1),G.ctrlKey&&(ne|=2),G.metaKey&&(ne|=4),G.shiftKey&&(ne|=8),_(`Key: ${G.key}`),await ye(G.key,G.code,G.key.length===1,ne)},He=async G=>{if(G.key==="Enter"){if(G.nativeEvent.isComposing)return;if(b){const le=b;g(""),_(`IME Sent: ${le}`);try{const ne=await n("input_type",{text:le});ne!=null&&ne.success||i(`❌ IME error: ${ne==null?void 0:ne.error}`)}catch(ne){i(`❌ IME error: ${ne.message}`)}}else _("Key: Enter"),await ye("Enter","Enter",!1)}};x.useEffect(()=>{const G=l.current;if(!G)return;const le=ne=>{var be;if((be=c.current)!=null&&be.contains(ne.target)){ne.preventDefault();const Be=Date.now();if(Be-oe.current<40)return;oe.current=Be;const Oe=Je(ne.clientX,ne.clientY);if(!Oe)return;_(`Scroll: ${Math.round(ne.deltaY)}`),n("input_wheel",{nx:Oe.nx,ny:Oe.ny,deltaX:Math.round(ne.deltaX),deltaY:Math.round(ne.deltaY)}).catch(()=>{})}};return G.addEventListener("wheel",le,{passive:!1}),()=>G.removeEventListener("wheel",le)},[n]);const[Ot,fr]=x.useState(null),gt=x.useRef(null);return x.useEffect(()=>{if(O==="mouse"&&!gt.current){const G={nx:.5,ny:.5};gt.current=G,fr(G)}},[O]),x.useEffect(()=>{const G=l.current;if(!G)return;const le=M=>{if(!c.current)return null;const F=c.current.getBoundingClientRect();return!F.width||!F.height?null:{nx:Math.max(0,Math.min(1,(M.clientX-F.left)/F.width)),ny:Math.max(0,Math.min(1,(M.clientY-F.top)/F.height))}},ne=(M,F)=>{if(!c.current)return{dnx:0,dny:0};const H=c.current,K=H.getBoundingClientRect(),ae=H.naturalWidth||K.width,se=H.naturalHeight||K.height,Me=ae/se,Le=K.width/K.height;let Ee,qe;return Me>Le?(Ee=K.width,qe=K.width/Me):(qe=K.height,Ee=K.height*Me),{dnx:M/Ee,dny:F/qe}},be=(M,F,H)=>{if(H<=1.05)return;const K=-(M-.5)*100,ae=-(F-.5)*100,se=Pe(K,ae,H);(Math.abs(se.x-ge.current)>.1||Math.abs(se.y-_e.current)>.1)&&(V(se.x),Z(se.y),ge.current=se.x,_e.current=se.y)},Be=M=>{const F=a.current;if(F&&M.target instanceof Node&&F.contains(M.target))M.preventDefault();else return;if(M.touches.length===1){const H=M.touches[0];$.current={x:H.clientX,y:H.clientY,time:Date.now()},Y.current={x:H.clientX,y:H.clientY},ve.current||(he.current=!1),me.current=setTimeout(()=>{if(!he.current&&!ve.current)if(he.current=!0,Te.current==="mouse"){const K=gt.current||{nx:.5,ny:.5};_("Right Click"),W(K.nx,K.ny,"right"),I.current("input_click",{...K,button:"right"}).catch(()=>{})}else{const K=le(H);K&&(_("Right Click"),W(K.nx,K.ny,"right"),I.current("input_click",{...K,button:"right"}).catch(()=>{}))}},500)}else if(M.touches.length===2){clearTimeout(me.current),he.current=!0,ve.current=!0;const H=M.touches[1].clientX-M.touches[0].clientX,K=M.touches[1].clientY-M.touches[0].clientY;ke.current=Math.sqrt(H*H+K*K),Ke.current=Q.current,ue.current={x:(M.touches[0].clientX+M.touches[1].clientX)/2,y:(M.touches[0].clientY+M.touches[1].clientY)/2}}},Oe=M=>{const F=a.current;if(F&&M.target instanceof Node&&F.contains(M.target)&&M.preventDefault(),M.touches.length===1&&Y.current){const H=M.touches[0],K=H.clientX-Y.current.x,ae=H.clientY-Y.current.y;if(!he.current&&$.current){const se=H.clientX-$.current.x,Me=H.clientY-$.current.y;Math.sqrt(se*se+Me*Me)>8&&(he.current=!0,clearTimeout(me.current))}if(he.current)if(Te.current==="mouse"){const se=ne(K,ae),Me=gt.current||{nx:.5,ny:.5},Le=Math.max(0,Math.min(1,Me.nx+se.dnx)),Ee=Math.max(0,Math.min(1,Me.ny+se.dny));gt.current={nx:Le,ny:Ee},fr({nx:Le,ny:Ee}),_(`Cursor: ${Math.round(Le*100)}%, ${Math.round(Ee*100)}%`),be(Le,Ee,Q.current);const qe=Date.now();qe-oe.current>=30&&(oe.current=qe,I.current("input_mouseMoved",{nx:Le,ny:Ee}).catch(()=>{}))}else if(Q.current>1){const se=a.current;if(se){const Me=se.clientWidth,Le=se.clientHeight,Ee=ge.current+K/Me*100,qe=_e.current+ae/Le*100,Xe=Pe(Ee,qe,Q.current);V(Xe.x),Z(Xe.y),ge.current=Xe.x,_e.current=Xe.y}}else{const se=le(H);if(se){const Me=Date.now();Me-oe.current>=40&&(oe.current=Me,_("Scroll"),I.current("input_wheel",{nx:se.nx,ny:se.ny,deltaX:Math.round(-K*2.5),deltaY:Math.round(-ae*2.5)}).catch(()=>{}))}}Y.current={x:H.clientX,y:H.clientY}}else if(M.touches.length===2&&ke.current!==null){const H=M.touches[1].clientX-M.touches[0].clientX,K=M.touches[1].clientY-M.touches[0].clientY,se=Math.sqrt(H*H+K*K)/ke.current,Me=(M.touches[0].clientX+M.touches[1].clientX)/2,Le=(M.touches[0].clientY+M.touches[1].clientY)/2,Ee=Me-ue.current.x,qe=Le-ue.current.y,Xe=Math.abs(se-1)>.03;if(Te.current==="mouse"){if(Xe){const Ge=Math.max(We,Math.min(5,Ke.current*se));U(Ge),Q.current=Ge}else if(Math.abs(Ee)>2||Math.abs(qe)>2){const Ge=gt.current||{nx:.5,ny:.5},Yr=Date.now();Yr-oe.current>=30&&(oe.current=Yr,_("Scroll"),I.current("input_wheel",{nx:Ge.nx,ny:Ge.ny,deltaX:Math.round(-Ee*3),deltaY:Math.round(-qe*3)}).catch(()=>{}))}}else{const Ge=Math.max(We,Math.min(5,Ke.current*se));U(Ge),Q.current=Ge;const Yr=a.current;if(Yr&&Ge>1){const kc=Yr.clientWidth,Is=Yr.clientHeight,Or=ge.current+Ee/kc*100,Ds=_e.current+qe/Is*100,Ln=Pe(Or,Ds,Ge);V(Ln.x),Z(Ln.y),ge.current=Ln.x,_e.current=Ln.y}}ue.current={x:Me,y:Le}}},Lt=M=>{var F;if(clearTimeout(me.current),ke.current=null,M.touches.length===1&&ve.current){const H=M.touches[0];$.current={x:H.clientX,y:H.clientY,time:Date.now()},Y.current={x:H.clientX,y:H.clientY},he.current=!0;return}if(M.touches.length===0){if(ve.current){ve.current=!1,he.current=!1;return}if(M.changedTouches.length===1&&!he.current){const H=M.changedTouches[0],K=Date.now(),ae=K-(((F=$.current)==null?void 0:F.time)||0);if(ae<60||ae>400){he.current=!1;return}if($.current){const se=H.clientX-$.current.x,Me=H.clientY-$.current.y;if(Math.sqrt(se*se+Me*Me)>12){he.current=!1;return}}if(Te.current==="mouse"){const se=gt.current||le(H);se&&(_(`Click: ${Math.round(se.nx*100)}%, ${Math.round(se.ny*100)}%`),W(se.nx,se.ny,"left"),I.current("input_click",{...se}).catch(()=>{}))}else{const se=le(H);if(!se)return;K-Ce.current<300?(_("Double tap"),W(se.nx,se.ny,"double"),I.current("input_click",{...se,clickCount:2}).catch(()=>{}),Ce.current=0):(_(`Tap: ${Math.round(se.nx*100)}%, ${Math.round(se.ny*100)}%`),W(se.nx,se.ny,"left"),I.current("input_click",{...se}).catch(()=>{}),Ce.current=K)}}he.current=!1}};return G.addEventListener("touchstart",Be,{passive:!1}),G.addEventListener("touchmove",Oe,{passive:!1}),G.addEventListener("touchend",Lt,{passive:!1}),()=>{G.removeEventListener("touchstart",Be),G.removeEventListener("touchmove",Oe),G.removeEventListener("touchend",Lt),clearTimeout(me.current)}},[]),h.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:Ne,onContextMenu:G=>G.preventDefault(),onFocus:()=>v(!0),onBlur:()=>v(!1),tabIndex:0,children:[h.jsxs("div",{ref:a,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[Fe?h.jsx("img",{ref:c,src:Fe,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${A}) translate(${D}%, ${w}%)`,transformOrigin:"center center",cursor:O==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:ee,onContextMenu:G=>G.preventDefault(),onDragStart:G=>G.preventDefault()}):h.jsxs("div",{className:"text-slate-800 text-center",children:[h.jsx("div",{className:"text-5xl mb-3",children:"🌑"}),h.jsx("div",{className:"text-[13px] font-semibold",children:"Connecting to Host..."})]}),O==="mouse"&&Ot&&Fe&&c.current&&(()=>{var Ee;const G=c.current,le=G.getBoundingClientRect(),ne=(Ee=a.current)==null?void 0:Ee.getBoundingClientRect();if(!ne)return null;const be=G.naturalWidth||le.width,Be=G.naturalHeight||le.height,Oe=be/Be,Lt=le.width/le.height;let M,F,H,K;Oe>Lt?(M=le.width,F=le.width/Oe,H=0,K=(le.height-F)/2):(F=le.height,M=le.height*Oe,H=(le.width-M)/2,K=0);const ae=le.left-ne.left+H+M*Ot.nx,se=le.top-ne.top+K+F*Ot.ny,Me=Math.max(8,Math.min(ne.width-8,ae)),Le=Math.max(8,Math.min(ne.height-8,se));return h.jsxs("div",{style:{position:"absolute",left:Me-8,top:Le-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[h.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),h.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),h.jsx("div",{style:{position:"absolute",left:5,top:5,width:6,height:6,borderRadius:"50%",background:"#3b82f6",boxShadow:"0 0 8px rgba(59,130,246,0.6)"}})]})})(),y.map(G=>{const ne={left:"59,130,246",right:"239,68,68",double:"34,197,94"}[G.type];return h.jsxs("div",{style:{position:"absolute",left:G.x,top:G.y,pointerEvents:"none",zIndex:200,transform:"translate(-50%, -50%)"},children:[h.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`2px solid rgba(${ne}, 0.8)`,animation:"click-ripple-ring 0.5s ease-out forwards",position:"absolute",left:-20,top:-20}}),h.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:`rgba(${ne}, 0.9)`,boxShadow:`0 0 12px rgba(${ne}, 0.6)`,animation:"click-ripple-dot 0.4s ease-out forwards",position:"absolute",left:-4,top:-4}})]},G.id)})]}),h.jsxs("div",{onTouchStart:G=>G.stopPropagation(),className:"absolute bottom-0 left-0 right-0 z-[1000] flex items-center justify-center gap-1.5 px-3 py-2 bg-black/75 backdrop-blur-xl border-t border-white/[0.08] touch-none",children:[h.jsxs("div",{onClick:()=>{R(G=>{const le=G==="touch"?"mouse":"touch";if(le==="mouse"&&!gt.current){const ne={nx:.5,ny:.5};gt.current=ne,fr(ne)}return le})},className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${O==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[h.jsx("span",{className:"text-sm",children:O==="mouse"?"🖱️":"👆"}),h.jsx("span",{className:`text-[10px] font-bold ${O==="mouse"?"text-blue-400":"text-slate-400"}`,children:O==="mouse"?"Mouse":"Touch"})]}),h.jsxs("div",{className:"relative",children:[h.jsx("div",{onClick:()=>{B(!T),j(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${T?"bg-emerald-500/25 border border-emerald-500/40":"bg-white/[0.08] border border-white/10"}`,children:h.jsx("span",{className:"text-sm",children:"⌨️"})}),T&&h.jsx("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 w-[220px] bg-neutral-950/[0.98] backdrop-blur-[30px] rounded-xl border border-white/20 p-[10px_12px] shadow-[0_10px_30px_rgba(0,0,0,0.8)] flex flex-col gap-2 z-[2000]",style:{animation:"slideUp 0.15s ease-out"},children:h.jsx("input",{type:"text",placeholder:"Type & Enter...",value:b,autoFocus:!0,onTouchStart:G=>G.stopPropagation(),onChange:G=>g(G.target.value),onKeyDown:He,className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),h.jsx("div",{className:"relative",children:h.jsx("div",{onClick:()=>{j(!S),B(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${S?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:h.jsx("span",{className:"text-sm",children:"⚙️"})})}),h.jsx("div",{className:"w-px h-[18px] bg-white/10"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:J?"rgba(16,185,129,0.12)":"rgba(251,191,36,0.12)"},children:[h.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:J?"#10b981":"#fbbf24"}}),h.jsx("span",{className:"text-[8px] font-extrabold",style:{color:J?"#10b981":"#fbbf24"},children:J?"Connected":"WS"})]}),A>1&&h.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(A*100),"%"]}),m&&h.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:m})]})]}),S&&h.jsxs("div",{onTouchStart:G=>G.stopPropagation(),style:{position:"absolute",bottom:56,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23, 23, 23, 0.95)",backdropFilter:"blur(25px)",borderRadius:14,border:"1px solid rgba(255,255,255,0.1)",padding:14,boxShadow:"0 12px 40px rgba(0,0,0,0.6)",display:"flex",flexDirection:"column",gap:12,zIndex:1001,touchAction:"none",animation:"slideUpSidebar 0.15s ease-out"},children:[h.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:"SETTINGS"}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[h.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:["ZOOM: ",A<=(E?C:1)+.01?E?"FILL":"FIT":`${Math.round(A*100)}%`]}),h.jsxs("div",{style:{display:"flex",gap:4},children:[h.jsx("button",{onClick:G=>{G.stopPropagation(),U(le=>Math.max(.5,le-.25))},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"−"}),h.jsx("button",{onClick:G=>{G.stopPropagation();const le=E?C:1;U(le),Q.current=le,V(0),Z(0)},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:9,fontWeight:800,cursor:"pointer"},children:E?"FILL":"FIT"}),h.jsx("button",{onClick:G=>{G.stopPropagation(),U(le=>Math.min(5,le+.25))},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"+"})]})]}),h.jsx("button",{onClick:G=>{var be;G.stopPropagation();const le=((be=l.current)==null?void 0:be.clientWidth)||0,ne=le>0?Math.max(400,Math.ceil(le/100)*100):void 0;r(ne)},style:{width:"100%",background:"#3b82f6",color:"#fff",border:"none",padding:"8px",borderRadius:6,fontSize:11,fontWeight:800,cursor:"pointer"},children:"FORCE SYNC"}),h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255,255,255,0.05)",padding:"6px 10px",borderRadius:6},children:[h.jsx("span",{style:{fontSize:10,color:"#888",fontWeight:700},children:"AUTO REF."}),h.jsx("input",{type:"checkbox",checked:d,onChange:G=>u(G.target.checked)})]}),h.jsxs("select",{value:f,onChange:G=>p(Number(G.target.value)),style:{background:"rgba(255,255,255,0.05)",color:"#fff",border:"none",borderRadius:6,padding:"6px",fontSize:10,fontWeight:600,outline:"none"},children:[h.jsx("option",{value:500,children:"0.5s Interval"}),h.jsx("option",{value:1e3,children:"1.0s Interval"}),h.jsx("option",{value:2e3,children:"2.0s Interval"}),h.jsx("option",{value:4e3,children:"4.0s Interval"})]})]}),h.jsx("style",{children:`
154
+ @keyframes slideUp {
155
+ from { opacity: 0; transform: translateY(6px); }
156
+ to { opacity: 1; transform: translateY(0); }
157
+ }
158
+ @keyframes slideUpSidebar {
159
+ from { opacity: 0; transform: translateY(6px); }
160
+ to { opacity: 1; transform: translateY(0); }
161
+ }
162
+ @keyframes click-ripple-ring {
163
+ 0% { transform: scale(0.3); opacity: 1; }
164
+ 100% { transform: scale(2.2); opacity: 0; }
165
+ }
166
+ @keyframes click-ripple-dot {
167
+ 0% { transform: scale(1); opacity: 0.9; }
168
+ 50% { transform: scale(1.8); opacity: 0.6; }
169
+ 100% { transform: scale(0.5); opacity: 0; }
170
+ }
171
+ `})]})}function eR({screenshotUrl:e,mode:t="preview",zoom:r=100,interactive:n=!1,connectionState:i,onDismiss:s,onClickAt:o,onKeyDown:l,badge:a,emptyMessage:c,aspectRatio:d,className:u,style:f}){const p=x.useRef(null),m=x.useCallback(_=>{if(!n||!o||!p.current)return;const b=p.current,g=b.getBoundingClientRect(),v=(_.clientX-g.left)/g.width*b.naturalWidth,y=(_.clientY-g.top)/g.height*b.naturalHeight;o(v,y,b.naturalWidth,b.naturalHeight)},[n,o]);return t==="preview"?e?h.jsxs("div",{className:`relative rounded-xl overflow-hidden border border-border-subtle bg-bg-secondary ${u||""}`,style:{aspectRatio:d||"16/9",...f},children:[h.jsx("img",{ref:p,src:e,alt:"IDE Screenshot",className:"w-full h-full object-cover"}),s&&h.jsx("button",{onClick:s,className:"absolute top-2.5 right-2.5 bg-black/50 border-none text-white w-5 h-5 rounded-full text-[10px] z-10 cursor-pointer flex items-center justify-center",children:"✕"})]}):null:e?h.jsxs("div",{className:`${n?"screenshot-interactive":""} ${u||""} relative h-full flex items-center justify-center overflow-auto`,tabIndex:n?0:void 0,onKeyDown:n?l:void 0,style:f,children:[h.jsx("img",{ref:p,src:e,alt:"IDE Screenshot",onClick:n?m:void 0,className:"max-w-full max-h-full object-contain",style:{...n?{cursor:"crosshair"}:{},...r!==100?{transform:`scale(${r/100})`,transformOrigin:"center center"}:{}}}),a&&h.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 bg-black/70 text-white px-3.5 py-1.5 rounded-[20px] text-xs font-semibold backdrop-blur-sm",children:a})]}):h.jsxs("div",{className:`flex items-center justify-center flex-col gap-2 h-full text-text-muted ${u||""}`,style:f,children:[h.jsx("p",{className:"text-base",children:c||"🖥 Waiting for screenshot stream..."}),i&&h.jsxs("p",{className:"text-[13px] mt-2 opacity-50",children:["P2P: ",i]})]})}function x1({activeConv:e,onModalButton:t}){const[r,n]=x.useState(null);if(x.useEffect(()=>{n(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=o=>{r||(n(o),t(o))},s=o=>o.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim();return h.jsxs("div",{className:"bg-gradient-to-br from-amber-600 to-amber-700 text-white py-2.5 px-4 shrink-0 z-[5]",children:[e.modalMessage&&h.jsx("div",{className:"text-[11px] opacity-85 mb-1.5 whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:e.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsxs("div",{className:"font-black text-xs flex items-center gap-2",children:[h.jsx(Ey,{size:14})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),h.jsx("div",{className:"flex gap-2 flex-wrap",children:e.modalButtons.map((o,l)=>{const a=s(o).toLowerCase(),c=/^(run|approve|accept|yes|allow|always)/.test(a),d=/^(reject|deny|delete|remove|abort)/.test(a),u=r===o,f=r!==null;return h.jsx("button",{onClick:()=>i(o),disabled:f,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${c?"bg-white text-amber-700 font-extrabold":d?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${f&&!u?"opacity-40":"opacity-100"} ${f?"cursor-not-allowed":"cursor-pointer"}`,children:u?"⏳ ...":s(o)},l)})})]})]})}const Er=new Map;function tR({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var q;const{sendCommand:a}=ci(),c=!!(o||l),d=`${e}:${r}`,u=Er.get(d),[f,p]=x.useState(!1),[m,_]=x.useState(!1),[b,g]=x.useState((u==null?void 0:u.models)||[]),[v,y]=x.useState((u==null?void 0:u.modes)||[]),k=I=>I?typeof I=="string"?I:typeof I=="object"?I.name||I.id||JSON.stringify(I):String(I):"",[L,S]=x.useState(k(i)),[j,T]=x.useState(k(s)),[B,E]=x.useState(!1),[O,R]=x.useState(!1),C=x.useRef(0),P=I=>I.map($=>typeof $=="string"?$:($==null?void 0:$.name)||($==null?void 0:$.id)||String($));x.useEffect(()=>{if(o){const I=o.find($=>$.category==="model");if(I){const $=P(I.options.map(he=>he.value));g($),I.currentValue&&S(k(I.currentValue));const Y=Er.get(d)||{models:[],modes:[]};Er.set(d,{...Y,models:$})}}if(l&&l.length>0){const I=P(l.map(Y=>Y.id));y(I);const $=Er.get(d)||{models:[],modes:[]};Er.set(d,{...$,modes:I})}else if(o){const I=o.find($=>$.category!=="model");if(I){const $=P(I.options.map(he=>he.value));y($),I.currentValue&&T(k(I.currentValue));const Y=Er.get(d)||{models:[],modes:[]};Er.set(d,{...Y,modes:$})}}},[o,l,d]),x.useEffect(()=>{p(!1),_(!1),S(k(i)),T(k(s));const I=Er.get(d);I?(g(I.models),y(I.modes)):(g([]),y([]))},[e,r]),x.useEffect(()=>{i&&Date.now()>C.current&&S(k(i))},[i]),x.useEffect(()=>{s&&Date.now()>C.current&&T(k(s))},[s]);const z=x.useCallback(async(I,$={})=>{const Y={...$},he=e.split(":");return he.length>=3&&(he[1]==="ide"||he[1]==="cli"||he[1]==="acp")&&(Y._targetInstance=he.slice(2).join(":"),Y._targetType=he[1]),await a(e,I,Y)},[e]),A=async()=>{var I,$;if(b.length>0){p(!f);return}if(c){p(!0);return}E(!0);try{const Y=await z("list_extension_models",{agentType:r,ideType:t}),he=(Y==null?void 0:Y.models)||((I=Y==null?void 0:Y.result)==null?void 0:I.models)||[],me=P(he);g(me),Y!=null&&Y.current&&S(k(Y.current)),($=Y==null?void 0:Y.result)!=null&&$.current&&S(k(Y.result.current));const Ce=Er.get(d)||{models:[],modes:[]};Er.set(d,{...Ce,models:me}),p(!0)}catch{}finally{E(!1)}},U=async()=>{var I,$;if(v.length>0){_(!m);return}if(c){_(!0);return}R(!0);try{const Y=await z("list_extension_modes",{agentType:r,ideType:t}),he=(Y==null?void 0:Y.modes)||((I=Y==null?void 0:Y.result)==null?void 0:I.modes)||[],me=P(he);y(me),Y!=null&&Y.current&&T(k(Y.current)),($=Y==null?void 0:Y.result)!=null&&$.current&&T(k(Y.result.current));const Ce=Er.get(d)||{models:[],modes:[]};Er.set(d,{...Ce,modes:me}),_(!0)}catch{}finally{R(!1)}},D=async I=>{p(!1),S(I),C.current=Date.now()+5e3;try{c?await z("change_model",{agentType:r,ideType:t,model:I}):await z("set_extension_model",{agentType:r,ideType:t,model:I})}catch{}},V=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(I=>I.category!=="model")),w=V?(q=o==null?void 0:o.find(I=>I.category!=="model"))==null?void 0:q.configId:void 0,Z=async I=>{_(!1),T(I),C.current=Date.now()+5e3;try{c&&V&&w?await z("set_thought_level",{agentType:r,ideType:t,configId:w,value:I}):c?await z("set_mode",{agentType:r,ideType:t,mode:I}):await z("set_extension_mode",{agentType:r,ideType:t,mode:I})}catch{}},N={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[r]||"#94a3b8";return h.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 flex-wrap text-[10px] border-t border-border-subtle bg-[var(--surface-primary)]",children:[h.jsx("span",{className:"text-[9px] font-bold tracking-wide uppercase opacity-70",style:{color:N},children:n}),h.jsx("span",{className:"text-border-subtle text-[10px]",children:"│"}),h.jsxs("div",{className:"relative",children:[h.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:f?`${N}55`:"transparent",border:"1px solid",color:L?"var(--text-primary)":"var(--text-muted)"},onClick:A,children:[h.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),B?"...":L||"Model",h.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),f&&b.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>p(!1)}),h.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[h.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:"SELECT MODEL"}),b.map(I=>h.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:I===L?`${N}18`:"transparent",color:I===L?N:"var(--text-secondary)",fontWeight:I===L?600:400,borderLeft:I===L?`2px solid ${N}`:"2px solid transparent"},onMouseEnter:$=>{$.currentTarget.style.background=`${N}12`},onMouseLeave:$=>{$.currentTarget.style.background=I===L?`${N}18`:"transparent"},onClick:()=>D(I),children:I},I))]})]})]}),h.jsxs("div",{className:"relative",children:[h.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:m?`${N}55`:"transparent",border:"1px solid",color:j?"var(--text-primary)":"var(--text-muted)"},onClick:U,children:[h.jsx("span",{className:"text-[9px] opacity-60",children:V?"🧠":"⚡"}),O?"...":j||(V?"Thinking":"Mode"),h.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),m&&v.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>_(!1)}),h.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[h.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:V?"SELECT THINKING LEVEL":"SELECT MODE"}),v.map(I=>h.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:I===j?`${N}18`:"transparent",color:I===j?N:"var(--text-secondary)",fontWeight:I===j?600:400,borderLeft:I===j?`2px solid ${N}`:"2px solid transparent"},onMouseEnter:$=>{$.currentTarget.style.background=`${N}12`},onMouseLeave:$=>{$.currentTarget.style.background=I===j?`${N}18`:"transparent"},onClick:()=>Z(I),children:I},I))]})]})]})]})}const ii=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),ln=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function y1({activeConv:e,ides:t,agentInput:r,setAgentInput:n,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a,userName:c}){const d=x.useRef(null),{sendCommand:u}=ci(),[f,p]=x.useState([]),[m,_]=x.useState(0),[b,g]=x.useState(!0),[v,y]=x.useState(!1),k=x.useRef("");e.tabKey!==k.current&&(k.current=e.tabKey,p([]),_(0),g(!0));const L=x.useCallback(async()=>{var T,B,E,O,R,C;if(!(v||!b)){y(!0);try{const P=t.find(w=>w.id===e.ideId),z=(P==null?void 0:P.daemonId)||((T=e.ideId)==null?void 0:T.split(":")[0])||"";if(!z){g(!1);return}const A=e.ideType||e.agentType||"",U=(e.ideId||"").split(":"),D=U.length>=3?U.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:z,agentType:A,instanceId:D,offset:m});const V=await u(z,"chat_history",{agentType:A,offset:m,limit:30,instanceId:D});console.log("[ChatPane] got result:",{count:((B=V.messages)==null?void 0:B.length)||0,hasMore:V.hasMore}),((E=V.messages)==null?void 0:E.length)>0&&(p(w=>[...V.messages,...w]),_(w=>w+V.messages.length)),g(V.hasMore)}catch(P){console.warn("[ChatPane] Failed to load history:",P),!((O=P==null?void 0:P.message)!=null&&O.includes("P2P not available"))&&!((R=P==null?void 0:P.message)!=null&&R.includes("channel not open"))&&!((C=P==null?void 0:P.message)!=null&&C.includes("P2P not connected"))&&g(!1)}finally{y(!1)}}},[v,b,m,t,e]),S=x.useRef(0);x.useEffect(()=>{if(e.messages.length<10&&b&&!v&&f.length===0){const T=S.current;if(T>8)return;const E=setTimeout(()=>{S.current=T+1,L()},T===0?500:3e3);return()=>clearTimeout(E)}else f.length>0&&(S.current=0)},[e.tabKey,e.messages.length,b,v,f.length,L]);const j=(()=>{const T=e.messages.map((O,R)=>{const C=`${e.ideId}-${O.id??`i-${R}`}`;return{...O,receivedAt:O.receivedAt||l[C]||0}});if(f.length===0)return T;const B=new Set(T.map(O=>`${O.role}:${(O.content||"").slice(0,100)}`));return[...f.filter(O=>!B.has(`${O.role}:${(O.content||"").slice(0,100)}`)),...T]})();return h.jsxs(h.Fragment,{children:[h.jsx(DP,{messages:j,actionLogs:a.filter(T=>T.ideId===e.tabKey).sort((T,B)=>T.timestamp-B.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",userName:c,isCliMode:ii(e)||ln(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:L,isLoadingMore:v,hasMoreHistory:b,emptyState:e.messages.length===0?e.status==="not_monitored"?h.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[h.jsx("div",{className:"text-3xl opacity-60",children:h.jsx(Ny,{size:28})}),h.jsx("div",{className:"text-[13px] opacity-50",children:"Agent not monitored"}),h.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Switching...":h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(Fa,{size:14})," Open ",e.displayPrimary," Panel"]})}),h.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?h.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[h.jsx("div",{className:"text-3xl opacity-60",children:h.jsx(SP,{size:28})}),h.jsx("div",{className:"text-[13px] opacity-50",children:"Panel is not visible in IDE"}),h.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Opening...":h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(Fa,{size:14})," Open ",e.displayPrimary," Panel"]})}),h.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Open the agent sidebar in your IDE to start viewing messages"})]}):void 0:void 0}),!ii(e)&&(()=>{var B,E,O,R;const T=t.find(C=>C.id===e.ideId);return h.jsx(tR,{ideId:e.ideId,ideType:e.ideType,agentType:e.streamSource==="agent-stream"?e.agentType:((E=(B=T==null?void 0:T.agents)==null?void 0:B[0])==null?void 0:E.type)||e.ideType,agentName:e.streamSource==="agent-stream"?e.agentName:((R=(O=T==null?void 0:T.agents)==null?void 0:O[0])==null?void 0:R.name)||e.agentName,serverModel:(T==null?void 0:T.currentModel)||void 0,serverMode:(T==null?void 0:T.currentPlan)||void 0,acpConfigOptions:ln(e)?T==null?void 0:T.acpConfigOptions:void 0,acpModes:ln(e)?T==null?void 0:T.acpModes:void 0})})(),h.jsx("div",{className:"dashboard-input-area px-3 py-2.5 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:h.jsxs("div",{className:"flex gap-2.5 items-center",children:[h.jsx("div",{className:"flex-1 relative",children:h.jsx("input",{ref:d,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:T=>n(T.target.value),onPaste:T=>{const B=T.clipboardData.getData("text");B&&n(E=>E+B),T.preventDefault()},onKeyDown:T=>{if(T.key==="Enter"){if(T.nativeEvent.isComposing){T.preventDefault();return}T.preventDefault(),i()}},onBlur:T=>{if(window.innerWidth<768){const B=T.relatedTarget;if((B==null?void 0:B.tagName)==="BUTTON")return;setTimeout(()=>{document.documentElement.scrollTop=0},300)}},className:"w-full h-10 rounded-[20px] px-4 bg-bg-secondary border border-border-subtle text-sm text-text-primary"})}),h.jsx("button",{onClick:i,disabled:!r.trim(),className:`w-10 h-10 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${r.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:h.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:r.trim()?"text-white":"text-text-muted",children:h.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}const Tu=new Set,w1={emit(e,t){for(const r of Tu)r(e,t)},on(e){return Tu.add(e),()=>{Tu.delete(e)}}};function rR({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){var p;const l=x.useRef(null),{sendCommand:a,sendData:c}=ci(),d=(p=e.ideId)!=null&&p.includes(":cli:")?e.ideId.split(":cli:")[1]:"",u=e.tabKey,f=e.ideType||e.agentType||"";return x.useEffect(()=>{const m=t.current.get(u);if(m&&m.length>0){const _=setTimeout(()=>{var b;for(const g of m)(b=r.current)==null||b.write(g);requestAnimationFrame(()=>{var g;(g=r.current)==null||g.bumpResize()})},100);return()=>clearTimeout(_)}},[u]),x.useEffect(()=>{const m=w1.on((_,b)=>{var v;if(!b)return;(_===d||_===f)&&((v=r.current)==null||v.write(b))});return()=>{m()}},[d,f]),h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--surface-primary)] border-b border-border-subtle shrink-0",children:[h.jsx("div",{className:"flex gap-1",children:h.jsx("div",{className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-accent text-white",children:"⬛ Terminal"})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"text-[10px] text-text-muted",children:[e.agentName," — Terminal"]}),h.jsx("button",{onClick:()=>{if(!r.current||!e)return;const m=t.current.get(e.tabKey);if(m&&m.length>0)for(const _ of m)r.current.write(_);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var _;(_=r.current)==null||_.bumpResize()})})},title:"Refresh terminal (replay buffer + TUI redraw)",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-bg-secondary text-text-secondary border border-border-subtle cursor-pointer leading-none",children:"↺"}),h.jsx("button",{onClick:async()=>{var b;const m=(b=e.ideId)!=null&&b.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";if(!window.confirm(`Stop ${m}?
172
+ This will terminate the CLI process.`))return;const _=e.ideId||e.daemonId||"";try{await a(_,"stop_cli",{cliType:m})}catch(g){console.error("Stop CLI failed:",g)}},title:"Stop CLI process",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-red-500/[0.08] text-red-400 border border-red-500/30 cursor-pointer leading-none font-semibold",children:"■ Stop"})]})]}),h.jsx(x1,{activeConv:e,onModalButton:o}),h.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:h.jsx(v1,{ref:r,onInput:m=>{var g;const _=e.ideId||e.daemonId||"",b=(g=e.ideId)!=null&&g.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(_,{type:"pty_input",cliType:b,data:m})||a(_,"pty_input",{cliType:b,data:m}).catch(console.error)},onResize:(m,_)=>{var v;const b=e.ideId||e.daemonId||"",g=(v=e.ideId)!=null&&v.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(b,{type:"pty_resize",cliType:g,cols:m,rows:_})||a(b,"pty_resize",{cliType:g,cols:m,rows:_,force:!0}).catch(()=>{})}},e.tabKey)}),h.jsx("div",{className:"px-3 py-2 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:h.jsxs("div",{className:"flex gap-2.5 items-center",children:[h.jsx("div",{className:"flex-1 relative",children:h.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:m=>i(m.target.value),onPaste:m=>{const _=m.clipboardData.getData("text");_&&i(b=>b+_),m.preventDefault()},onKeyDown:m=>{if(m.key==="Enter"){if(m.nativeEvent.isComposing){m.preventDefault();return}m.preventDefault(),s()}},className:"w-full h-9 rounded-[18px] px-4 bg-bg-secondary border border-border-subtle text-[13px] text-text-primary"})}),h.jsx("button",{onClick:s,disabled:!n.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${n.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:n.trim()?"text-white":"text-text-muted",children:h.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function nR({wsStatus:e,showReconnected:t,loginUrl:r}){const n=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed",i=e==="auth_failed"?"red":e==="offline"?"orange":"violet",s={red:"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))",orange:"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))",violet:"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))"},o={red:"1px solid rgba(239,68,68,0.2)",orange:"1px solid rgba(255,107,53,0.2)",violet:"1px solid rgba(139,92,246,0.2)"},l={red:"#ef4444",orange:"#ff6b35",violet:"#a78bfa"};return h.jsxs(h.Fragment,{children:[n&&h.jsxs("div",{className:"py-2.5 px-5 text-[13px] font-semibold flex items-center gap-2.5 justify-center",style:{background:s[i],borderBottom:o[i],color:l[i]},children:[h.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-5 h-5",style:{opacity:e==="auth_failed"?.6:1,animation:e==="auth_failed"?void 0:"pulse 2s ease-in-out infinite",filter:e==="auth_failed"?"grayscale(1)":void 0}}),e==="offline"&&"Network offline — waiting for connection...",e==="disconnected"&&"Reconnecting to server...",e==="reconnecting"&&"Reconnecting to server...",e==="auth_failed"&&(r?h.jsxs(h.Fragment,{children:["Session expired."," ",h.jsx("a",{href:r,className:"text-inherit underline",children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&h.jsxs("div",{className:"py-2 px-4 text-xs font-semibold flex items-center gap-2 justify-center bg-gradient-to-r from-green-500/[0.12] to-green-500/[0.04] text-green-400 border-b border-green-500/15 animate-[fadeIn_0.3s_ease]",children:[h.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-4 h-4"}),"Connected"]})]})}const Pu=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),Lu=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function iR({activeConv:e,agentCount:t,wsStatus:r,isConnected:n,onOpenHistory:i}){const s=En(),o=n?"#22c55e":r==="connected"?"#eab308":"#ef4444",l=n?"0 0 4px #22c55e80":r==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480";return h.jsxs("div",{className:"dashboard-header",children:[h.jsx("div",{className:"flex items-center gap-3",children:h.jsxs("div",{className:"leading-tight",children:[h.jsxs("h1",{className:"header-title m-0 flex items-center gap-1.5",children:[h.jsx($a,{size:18}),h.jsx("span",{className:"header-title-desktop",children:"Dashboard"}),h.jsx("span",{className:"header-title-mobile",children:(e==null?void 0:e.displayPrimary)||"Dashboard"}),h.jsx("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:h.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full align-middle",style:{background:o,boxShadow:l}})})]}),h.jsxs("div",{className:"header-subtitle text-[11px] items-center gap-1",children:[t," agent",t!==1?"s":""," active",h.jsx("span",{title:n?"Connected":r==="connected"?"Partial":"Disconnected",className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{background:o,boxShadow:l}})]})]})}),h.jsxs("div",{className:"flex gap-2 items-center",children:[e&&!Pu(e)&&!Lu(e)&&h.jsxs("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm border-none px-2.5 py-1.5 flex items-center gap-1 text-xs",title:"IDE View",children:[h.jsx(CP,{size:14})," IDE"]}),e&&!Pu(e)&&!Lu(e)&&h.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5 flex items-center gap-1",title:"Chat History",children:h.jsx(yP,{size:16})}),e&&!Pu(e)&&!Lu(e)&&h.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5",title:"Remote Control",children:h.jsx(ll,{size:16})})]})]})}function Mr(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function sR(e){if(e<60)return`${Math.round(e)}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const r=Math.floor(t/60),n=t%60;if(r<24)return n>0?`${r}h ${n}m`:`${r}h`;const i=Math.floor(r/24),s=r%24;return`${i}d ${s}h`}function x_(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function y_(e){return(e.id||"").includes(":cli:")}function w_(e){return(e.id||"").includes(":acp:")}function Ed(e,t){return Mr(e)}function oR(e){if(!Array.isArray(e)||e.length<=1)return e;const t=new Map,r=["generating","streaming","active","connected","idle","panel_hidden"];for(const n of e){const i=(n.name||n.id||"").toLowerCase().replace(/\s+/g,"-"),s=t.get(i);if(!s){t.set(i,n);continue}const o=r.indexOf(s.status||"idle"),l=r.indexOf(n.status||"idle");l>=0&&(o<0||l<o)&&t.set(i,n)}return Array.from(t.values())}function lR({activeConv:e,ides:t,isCreatingChat:r,isRefreshingHistory:n,onClose:i,onNewChat:s,onSwitchSession:o,onRefreshHistory:l}){var u;const a=t.find(f=>f.id===e.ideId),c=(a==null?void 0:a.chats)||[],d=(u=a==null?void 0:a.activeChat)==null?void 0:u.id;return h.jsxs("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[h.jsx("div",{onClick:i,className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),h.jsxs("div",{className:"card fade-in relative w-[90%] max-w-[500px] max-h-[80vh] flex flex-col p-0 overflow-hidden shadow-[0_20px_40px_rgba(0,0,0,0.4)] rounded-[20px]",children:[h.jsxs("div",{className:"px-6 py-5 border-b border-border-subtle flex justify-between items-center bg-[var(--surface-primary)]",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"m-0 text-lg font-extrabold",children:"Chat History"}),h.jsxs("div",{className:"text-xs text-text-muted mt-0.5",children:[e.displayPrimary," — ",Mr(e.ideType)]})]}),h.jsx("button",{onClick:i,className:"bg-transparent border-none text-xl text-text-muted cursor-pointer",children:"✕"})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-3 bg-bg-primary",children:[h.jsx("button",{onClick:s,disabled:r,className:"w-full p-3.5 rounded-xl mb-3 bg-indigo-500/10 border border-dashed border-accent text-accent font-bold text-sm cursor-pointer",children:r?"⌛ Creating...":"+ Start New Chat Session"}),c.map(f=>h.jsxs("div",{onClick:()=>{o(e.ideId,f.id),i()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${d===f.id?"bg-[var(--bg-glass-hover)] border-accent":"bg-[var(--surface-secondary)] border-border-subtle"}`,children:[h.jsx("div",{className:`font-bold text-sm mb-1 ${d===f.id?"text-[var(--accent-primary-light)]":"text-text-primary"}`,children:f.title||"Untitled Session"}),h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-mono",children:[f.id.substring(0,12),"..."]}),d===f.id&&h.jsx("span",{className:"text-[10px] bg-accent text-white px-2 py-0.5 rounded-[10px] font-extrabold",children:"ACTIVE"})]})]},f.id)),c.length===0&&h.jsxs("div",{className:"py-10 px-5 text-center text-text-muted",children:[h.jsx("div",{className:"text-3xl mb-3 opacity-60",children:h.jsx(PP,{size:32})}),h.jsx("div",{className:"text-[13px]",children:"No recent chat sessions found."})]})]}),h.jsx("div",{className:"px-5 py-4 bg-[var(--surface-tertiary)] border-t border-border-subtle text-right",children:h.jsx("button",{onClick:l,disabled:n,className:"btn btn-secondary btn-sm rounded-[10px]",children:n?"⌛ Refreshing...":h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(bP,{size:13})," Refresh History"]})})})]})]})}const b_={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function aR({toasts:e,onDismiss:t,onClickToast:r}){return h.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:e.map(n=>h.jsxs("div",{className:"fade-in text-white px-5 py-3 rounded-xl text-[13px] font-semibold shadow-[0_8px_32px_rgba(0,0,0,0.3)] backdrop-blur-lg pointer-events-auto cursor-pointer animate-[toast-in_0.3s_ease-out] max-w-[360px]",style:{background:b_[n.type]||b_.info},onClick:()=>{var i;(i=n.actions)!=null&&i.length||(r&&r(n),t(n.id))},children:[h.jsx("div",{children:n.message}),n.actions&&n.actions.length>0&&h.jsx("div",{className:"flex gap-2 mt-2",children:n.actions.map((i,s)=>h.jsx("button",{className:`text-xs px-3 py-1 rounded-md font-bold transition-all cursor-pointer ${i.variant==="primary"?"bg-white text-amber-700 hover:bg-gray-100":i.variant==="danger"?"bg-red-500/30 text-white hover:bg-red-500/50":"bg-white/20 text-white hover:bg-white/30"}`,onClick:o=>{o.stopPropagation(),i.onClick(),t(n.id)},children:i.label},s))})]},n.id))})}const cR=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function uR(e){return e.workspace||"Workspace"}function hR(e,t,r,n){var s;const i={};if(r)for(const o of r){const l=o;if(l.type==="adhdev-daemon"||l.daemonMode){const a=l.machine||{},c=l.machineNickname,d=a.hostname||((s=l.system)==null?void 0:s.hostname)||"",u=c||(d&&d!=="Unknown"?d.replace(/\.local$/,""):null)||`Machine ${(l.id||"").substring(0,6)}`;i[l.id]=u}}return e.flatMap(o=>{var b,g,v,y,k;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((b=o.id)==null?void 0:b.split(":")[0])||o.id,d=n?n[c]||"new":void 0,u=uR(o),f=Mr(o.type),p=o.agentStreams,m=Array.isArray(p)?p.map(L=>({...L,activeModal:L.activeModal??void 0})):[],_=cR(o);if(_){const L=Ed(o.type),S=(g=o.agents)==null?void 0:g[0],j=(v=o.activeChat)==null?void 0:v.activeModal,T=j&&Array.isArray(j.buttons)&&j.buttons.length>0,B=(y=o.activeChat)==null?void 0:y.status,E=B==="generating"||B==="loading"||B&&B.toLowerCase()==="thinking",R=T||B==="waiting_approval"?"waiting_approval":E?"working":(S==null?void 0:S.status)||"idle",C=o.activeChat||{title:"",messages:[]};let P=C.title&&String(C.title).trim()?String(C.title).trim():"";const z=(k=o.activeChat)==null?void 0:k.id,A=o.chats;if(z&&Array.isArray(A)&&A.length>0){const Z=A.find(oe=>oe.id===z||oe.id&&String(oe.id)===String(z));Z!=null&&Z.title&&String(Z.title).trim()&&(P=String(Z.title).trim())}const U=C.messages||[],D=t[o.id]||[],V=new Map;U.filter(Z=>Z.role==="user").forEach(Z=>{V.set(Z.content,(V.get(Z.content)||0)+1)});const w=D.filter(Z=>{const oe=V.get(Z.content)||0;return oe>0?(V.set(Z.content,oe-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L,agentType:ii(o)||ln(o)?o.type:(S==null?void 0:S.type)||"ide-native",status:R,title:P,messages:[...U,...w],ideType:o.type,workspaceName:u,displayPrimary:P||u,displaySecondary:f,cdpConnected:o.cdpConnected,modalButtons:T?j.buttons:void 0,modalMessage:T?j.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,connectionState:d})}if(_&&(ii(o)||ln(o)))return l;for(const L of m){const S=L.activeModal&&Array.isArray(L.activeModal.buttons)&&L.activeModal.buttons.length>0,j=S?"waiting_approval":L.status==="streaming"?"working":L.status,T=`${o.id}:${L.agentType}`,B=L.messages||[],E=t[T]||[],O=new Map;B.filter(C=>C.role==="user").forEach(C=>{O.set(C.content,(O.get(C.content)||0)+1)});const R=E.filter(C=>{const P=O.get(C.content)||0;return P>0?(O.set(C.content,P-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L.agentName,agentType:L.agentType,status:j,title:"",messages:[...B,...R],ideType:o.type,workspaceName:u,displayPrimary:u,displaySecondary:`${f}·${L.agentName}`,cdpConnected:o.cdpConnected,modalButtons:S?L.activeModal.buttons:void 0,modalMessage:S?L.activeModal.message:void 0,streamSource:"agent-stream",tabKey:T,machineName:a,connectionState:d})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:Ed(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:u,displayPrimary:u,displaySecondary:f,cdpConnected:o.cdpConnected,streamSource:"native",tabKey:o.id,connectionState:d}),l})}function dR(e,t){var l,a,c,d;const r=[],{daemonId:n,existingDaemon:i,timestamp:s}=t,o=s||e.timestamp||Date.now();r.push({...i||{},id:n,type:"adhdev-daemon",status:"online",daemonMode:!0,timestamp:o,...e.version&&{version:e.version},...e.machine&&{machine:e.machine,platform:e.machine.platform},...e.instanceId&&{instanceId:e.instanceId},...e.machineNickname!==void 0&&{machineNickname:e.machineNickname},...e.p2p&&{p2p:e.p2p},..."system"in e&&{system:e.system},..."hostname"in e&&{hostname:e.hostname},...e.workspaces&&{workspaces:e.workspaces},...e.defaultWorkspaceId!==void 0&&{defaultWorkspaceId:e.defaultWorkspaceId},...e.defaultWorkspacePath!==void 0&&{defaultWorkspacePath:e.defaultWorkspacePath},...e.workspaceActivity&&{workspaceActivity:e.workspaceActivity},...e.detectedIdes&&{detectedIdes:e.detectedIdes},..."availableProviders"in e&&{availableProviders:e.availableProviders},cdpConnected:e.managedIdes.some(u=>u.cdpConnected),managedIdeIds:e.managedIdes.map(u=>`${n}:ide:${u.instanceId}`),managedCliIds:e.managedClis.map(u=>u.id?`${n}:cli:${u.id}`:`${n}:cli:${u.cliType}`),managedAcpIds:e.managedAcps.map(u=>u.id?`${n}:acp:${u.id}`:`${n}:acp:${u.acpType}`)});for(const u of e.managedIdes)r.push({id:`${n}:ide:${u.instanceId}`,type:u.ideType,ideType:u.ideType,version:u.ideVersion,status:u.cdpConnected?"online":"detected",daemonId:n,instanceId:u.instanceId,workspace:u.workspace,terminals:u.terminals,agents:u.aiAgents,activeChat:u.activeChat,chats:u.chats,agentStreams:u.agentStreams,cdpConnected:u.cdpConnected,currentModel:u.currentModel,currentPlan:u.currentPlan,currentAutoApprove:u.currentAutoApprove,timestamp:o});for(const u of e.managedClis){const f=u.id?`${n}:cli:${u.id}`:`${n}:cli:${u.cliType}`;r.push({id:f,type:u.cliType,ideType:u.cliType,agentType:u.cliType,status:u.status||"running",daemonId:n,instanceId:u.id,cliName:u.cliName,mode:u.mode||"terminal",workspace:u.workspace,activeChat:u.activeChat,agentStreams:[{agentType:u.cliType,agentName:u.cliName,extensionId:"cli-agent",status:u.status==="generating"?"streaming":u.status==="waiting_approval"?"waiting_approval":"idle",messages:((l=u.activeChat)==null?void 0:l.messages)||[],inputContent:"",activeModal:(a=u.activeChat)==null?void 0:a.activeModal}],timestamp:o,_isCli:!0})}for(const u of e.managedAcps){const f=u.id?`${n}:acp:${u.id}`:`${n}:acp:${u.acpType}`;r.push({id:f,type:u.acpType,ideType:u.acpType,agentType:u.acpType,status:u.status||"running",daemonId:n,instanceId:u.id,cliName:u.acpName,mode:"chat",workspace:u.workspace,activeChat:u.activeChat,currentModel:u.currentModel,currentPlan:u.currentPlan,acpConfigOptions:u.acpConfigOptions,acpModes:u.acpModes,agentStreams:[{agentType:u.acpType,agentName:u.acpName,extensionId:"acp-agent",status:u.status==="generating"?"streaming":u.status==="waiting_approval"?"waiting_approval":"idle",messages:((c=u.activeChat)==null?void 0:c.messages)||[],inputContent:"",activeModal:(d=u.activeChat)==null?void 0:d.activeModal}],timestamp:o,_isAcp:!0})}return r}function b1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=b1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function fR(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=b1(e))&&(n&&(n+=" "),n+=t);return n}const pR=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},mR=(e,t)=>({classGroupId:e,validator:t}),S1=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Ya="-",S_=[],gR="arbitrary..",_R=e=>{const t=xR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return vR(o);const l=o.split(Ya),a=l[0]===""&&l.length>1?1:0;return k1(l,a,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const a=n[o],c=r[o];return a?c?pR(c,a):a:c||S_}return r[o]||S_}}},k1=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],s=r.nextPart.get(i);if(s){const c=k1(e,t+1,s);if(c)return c}const o=r.validators;if(o===null)return;const l=t===0?e.join(Ya):e.slice(t).join(Ya),a=o.length;for(let c=0;c<a;c++){const d=o[c];if(d.validator(l))return d.classGroupId}},vR=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?gR+n:void 0})(),xR=e=>{const{theme:t,classGroups:r}=e;return yR(r,t)},yR=(e,t)=>{const r=S1();for(const n in e){const i=e[n];tp(i,r,n,t)}return r},tp=(e,t,r,n)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];wR(o,t,r,n)}},wR=(e,t,r,n)=>{if(typeof e=="string"){bR(e,t,r);return}if(typeof e=="function"){SR(e,t,r,n);return}kR(e,t,r,n)},bR=(e,t,r)=>{const n=e===""?t:C1(t,e);n.classGroupId=r},SR=(e,t,r,n)=>{if(CR(e)){tp(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(mR(r,e))},kR=(e,t,r,n)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,a]=i[o];tp(a,C1(t,l),r,n)}},C1=(e,t)=>{let r=e;const n=t.split(Ya),i=n.length;for(let s=0;s<i;s++){const o=n[s];let l=r.nextPart.get(o);l||(l=S1(),r.nextPart.set(o,l)),r=l}return r},CR=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ER=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},Nd="!",k_=":",NR=[],C_=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),TR=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=i=>{const s=[];let o=0,l=0,a=0,c;const d=i.length;for(let _=0;_<d;_++){const b=i[_];if(o===0&&l===0){if(b===k_){s.push(i.slice(a,_)),a=_+1;continue}if(b==="/"){c=_;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const u=s.length===0?i:i.slice(a);let f=u,p=!1;u.endsWith(Nd)?(f=u.slice(0,-1),p=!0):u.startsWith(Nd)&&(f=u.slice(1),p=!0);const m=c&&c>a?c-a:void 0;return C_(s,p,f,m)};if(t){const i=t+k_,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):C_(NR,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},PR=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],l=o[0]==="[",a=t.has(o);l||a?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},LR=e=>({cache:ER(e.cacheSize),parseClassName:TR(e),sortModifiers:PR(e),..._R(e)}),RR=/\s+/,MR=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(RR);let a="";for(let c=l.length-1;c>=0;c-=1){const d=l[c],{isExternal:u,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:_}=r(d);if(u){a=d+(a.length>0?" "+a:a);continue}let b=!!_,g=n(b?m.substring(0,_):m);if(!g){if(!b){a=d+(a.length>0?" "+a:a);continue}if(g=n(m),!g){a=d+(a.length>0?" "+a:a);continue}b=!1}const v=f.length===0?"":f.length===1?f[0]:s(f).join(":"),y=p?v+Nd:v,k=y+g;if(o.indexOf(k)>-1)continue;o.push(k);const L=i(g,b);for(let S=0;S<L.length;++S){const j=L[S];o.push(y+j)}a=d+(a.length>0?" "+a:a)}return a},IR=(...e)=>{let t=0,r,n,i="";for(;t<e.length;)(r=e[t++])&&(n=E1(r))&&(i&&(i+=" "),i+=n);return i},E1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=E1(e[n]))&&(r&&(r+=" "),r+=t);return r},DR=(e,...t)=>{let r,n,i,s;const o=a=>{const c=t.reduce((d,u)=>u(d),e());return r=LR(c),n=r.cache.get,i=r.cache.set,s=l,l(a)},l=a=>{const c=n(a);if(c)return c;const d=MR(a,r);return i(a,d),d};return s=o,(...a)=>s(IR(...a))},jR=[],Et=e=>{const t=r=>r[e]||jR;return t.isThemeGetter=!0,t},N1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,T1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,AR=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,BR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,OR=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,zR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$R=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,FR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,An=e=>AR.test(e),De=e=>!!e&&!Number.isNaN(Number(e)),Bn=e=>!!e&&Number.isInteger(Number(e)),Ru=e=>e.endsWith("%")&&De(e.slice(0,-1)),hn=e=>BR.test(e),P1=()=>!0,WR=e=>OR.test(e)&&!zR.test(e),rp=()=>!1,HR=e=>$R.test(e),UR=e=>FR.test(e),VR=e=>!fe(e)&&!pe(e),KR=e=>hi(e,M1,rp),fe=e=>N1.test(e),pi=e=>hi(e,I1,WR),E_=e=>hi(e,eM,De),qR=e=>hi(e,j1,P1),YR=e=>hi(e,D1,rp),N_=e=>hi(e,L1,rp),XR=e=>hi(e,R1,UR),zl=e=>hi(e,A1,HR),pe=e=>T1.test(e),Js=e=>Hi(e,I1),GR=e=>Hi(e,D1),T_=e=>Hi(e,L1),QR=e=>Hi(e,M1),JR=e=>Hi(e,R1),$l=e=>Hi(e,A1,!0),ZR=e=>Hi(e,j1,!0),hi=(e,t,r)=>{const n=N1.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Hi=(e,t,r=!1)=>{const n=T1.exec(e);return n?n[1]?t(n[1]):r:!1},L1=e=>e==="position"||e==="percentage",R1=e=>e==="image"||e==="url",M1=e=>e==="length"||e==="size"||e==="bg-size",I1=e=>e==="length",eM=e=>e==="number",D1=e=>e==="family-name",j1=e=>e==="number"||e==="weight",A1=e=>e==="shadow",tM=()=>{const e=Et("color"),t=Et("font"),r=Et("text"),n=Et("font-weight"),i=Et("tracking"),s=Et("leading"),o=Et("breakpoint"),l=Et("container"),a=Et("spacing"),c=Et("radius"),d=Et("shadow"),u=Et("inset-shadow"),f=Et("text-shadow"),p=Et("drop-shadow"),m=Et("blur"),_=Et("perspective"),b=Et("aspect"),g=Et("ease"),v=Et("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...k(),pe,fe],S=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],T=()=>[pe,fe,a],B=()=>[An,"full","auto",...T()],E=()=>[Bn,"none","subgrid",pe,fe],O=()=>["auto",{span:["full",Bn,pe,fe]},Bn,pe,fe],R=()=>[Bn,"auto",pe,fe],C=()=>["auto","min","max","fr",pe,fe],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...T()],U=()=>[An,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],D=()=>[An,"screen","full","dvw","lvw","svw","min","max","fit",...T()],V=()=>[An,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],w=()=>[e,pe,fe],Z=()=>[...k(),T_,N_,{position:[pe,fe]}],oe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",QR,KR,{size:[pe,fe]}],q=()=>[Ru,Js,pi],I=()=>["","none","full",c,pe,fe],$=()=>["",De,Js,pi],Y=()=>["solid","dashed","dotted","double"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[De,Ru,T_,N_],Ce=()=>["","none",m,pe,fe],ke=()=>["none",De,pe,fe],Ke=()=>["none",De,pe,fe],ue=()=>[De,pe,fe],ve=()=>[An,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hn],breakpoint:[hn],color:[P1],container:[hn],"drop-shadow":[hn],ease:["in","out","in-out"],font:[VR],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hn],shadow:[hn],spacing:["px",De],text:[hn],"text-shadow":[hn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",An,fe,pe,b]}],container:["container"],columns:[{columns:[De,fe,pe,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:B()}],"inset-x":[{"inset-x":B()}],"inset-y":[{"inset-y":B()}],start:[{"inset-s":B(),start:B()}],end:[{"inset-e":B(),end:B()}],"inset-bs":[{"inset-bs":B()}],"inset-be":[{"inset-be":B()}],top:[{top:B()}],right:[{right:B()}],bottom:[{bottom:B()}],left:[{left:B()}],visibility:["visible","invisible","collapse"],z:[{z:[Bn,"auto",pe,fe]}],basis:[{basis:[An,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[De,An,"auto","initial","none",fe]}],grow:[{grow:["",De,pe,fe]}],shrink:[{shrink:["",De,pe,fe]}],order:[{order:[Bn,"first","last","none",pe,fe]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":C()}],"auto-rows":[{"auto-rows":C()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...D()]}],"min-inline-size":[{"min-inline":["auto",...D()]}],"max-inline-size":[{"max-inline":["none",...D()]}],"block-size":[{block:["auto",...V()]}],"min-block-size":[{"min-block":["auto",...V()]}],"max-block-size":[{"max-block":["none",...V()]}],w:[{w:[l,"screen",...U()]}],"min-w":[{"min-w":[l,"screen","none",...U()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,Js,pi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,ZR,qR]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ru,fe]}],"font-family":[{font:[GR,YR,t]}],"font-features":[{"font-features":[fe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,pe,fe]}],"line-clamp":[{"line-clamp":[De,"none",pe,E_]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",pe,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",pe,fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:w()}],"text-color":[{text:w()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[De,"from-font","auto",pe,pi]}],"text-decoration-color":[{decoration:w()}],"underline-offset":[{"underline-offset":[De,"auto",pe,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pe,fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",pe,fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:oe()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Bn,pe,fe],radial:["",pe,fe],conic:[Bn,pe,fe]},JR,XR]}],"bg-color":[{bg:w()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:w()}],"gradient-via":[{via:w()}],"gradient-to":[{to:w()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-bs":[{"border-bs":$()}],"border-w-be":[{"border-be":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:w()}],"border-color-x":[{"border-x":w()}],"border-color-y":[{"border-y":w()}],"border-color-s":[{"border-s":w()}],"border-color-e":[{"border-e":w()}],"border-color-bs":[{"border-bs":w()}],"border-color-be":[{"border-be":w()}],"border-color-t":[{"border-t":w()}],"border-color-r":[{"border-r":w()}],"border-color-b":[{"border-b":w()}],"border-color-l":[{"border-l":w()}],"divide-color":[{divide:w()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[De,pe,fe]}],"outline-w":[{outline:["",De,Js,pi]}],"outline-color":[{outline:w()}],shadow:[{shadow:["","none",d,$l,zl]}],"shadow-color":[{shadow:w()}],"inset-shadow":[{"inset-shadow":["none",u,$l,zl]}],"inset-shadow-color":[{"inset-shadow":w()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:w()}],"ring-offset-w":[{"ring-offset":[De,pi]}],"ring-offset-color":[{"ring-offset":w()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":w()}],"text-shadow":[{"text-shadow":["none",f,$l,zl]}],"text-shadow-color":[{"text-shadow":w()}],opacity:[{opacity:[De,pe,fe]}],"mix-blend":[{"mix-blend":[...he(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":he()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[De]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":w()}],"mask-image-linear-to-color":[{"mask-linear-to":w()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":w()}],"mask-image-t-to-color":[{"mask-t-to":w()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":w()}],"mask-image-r-to-color":[{"mask-r-to":w()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":w()}],"mask-image-b-to-color":[{"mask-b-to":w()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":w()}],"mask-image-l-to-color":[{"mask-l-to":w()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":w()}],"mask-image-x-to-color":[{"mask-x-to":w()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":w()}],"mask-image-y-to-color":[{"mask-y-to":w()}],"mask-image-radial":[{"mask-radial":[pe,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":w()}],"mask-image-radial-to-color":[{"mask-radial-to":w()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[De]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":w()}],"mask-image-conic-to-color":[{"mask-conic-to":w()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:oe()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",pe,fe]}],filter:[{filter:["","none",pe,fe]}],blur:[{blur:Ce()}],brightness:[{brightness:[De,pe,fe]}],contrast:[{contrast:[De,pe,fe]}],"drop-shadow":[{"drop-shadow":["","none",p,$l,zl]}],"drop-shadow-color":[{"drop-shadow":w()}],grayscale:[{grayscale:["",De,pe,fe]}],"hue-rotate":[{"hue-rotate":[De,pe,fe]}],invert:[{invert:["",De,pe,fe]}],saturate:[{saturate:[De,pe,fe]}],sepia:[{sepia:["",De,pe,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",pe,fe]}],"backdrop-blur":[{"backdrop-blur":Ce()}],"backdrop-brightness":[{"backdrop-brightness":[De,pe,fe]}],"backdrop-contrast":[{"backdrop-contrast":[De,pe,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",De,pe,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[De,pe,fe]}],"backdrop-invert":[{"backdrop-invert":["",De,pe,fe]}],"backdrop-opacity":[{"backdrop-opacity":[De,pe,fe]}],"backdrop-saturate":[{"backdrop-saturate":[De,pe,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",De,pe,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",pe,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[De,"initial",pe,fe]}],ease:[{ease:["linear","initial",g,pe,fe]}],delay:[{delay:[De,pe,fe]}],animate:[{animate:["none",v,pe,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,pe,fe]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:Ke()}],"scale-x":[{"scale-x":Ke()}],"scale-y":[{"scale-y":Ke()}],"scale-z":[{"scale-z":Ke()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[pe,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:w()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:w()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",pe,fe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",pe,fe]}],fill:[{fill:["none",...w()]}],"stroke-w":[{stroke:[De,Js,pi,E_]}],stroke:[{stroke:["none",...w()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},rM=DR(tM);function Xo(...e){return rM(fR(e))}function nM({icon:e,title:t,subtitle:r,badge:n,actions:i,className:s}){return h.jsxs("div",{className:Xo("flex items-center justify-between px-6 py-4 border-b border-border-subtle bg-surface-primary animate-[fadeIn_0.3s_ease-out_forwards]",s),children:[h.jsxs("div",{children:[h.jsxs("h1",{className:"text-lg font-bold text-text-primary flex items-center gap-2.5 tracking-tight",children:[h.jsx("span",{children:e})," ",t,n&&h.jsxs("span",{className:"text-xs font-semibold px-2 py-0.5 rounded-full bg-accent/10 text-accent-light",children:[n.count!==void 0?n.count:""," ",n.text]})]}),h.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),i&&h.jsx("div",{className:"flex gap-2",children:i})]})}function Zs({title:e,icon:t,description:r,accentColor:n,className:i,children:s}){return h.jsxs("div",{className:Xo("bg-bg-card border border-border-subtle rounded-2xl p-5 backdrop-blur-xl transition-all","hover:border-border-default hover:shadow-glow",n&&"border-l-[3px]",i),style:n?{borderLeftColor:n}:void 0,children:[(e||r)&&h.jsxs("div",{className:"mb-4",children:[e&&h.jsxs("h3",{className:"text-base font-semibold text-text-primary",children:[t&&h.jsx("span",{className:"mr-1.5",children:t}),e]}),r&&h.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),s]})}function iM({icon:e,title:t,description:r,action:n,className:i}){return h.jsxs("div",{className:Xo("py-16 px-5 text-center bg-bg-glass border-2 border-dashed border-border-subtle rounded-2xl",i),children:[h.jsx("div",{className:"text-5xl mb-4 opacity-50",children:e}),h.jsx("h3",{className:"text-lg font-bold text-text-secondary mb-2",children:t}),h.jsx("p",{className:"text-sm text-text-muted max-w-sm mx-auto mb-5 leading-relaxed",children:r}),n]})}const sM={online:"bg-green-500/10 text-green-400 border-green-500/30",idle:"bg-yellow-500/10 text-yellow-400 border-yellow-500/30",busy:"bg-orange-500/10 text-orange-400 border-orange-500/30",error:"bg-red-500/10 text-red-400 border-red-500/30",offline:"bg-gray-500/10 text-text-secondary border-gray-500/30"},oM={online:"bg-green-500",idle:"bg-yellow-500",busy:"bg-orange-500",error:"bg-red-500",offline:"bg-gray-500"};function lM({status:e,label:t,className:r}){const n=t||e;return h.jsxs("span",{className:Xo("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",sM[e],r),children:[h.jsx("span",{className:Xo("w-2 h-2 rounded-full animate-[pulse-dot_2s_ease-in-out_infinite]",oM[e])}),n]})}function aM(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function P_(){try{const e=localStorage.getItem("theme");if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function Mu(e){return e==="system"?aM():e}function cM(){const[e,t]=x.useState(P_),[r,n]=x.useState(()=>Mu(P_()));x.useEffect(()=>{document.documentElement.setAttribute("data-theme",r)},[r]),x.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: light)"),l=a=>{e==="system"&&n(a.matches?"light":"dark")};return o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[e]);const i=x.useCallback(o=>{t(o),n(Mu(o));try{localStorage.setItem("theme",o)}catch{}},[]),s=x.useCallback(()=>{t(o=>{const l=o==="dark"?"light":o==="light"?"system":"dark";n(Mu(l));try{localStorage.setItem("theme",l)}catch{}return l})},[]);return{theme:r,preference:e,setPreference:i,cycleTheme:s,isDark:r==="dark"}}const L_={dark:"Dark",light:"Light",system:"System"};function uM({collapsed:e}){const{preference:t,cycleTheme:r}=cM(),n=t==="dark"?h.jsx(RP,{size:16}):t==="light"?h.jsx(LP,{size:16}):h.jsx(MP,{size:16});return h.jsxs("div",{className:`nav-item cursor-pointer ${e?"justify-center py-2.5 px-0":""}`,onClick:r,title:`Theme: ${L_[t]} (click to cycle)`,children:[h.jsx("span",{className:"nav-icon",children:n}),!e&&h.jsx("span",{className:"text-xs",children:L_[t]})]})}function Xi({label:e,description:t,checked:r,disabled:n,onChange:i,extra:s}){return h.jsxs("label",{className:"flex justify-between items-center cursor-pointer",children:[h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:e}),h.jsx("div",{className:"text-[11px] text-text-muted",children:t})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[s,h.jsx("input",{type:"checkbox",checked:r,disabled:n,onChange:o=>i(o.target.checked),className:"w-5 h-5 accent-accent"})]})]})}const B1="adhdev_notification_prefs",R_={globalEnabled:!0,disconnectAlert:!0,browserNotifications:!0,completionAlert:!0,approvalAlert:!0};function hM(){try{const e=localStorage.getItem(B1);if(e){const t=JSON.parse(e);return{...R_,...t}}}catch{}return{...R_}}function dM(e){try{localStorage.setItem(B1,JSON.stringify(e))}catch{}}let gn=hM(),ca=[];function fM(){ca.forEach(e=>e())}function pM(e){gn={...gn,...e},dM(gn),fM()}function mM(){const[,e]=x.useState(0);x.useEffect(()=>{const r=()=>e(n=>n+1);return ca.push(r),()=>{ca=ca.filter(n=>n!==r)}},[]);const t=x.useCallback(r=>{pM(r)},[]);return[{...gn},t]}function Iu(e){if(!gn.globalEnabled)return!1;switch(e){case"disconnect":return gn.disconnectAlert;case"completion":return gn.completionAlert;case"approval":return gn.approvalAlert;case"browser":return gn.browserNotifications;default:return!0}}function gM({onPrefChange:e}){const[t,r]=mM(),n=(i,s)=>{r({[i]:s}),e==null||e(i,s)};return h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsx(Xi,{label:"🔔 Notifications",description:"Master toggle for all alerts",checked:t.globalEnabled,onChange:i=>n("globalEnabled",i)}),t.globalEnabled&&h.jsx("div",{className:"border-t border-border-subtle my-0.5"}),t.globalEnabled&&h.jsx(Xi,{label:"🖥️ Browser Notifications",description:"Desktop alerts when tab is inactive",checked:t.browserNotifications,onChange:i=>n("browserNotifications",i)}),t.globalEnabled&&t.browserNotifications&&h.jsxs("div",{className:"ml-5 pl-3 border-l-2 border-border-subtle flex flex-col gap-2",children:[h.jsx(Xi,{label:"✅ Completion Alerts",description:"Notify when agent finishes a task",checked:t.completionAlert,onChange:i=>n("completionAlert",i)}),h.jsx(Xi,{label:"⚡ Approval Alerts",description:"Notify when agent needs approval",checked:t.approvalAlert,onChange:i=>n("approvalAlert",i)}),h.jsx(Xi,{label:"📡 Connection Alerts",description:"Alert when a daemon disconnects",checked:t.disconnectAlert,onChange:i=>n("disconnectAlert",i)})]}),!t.globalEnabled&&h.jsx("p",{className:"text-[11px] text-text-muted italic",children:"All notifications are disabled. Enable the master toggle to configure individual alerts."})]})}function _M({ides:e,emptyMessage:t,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i}){const s=e.filter(o=>o.type==="adhdev-daemon");return s.length===0?h.jsx(iM,{icon:"🔌",title:"No machines connected",description:t||"Run 'adhdev daemon' on your machine to connect."}):h.jsx("div",{className:"flex flex-col gap-2",children:s.map(o=>h.jsx(vM,{ide:o,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i},o.id))})}function M_({title:e,message:t,confirmLabel:r,confirmColor:n,onConfirm:i,onCancel:s}){const o=n==="red"?"bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30 hover:bg-amber-500/30";return ex.createPortal(h.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",style:{zIndex:9999},onClick:s,children:h.jsxs("div",{className:"bg-bg-primary border border-border-subtle rounded-xl p-5 max-w-sm w-full mx-4 shadow-2xl",onClick:l=>l.stopPropagation(),children:[h.jsx("div",{className:"font-semibold text-sm mb-3",children:e}),h.jsx("div",{className:"text-xs text-text-muted leading-relaxed mb-5 whitespace-pre-line",children:t}),h.jsxs("div",{className:"flex gap-2 justify-end",children:[h.jsx("button",{onClick:s,className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-bg-secondary text-text-secondary border border-border-subtle hover:bg-bg-glass transition-colors",children:"Cancel"}),h.jsx("button",{onClick:i,className:`text-xs px-3 py-1.5 rounded-lg font-medium border transition-colors ${o}`,children:r})]})]})}),document.body)}function vM({ide:e,sendDaemonCommand:t,onDisconnect:r,onRevokeToken:n}){var B,E,O,R;const[i,s]=x.useState("idle"),[o,l]=x.useState(""),[a,c]=x.useState(null),[d,u]=x.useState("idle"),[f,p]=x.useState(""),m=e,_=m.version||m.daemonVersion||null,b=((B=m.machine)==null?void 0:B.hostname)||((E=m.system)==null?void 0:E.hostname)||"",g=((O=m.machine)==null?void 0:O.platform)||((R=m.system)==null?void 0:R.platform)||"",v=m.machineNickname||(b==null?void 0:b.replace(/\.local$/,""))||"Machine",y=g==="win32"?"🪟":g==="darwin"?"🍎":"🐧",k=async()=>{var C,P,z;if(t){s("upgrading"),l("Installing latest version...");try{const A=await t(e.id,"daemon_upgrade",{});(C=A==null?void 0:A.result)!=null&&C.upgraded||(P=A==null?void 0:A.result)!=null&&P.success?(s("done"),l(`Upgraded to v${A.result.version||"latest"}. Daemon is restarting...`)):(s("error"),l(((z=A==null?void 0:A.result)==null?void 0:z.error)||"Upgrade failed"))}catch(A){s("error"),l((A==null?void 0:A.message)||"Connection lost during upgrade")}}},L=async()=>{if(c(null),!!r){u("loading");try{await r(e.id),u("done"),p("Machine disconnected.")}catch(C){u("error"),p((C==null?void 0:C.message)||"Failed to disconnect")}}},S=async()=>{if(c(null),!!n){u("loading");try{await n(e.id),u("done"),p('Token revoked. Machine must run "adhdev setup" to reconnect.')}catch(C){u("error"),p((C==null?void 0:C.message)||"Failed to revoke token")}}},j="0.5.41",T=!_||_!==j;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"bg-bg-glass rounded-lg px-4 py-3 border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("span",{className:"text-xl",children:y}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:v}),h.jsxs("div",{className:"text-xs text-text-muted font-mono flex items-center gap-2",children:[h.jsxs("span",{children:[e.id.substring(0,12),"…"]}),_&&h.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${T?"bg-amber-500/15 text-amber-400":"bg-bg-secondary"}`,children:["v",_,!T&&" ✓"]})]})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[t&&T&&h.jsx("button",{onClick:k,disabled:i==="upgrading"||i==="done",className:`text-xs px-2.5 py-1 rounded-md font-medium transition-all
173
+ disabled:opacity-50 disabled:cursor-not-allowed
174
+ bg-accent-primary/10 text-accent-primary hover:bg-accent-primary/20`,title:`Update to v${j}`,children:i==="upgrading"?h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"animate-spin",children:"⟳"})," Upgrading..."]}):i==="done"?"✓ Updated":`↑ Update${` to v${j}`}`}),r&&h.jsx("button",{onClick:()=>c("disconnect"),disabled:d==="loading",className:`text-xs px-2 py-1 rounded-md font-medium transition-all
175
+ bg-amber-500/10 text-amber-400 hover:bg-amber-500/20
176
+ disabled:opacity-50 disabled:cursor-not-allowed`,title:"Disconnect this machine",children:"Disconnect"}),n&&h.jsx("button",{onClick:()=>c("revoke"),disabled:d==="loading",className:`text-xs px-2 py-1 rounded-md font-medium transition-all
177
+ bg-red-500/10 text-red-400 hover:bg-red-500/20
178
+ disabled:opacity-50 disabled:cursor-not-allowed`,title:"Revoke token (requires re-setup)",children:"Revoke"}),h.jsx(lM,{status:e.status==="online"?"online":"error"})]})]}),(o||f)&&h.jsx("div",{className:`text-xs mt-2 px-1 ${i==="error"||d==="error"?"text-red-400":i==="done"||d==="done"?"text-green-400":"text-text-muted"}`,children:f||o})]}),a==="disconnect"&&h.jsx(M_,{title:"🔌 Disconnect Machine",message:`Disconnect "${v}" from ADHDev?
179
+
180
+ This will close the server connection. The daemon process will continue running on the machine and will automatically reconnect.
181
+
182
+ Use this if you want to temporarily stop remote control.`,confirmLabel:"Disconnect",confirmColor:"amber",onConfirm:L,onCancel:()=>c(null)}),a==="revoke"&&h.jsx(M_,{title:"⚠️ Revoke Connection Token",message:`Revoke the token for "${v}"?
183
+
184
+ This will:
185
+ • Immediately disconnect the machine
186
+ • Invalidate the connection token
187
+ • Require running "adhdev setup" again on that machine
188
+
189
+ Use this if you accidentally set up on a shared/public computer and want to ensure it can never reconnect.`,confirmLabel:"Revoke Token",confirmColor:"red",onConfirm:S,onCancel:()=>c(null)})]})}const xM={enabled:!0,onApproval:!0,onComplete:!0,onError:!0,throttleMs:5e3};async function yM(){return"Notification"in window?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"}function O1(){return"Notification"in window&&Notification.permission==="granted"}let mi=null;async function wM(){if(mi!==null)return mi;try{if(!("serviceWorker"in navigator)||!("PushManager"in window))return mi=!1,!1;const e=await navigator.serviceWorker.getRegistration();return e?(mi=!!await e.pushManager.getSubscription(),mi):(mi=!1,!1)}catch{return mi=!1,!1}}function bM(e,t,r){if(O1())try{const n=new Notification(e,{body:t,icon:"/otter-logo.png",tag:r||`adhdev-${Date.now()}`,silent:!1});setTimeout(()=>n.close(),8e3),n.onclick=()=>{window.focus(),n.close()}}catch{}}function SM(e,t={}){const r={...xM,...t},n=x.useRef(new Map),i=x.useRef(0),s=x.useRef(null);x.useEffect(()=>{wM().then(l=>{s.current=l})},[]);const o=x.useCallback((l,a,c)=>{const d=Date.now();d-i.current<r.throttleMs||(i.current=d,bM(l,a,c))},[r.throttleMs]);x.useEffect(()=>{var l;if(!(!r.enabled||!O1())&&Iu("browser")&&s.current!==!0){if(document.hasFocus()){for(const a of e)n.current.set(a.id,a.status||"idle");return}for(const a of e){const c=n.current.get(a.id),d=a.status||"idle",u=a.name||a.id;if(r.onApproval&&Iu("approval")&&d==="waiting_approval"&&c!=="waiting_approval"){const f=((l=a.activeModal)==null?void 0:l.message)||"Action requires your approval";o(`🔔 ${u} — Approval needed`,f.slice(0,120),`approval-${a.id}`)}r.onComplete&&Iu("completion")&&c==="generating"&&d==="idle"&&o(`✅ ${u} — Task complete`,"Agent has finished working",`complete-${a.id}`),r.onError&&d==="error"&&c!=="error"&&o(`⚠️ ${u} — Error`,"Agent encountered an error",`error-${a.id}`),n.current.set(a.id,d)}}},[e,r.enabled,r.onApproval,r.onComplete,r.onError,o])}const z1="adhdev_hiddenTabs";function kM(){try{const e=localStorage.getItem(z1);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function eo(e){try{localStorage.setItem(z1,JSON.stringify([...e]))}catch{}}function CM(){const[e,t]=x.useState(kM),r=x.useCallback(a=>{t(c=>{const d=new Set(c);return d.has(a)?d.delete(a):d.add(a),eo(d),d})},[]),n=x.useCallback(a=>{t(c=>{if(c.has(a))return c;const d=new Set(c);return d.add(a),eo(d),d})},[]),i=x.useCallback(a=>{t(c=>{if(!c.has(a))return c;const d=new Set(c);return d.delete(a),eo(d),d})},[]),s=x.useCallback((a,c)=>{t(d=>{const u=new Set(d);for(const f of c)u.add(f);return eo(u),u})},[]),o=x.useCallback((a,c)=>{t(d=>{const u=new Set(d);for(const f of c)u.delete(f);return eo(u),u})},[]),l=x.useCallback(a=>e.has(a),[e]);return{hiddenTabs:e,toggleTab:r,hideTab:n,showTab:i,hideAllForDaemon:s,showAllForDaemon:o,isHidden:l}}let EM=Ho;function np(){return EM()}class NM{constructor(){js(this,"listeners",new Map)}send(t){}isConnected(){return!1}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{var n;(n=this.listeners.get(t))==null||n.delete(r)}}emit(t,...r){var n;(n=this.listeners.get(t))==null||n.forEach(i=>i(...r))}}let TM=new NM;class PM{constructor(){js(this,"ptyCallbacks",new Set)}sendPtyInput(t,r,n){return!1}sendPtyResize(t,r,n,i){return!1}async requestChatHistory(t,r,n,i,s){return{messages:[],hasMore:!1}}retryConnection(t){}getState(t){return"disconnected"}sendData(t,r){return!1}get(t){}onScreenshot(t,r){return()=>{}}onStatusEvent(t){return()=>{}}onPtyOutput(t){return this.ptyCallbacks.add(t),()=>{this.ptyCallbacks.delete(t)}}emitPtyOutput(t,r){this.ptyCallbacks.forEach(n=>n(t,r))}}let vr=new PM,I_=vr;function $1({sendDaemonCommand:e,activeConv:t,ides:r,updateIdeChats:n,setToasts:i,setLocalUserMessages:s,setClearedTabs:o,setActionLogs:l,pinTab:a,isStandalone:c}){const[d,u]=x.useState(""),[f,p]=x.useState(!1),[m,_]=x.useState(!1),[b,g]=x.useState(!1),v=x.useCallback(async()=>{if(!t)return;const E=d.trim();if(!E)return;const O=t.ideId,R=t.tabKey;u(""),a(R,[100,500,1500,3e3]);const C=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,P={role:"user",content:E,timestamp:Date.now(),_localId:C};s(z=>({...z,[R]:[...z[R]||[],P]}));try{if(ii(t)&&!ln(t)){const z=O||t.daemonId||"";if(!z)return;const A=t.ideType||t.agentType||"";await e(z,"agent_command",{agentType:A,cliType:A,action:"send_chat",message:E,text:E})}else if(ln(t)){const z=O||t.daemonId||"";if(!z)return;await e(z,"send_chat",{message:E,text:E,agentType:t.agentType})}else{const z=O||t.daemonId||"";if(!z)return;await e(z,"send_chat",{message:E,text:E,...t.streamSource==="agent-stream"&&{agentType:t.agentType}})}setTimeout(()=>{const z=Date.now()-6e4;s(A=>{const U=A[R];if(!U)return A;const D=U.filter(V=>V.timestamp>z);return D.length===U.length?A:{...A,[R]:D}})},6e4)}catch(z){console.error("Send failed",z),u(E),s(A=>({...A,[R]:(A[R]||[]).filter(U=>U._localId!==C)}))}},[t,d,e,s,a]),y=x.useCallback(async()=>{if(t)try{c?await e(t.ideId,"launch_ide",{ideType:t.ideType,enableCdp:!0}):await e(t.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(E){console.error("Relaunch failed",E)}},[t,c,e]),k=x.useCallback(async E=>{try{await e("standalone","launch_ide",{ideType:E,enableCdp:!0})}catch(O){console.error("Launch failed",O)}},[e]),L=x.useCallback(async E=>{if(t){console.log("[ModalButton] ideId:",t.ideId,"button:",E),l(O=>[...O,{ideId:t.tabKey,text:`🖱️ **${E}** clicked`,timestamp:Date.now()}]);try{const R=(t.modalButtons||[]).indexOf(E),C=E.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),P=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(C),z=t.ideId||t.daemonId||"";(await e(z,"resolve_action",{button:E,action:P?"approve":"reject",...R>=0&&{buttonIndex:R},...t.streamSource==="agent-stream"&&{agentType:t.agentType}})).success||l(U=>[...U,{ideId:t.tabKey,text:`⚠️ **${E}** failed — button not found`,timestamp:Date.now()}])}catch(O){console.error("[ModalButton] Error:",O),l(R=>[...R,{ideId:t.tabKey,text:`❌ **${E}** error`,timestamp:Date.now()}])}}},[t,e,l]),S=x.useCallback(async(E,O)=>{try{const R=E||(t==null?void 0:t.daemonId)||"",C=await e(R,"switch_chat",{id:O,sessionId:O,...(t==null?void 0:t.streamSource)==="agent-stream"&&{agentType:t==null?void 0:t.agentType}}),P=C==null?void 0:C.result;(C==null?void 0:C.success)===!0||P==="switched"||P==="switched-by-title"||(P===!1||P==="not_found"?i(A=>[...A,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof P=="string"&&P.startsWith("error:")?i(A=>[...A,{id:Date.now(),message:`⚠️ Switch error: ${P}`,type:"warning",timestamp:Date.now()}]):i(A=>[...A,{id:Date.now(),message:"⚠️ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(R){console.error("Switch failed",R),i(C=>[...C,{id:Date.now(),message:`❌ Switch failed: ${R.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},[t,e,i]),j=x.useCallback(async()=>{if(!(!t||f)){p(!0);try{const E=t.ideId||t.daemonId||"";await e(E,"new_chat",{...t.streamSource==="agent-stream"&&{agentType:t.agentType}}),o(O=>({...O,[t.tabKey]:Date.now()})),s(O=>({...O,[t.tabKey]:[]}))}catch(E){console.error("New chat failed",E)}finally{p(!1)}}},[t,f,e,o,s]),T=x.useCallback(async()=>{if(!t||b)return;g(!0);const E=t.tabKey;try{await e(t.ideId,"agent_stream_focus",{agentType:t.agentType}),a(E,[200,1500,3e3])}catch(O){console.error("Focus agent failed",O)}finally{g(!1)}},[t,b,e,a]),B=x.useCallback(async()=>{var E;if(!(!t||m)){_(!0);try{const O=t.ideId||t.daemonId||"",R=await e(O,"list_chats",{forceExpand:!0,...t.streamSource==="agent-stream"&&{agentType:t.agentType}}),C=(R==null?void 0:R.chats)||((E=R==null?void 0:R.result)==null?void 0:E.chats);R!=null&&R.success&&Array.isArray(C)&&n(t.ideId,C)}catch(O){console.error("Refresh history failed",O)}finally{_(!1)}}},[t,m,e,n]);return{agentInput:d,setAgentInput:u,isCreatingChat:f,isRefreshingHistory:m,isFocusingAgent:b,handleSendChat:v,handleRelaunch:y,handleLaunchIde:k,handleModalButton:L,handleSwitchSession:S,handleNewChat:j,handleFocusAgent:T,handleRefreshHistory:B}}let Du=null;function LM({conversations:e,ides:t,messageReceivedAt:r,actionLogs:n,ptyBuffers:i,screenshotMap:s,setScreenshotMap:o,sendDaemonCommand:l,updateIdeChats:a,setToasts:c,setLocalUserMessages:d,setClearedTabs:u,setActionLogs:f,pinTab:p,isStandalone:m,userName:_,groupIndex:b,isFocused:g,onFocus:v,isSplitMode:y,numGroups:k,onMoveTab:L,onClose:S,onReceiveTab:j,style:T,detectedIdes:B,handleLaunchIde:E,onActiveTabChange:O,initialActiveTabId:R,initialTabOrder:C,onTabOrderChange:P,onHideTab:z}){const{sendCommand:A}=ci(),U=x.useRef(null),[D,V]=x.useState(!1),w=x.useRef(0),[Z,oe]=x.useState(R??null);x.useEffect(()=>{R&&R!==Z&&oe(R)},[R]);const[N,q]=x.useState(C??[]),[I,$]=x.useState(null),Y=x.useRef(null),he=x.useRef(null);x.useEffect(()=>{const J=new Set(e.map(xe=>xe.tabKey));q(xe=>{const Fe=xe.filter(Je=>J.has(Je)),We=e.filter(Je=>!xe.includes(Je.tabKey)).map(Je=>Je.tabKey),Pe=[...Fe,...We];return Pe.length===xe.length&&Pe.every((Je,Ae)=>Je===xe[Ae])?xe:Pe})},[e]);const me=I??N,Ce=x.useMemo(()=>{if(me.length===0)return e;const J=new Map(me.map((xe,Fe)=>[xe,Fe]));return[...e].sort((xe,Fe)=>{const We=J.get(xe.tabKey)??999,Pe=J.get(Fe.tabKey)??999;return We-Pe})},[e,me]);x.useEffect(()=>{if(Ce.length===0){oe(null),O==null||O(null);return}Z&&Ce.some(J=>J.tabKey===Z)||(oe(Ce[0].tabKey),O==null||O(Ce[0].tabKey))},[Ce,Z]);const ke=Ce.find(J=>J.tabKey===Z),Ke=x.useCallback((J,xe,Fe)=>{q(We=>{const Pe=We.filter(W=>W!==J),Je=Pe.indexOf(xe);if(Je<0)return We;const Ae=Fe==="left"?Je:Je+1;return Pe.splice(Ae,0,J),P==null||P(Pe),Pe}),$(null)},[P]),ue=x.useCallback((J,xe,Fe)=>{const Pe=(N.length>0?N:e.map(W=>W.tabKey)).filter(W=>W!==J),Je=Pe.indexOf(xe);if(Je<0)return;const Ae=Fe==="left"?Je:Je+1;Pe.splice(Ae,0,J),Y.current=Pe,$(Pe)},[N,e]),ve=$1({sendDaemonCommand:l,activeConv:ke,ides:t,updateIdeChats:a,setToasts:c,setLocalUserMessages:d,setClearedTabs:u,setActionLogs:f,pinTab:p,isStandalone:m}),[Q,ge]=x.useState(null);x.useEffect(()=>{if(!Q)return;const J=()=>ge(null);return window.addEventListener("click",J),()=>window.removeEventListener("click",J)},[Q]);const _e=ke&&ii(ke)&&!ln(ke);x.useEffect(()=>{const J=()=>{w.current=0,V(!1)};return window.addEventListener("dragend",J),window.addEventListener("drop",J),()=>{window.removeEventListener("dragend",J),window.removeEventListener("drop",J)}},[]);const Te=x.useRef(null);return x.useEffect(()=>{const J=Te.current;if(!J)return;const xe=Fe=>{Math.abs(Fe.deltaY)>Math.abs(Fe.deltaX)&&(Fe.preventDefault(),J.scrollLeft+=Fe.deltaY)};return J.addEventListener("wheel",xe,{passive:!1}),()=>J.removeEventListener("wheel",xe)},[]),h.jsxs("div",{className:"flex flex-col min-h-0 min-w-0 flex-1 overflow-hidden",onClick:v,onDragEnter:J=>{if(J.dataTransfer.types.includes("text/tab-key")){w.current++;const xe=Du;xe&&e.some(We=>We.tabKey===xe)||V(!0)}},onDragOver:J=>{J.dataTransfer.types.includes("text/tab-key")&&J.preventDefault()},onDragLeave:()=>{w.current--,w.current<=0&&(w.current=0,V(!1))},onDrop:J=>{w.current=0,V(!1),$(null);const xe=J.dataTransfer.getData("text/tab-key");if(!xe)return;J.preventDefault(),e.some(We=>We.tabKey===xe)?q(We=>{const Pe=We.filter(Je=>Je!==xe);return Pe.push(xe),P==null||P(Pe),Pe}):j&&j(xe)},style:{...T,outline:D?"2px dashed var(--accent-primary)":"none",outlineOffset:"-2px",transition:"outline 0.15s ease"},children:[h.jsx("div",{className:"flex items-center bg-bg-secondary border-b border-border-subtle shrink-0 gap-0",children:h.jsxs("div",{ref:Te,className:"flex-1 flex overflow-x-auto overflow-y-visible pt-1.5 pb-0 gap-1 select-none",style:{paddingLeft:8,paddingRight:4,scrollbarWidth:"none"},children:[Ce.map((J,xe)=>{const Fe=Z===J.tabKey,We=J.status==="working"?"agent-tab-working":J.status==="waiting_approval"?"agent-tab-waiting":"",Pe=J.connectionState==="failed"||J.connectionState==="closed",Je=he.current===J.tabKey;return h.jsxs("div",{"data-tabkey":J.tabKey,className:`${We} shrink-0 px-2.5 py-1.5 rounded-t-lg cursor-pointer flex items-center gap-2 relative`,draggable:!("ontouchstart"in window),onDragStart:Ae=>{Du=J.tabKey,he.current=J.tabKey,Ae.dataTransfer.setData("text/tab-key",J.tabKey),Ae.dataTransfer.effectAllowed="move"},onDragEnd:()=>{Du=null,he.current=null;const Ae=Y.current;Ae&&(q(Ae),P==null||P(Ae)),Y.current=null,$(null),w.current=0,V(!1)},onDragOver:Ae=>{const W=he.current;if(!(!W||W===J.tabKey)&&Ae.dataTransfer.types.includes("text/tab-key")){Ae.preventDefault(),Ae.stopPropagation();const ee=Ae.currentTarget.getBoundingClientRect(),ye=ee.left+ee.width/2,Ne=Ae.clientX<ye?"left":"right";ue(W,J.tabKey,Ne)}},onDrop:Ae=>{Ae.preventDefault(),Ae.stopPropagation();const W=Ae.dataTransfer.getData("text/tab-key");if(W&&W!==J.tabKey){const ee=Ae.currentTarget.getBoundingClientRect(),ye=ee.left+ee.width/2,Ne=Ae.clientX<ye?"left":"right";Ce.some(He=>He.tabKey===W)?Ke(W,J.tabKey,Ne):j&&j(W)}$(null)},onClick:Ae=>{Ae.stopPropagation(),v(),oe(J.tabKey),O==null||O(J.tabKey),J.streamSource==="agent-stream"&&J.agentType&&A(J.ideId,"agent_stream_focus",{agentType:J.agentType}).catch(()=>{}),ii(J)&&setTimeout(()=>{var W,ee;return(ee=(W=U.current)==null?void 0:W.bumpResize)==null?void 0:ee.call(W)},100)},onContextMenu:Ae=>{"ontouchstart"in window||(Ae.preventDefault(),ge({x:Ae.clientX,y:Ae.clientY,tabKey:J.tabKey}))},style:{background:Fe?"var(--bg-primary)":"var(--bg-glass)",borderTop:Fe?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:Fe?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:Fe?"1px solid var(--border-subtle)":"1px solid transparent",opacity:Je?.4:Pe?Fe?.6:.3:Fe?1:.65,transition:"transform 0.2s ease, opacity 0.15s ease"},children:[J.status==="working"?h.jsx("div",{className:"tab-spinner"}):J.status==="waiting_approval"?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400",children:"▲"}):Pe?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400 animate-pulse",children:"○"}):J.connectionState==="connecting"?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-blue-400",children:"○"}):J.connectionState==="connected"?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-green-400",children:"●"}):h.jsx("span",{className:"text-[8px] px-[5px] py-px text-text-muted",children:"●"}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:"text-xs font-bold whitespace-nowrap overflow-hidden text-ellipsis",children:J.displayPrimary}),h.jsx("div",{className:"text-[8px] opacity-50 flex gap-1 items-center",children:Pe?h.jsx("span",{className:"text-yellow-400 opacity-100",children:"Reconnecting…"}):h.jsxs(h.Fragment,{children:[J.displaySecondary,J.machineName&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"opacity-40",children:"·"}),h.jsxs("span",{className:"opacity-70",children:["🖥 ",J.machineName]})]})]})})]}),xe<9&&h.jsx("span",{className:"text-[9px] opacity-35 font-mono ml-0.5 shrink-0",children:xe+1})]},J.tabKey)}),e.length===0&&h.jsx("div",{className:"p-2 text-xs opacity-40",children:"No tabs in this group"})]})}),h.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden relative",children:ke?h.jsxs(h.Fragment,{children:[h.jsx(x1,{activeConv:ke,onModalButton:ve.handleModalButton}),h.jsx("div",{className:"desktop-only px-3 pt-1 pb-2",children:!_e&&!ln(ke)&&s[ke.ideId]?h.jsx(eR,{screenshotUrl:s[ke.ideId],mode:"preview",onDismiss:()=>{const J={...s};delete J[ke.ideId],o(J)}}):!_e&&!ln(ke)&&ke.cdpConnected===!1?h.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 py-2 bg-yellow-500/[0.08] border border-yellow-500/20 rounded-lg text-xs text-text-secondary",children:[h.jsx("span",{className:"text-sm",children:h.jsx(Ey,{size:14})}),h.jsx("span",{className:"flex-1",children:"CDP not connected — chat history & screenshots unavailable."}),h.jsx("button",{className:"btn btn-sm bg-yellow-500/15 text-yellow-500 border border-yellow-500/30 text-[10px] whitespace-nowrap shrink-0",onClick:ve.handleRelaunch,children:"Relaunch with CDP"})]}):null}),_e?h.jsx(rR,{activeConv:ke,ptyBuffers:i,terminalRef:U,agentInput:ve.agentInput,setAgentInput:ve.setAgentInput,handleSendChat:ve.handleSendChat,handleModalButton:ve.handleModalButton}):h.jsx(y1,{activeConv:ke,ides:t,agentInput:ve.agentInput,setAgentInput:ve.setAgentInput,handleSendChat:ve.handleSendChat,handleFocusAgent:ve.handleFocusAgent,isFocusingAgent:ve.isFocusingAgent,messageReceivedAt:r,actionLogs:n,userName:_})]}):h.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",children:e.length===0&&!y&&B&&E?h.jsxs("div",{className:"empty-dashboard",children:[h.jsx("div",{className:"glow-orb",children:h.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-12 h-12"})}),h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"font-bold text-lg mb-1.5",children:"No IDE connected"}),h.jsx("div",{className:"text-[13px] text-text-muted",style:{marginBottom:B.length>0?16:0},children:m?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),m&&B.length>0&&h.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:B.map(J=>h.jsx("button",{className:"btn btn-sm bg-violet-500/10 border border-violet-500/25 text-violet-400 text-xs font-semibold px-4 py-2 rounded-lg cursor-pointer flex items-center gap-1.5 transition-all",onClick:()=>E(J.type),onMouseEnter:xe=>xe.currentTarget.style.background="rgba(139,92,246,0.2)",onMouseLeave:xe=>xe.currentTarget.style.background="rgba(139,92,246,0.1)",children:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(EP,{size:14})," Launch ",J.name]})},J.type))})]})]}):h.jsx("div",{className:"text-sm text-text-muted opacity-50",children:y?"Move a tab here to view":"No active agent"})})}),Q&&h.jsxs("div",{className:"fixed z-50 bg-bg-primary border border-border-subtle rounded-lg shadow-lg py-1 min-w-[160px]",style:{left:Q.x,top:Q.y},onClick:()=>ge(null),children:[L&&b>0&&h.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors",onClick:()=>{L(Q.tabKey,"left"),ge(null)},children:"← Move to Left Group"}),L&&b<k-1&&h.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors",onClick:()=>{L(Q.tabKey,"right"),ge(null)},children:"Move to Right Group →"}),L&&k<4&&h.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors",onClick:()=>{L(Q.tabKey,"new"),ge(null)},children:"Split to New Group ◨"}),z&&h.jsxs(h.Fragment,{children:[L&&h.jsx("div",{className:"border-t border-border-subtle my-1"}),h.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors text-text-muted",onClick:()=>{z(Q.tabKey),ge(null)},children:"🚫 Hide from Dashboard"})]}),!L&&!z&&h.jsx("div",{className:"px-3 py-1.5 text-[11px] text-text-muted opacity-50 italic",children:"No actions available"})]})]})}function RM(){const{sendCommand:e}=ci(),[t,r]=mx(),n=t.get("activeTab"),i=np(),{updateIdeChats:s,screenshotMap:o,setScreenshotMap:l}=i,a=i.ides||[],c=i.toasts||[],d=i.setToasts||(()=>{}),u=i.wsStatus||"connected",f=i.isConnected??!0,p=i.connectionStates||{};i.retryConnection;const m=i.showReconnected||!1,[_,b]=x.useState(()=>{try{const M=sessionStorage.getItem("adhdev_splitGroups");if(M){const F=JSON.parse(M);return new Map(F)}}catch{}return new Map}),[g,v]=x.useState(()=>{try{const M=sessionStorage.getItem("adhdev_focusedGroup");if(M)return parseInt(M,10)||0}catch{}return 0}),[y,k]=x.useState(()=>{try{const M=sessionStorage.getItem("adhdev_groupActiveTabs");if(M)return JSON.parse(M)}catch{}return{}}),L=x.useRef(!1),[S,j]=x.useState(()=>{try{const M=sessionStorage.getItem("adhdev_groupTabOrders");if(M)return JSON.parse(M)}catch{}return{}}),[T,B]=x.useState(()=>{try{const M=sessionStorage.getItem("adhdev_splitSizes");if(M)return JSON.parse(M)}catch{}return[]});x.useEffect(()=>{try{_.size===0?sessionStorage.removeItem("adhdev_splitGroups"):sessionStorage.setItem("adhdev_splitGroups",JSON.stringify([..._.entries()]))}catch{}},[_]),x.useEffect(()=>{try{T.length>0?sessionStorage.setItem("adhdev_splitSizes",JSON.stringify(T)):sessionStorage.removeItem("adhdev_splitSizes")}catch{}},[T]),x.useEffect(()=>{try{sessionStorage.setItem("adhdev_focusedGroup",String(g))}catch{}},[g]),x.useEffect(()=>{try{sessionStorage.setItem("adhdev_groupActiveTabs",JSON.stringify(y))}catch{}},[y]),x.useEffect(()=>{try{sessionStorage.setItem("adhdev_groupTabOrders",JSON.stringify(S))}catch{}},[S]);const[E,O]=x.useState(()=>typeof window<"u"&&window.innerWidth<768);x.useEffect(()=>{const M=window.matchMedia("(max-width: 767px)"),F=H=>O(H.matches);return M.addEventListener("change",F),()=>M.removeEventListener("change",F)},[]);const R=x.useMemo(()=>E||_.size===0?1:Math.max(1,..._.values())+1,[_,E]),C=R>1,P=x.useCallback((M,F)=>{b(H=>{const K=new Map(H);return F===0?K.delete(M):K.set(M,F),K}),v(F)},[]),z=x.useCallback(M=>{b(F=>{const K=(F.size===0?0:Math.max(0,...F.values()))+1;if(K>=4)return F;const ae=new Map(F);return ae.set(M,K),ae}),v(F=>F+1)},[]),A=x.useCallback(M=>{b(F=>{const H=new Map;for(const[K,ae]of F)ae!==M&&(ae>M?H.set(K,ae-1):H.set(K,ae));return H}),B(F=>{if(F.length<=1)return[];const H=[...F];H.splice(M,1);const K=H.reduce((ae,se)=>ae+se,0);return H.map(ae=>ae/K*100)}),v(0)},[]),U=x.useRef(null),D=x.useCallback((M,F)=>{F.preventDefault();const H=U.current;if(!H)return;const K=F.clientX,ae=H.offsetWidth,se=T.length===R?[...T]:Array(R).fill(100/R),Me=Ee=>{const Xe=(Ee.clientX-K)/ae*100,Ge=[...se];Ge[M]=Math.max(15,se[M]+Xe),Ge[M+1]=Math.max(15,se[M+1]-Xe),B(Ge)},Le=()=>{document.removeEventListener("mousemove",Me),document.removeEventListener("mouseup",Le),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",Me),document.addEventListener("mouseup",Le)},[T,R]),[V,w]=x.useState({}),[Z,oe]=x.useState(!1),[N,q]=x.useState([]),[I,$]=x.useState({}),[Y,he]=x.useState({}),[me,Ce]=x.useState(!1),[ke,Ke]=x.useState(!1);x.useEffect(()=>{const M=H=>{var K;(K=H.dataTransfer)!=null&&K.types.includes("text/tab-key")&&Ke(!0)},F=()=>{Ke(!1),Ce(!1)};return window.addEventListener("dragstart",M),window.addEventListener("dragend",F),window.addEventListener("drop",F),()=>{window.removeEventListener("dragstart",M),window.removeEventListener("dragend",F),window.removeEventListener("drop",F)}},[]);const ue=a.find(M=>M.type==="adhdev-daemon"),ve=(ue==null?void 0:ue.detectedIdes)||[],Q=!!ue,ge=x.useMemo(()=>{const M=a.filter(H=>H.type!=="adhdev-daemon"),F=new Map;for(const H of M){const K=F.get(H.id);if(!K)F.set(H.id,H);else{const ae=(K.workspace?1:0)+(K.activeChat?1:0);((H.workspace?1:0)+(H.activeChat?1:0)>ae||(H.timestamp||0)>(K.timestamp||0))&&F.set(H.id,H)}}return Array.from(F.values())},[a]),_e=x.useMemo(()=>{const M=hR(ge,I,a,p),F=Date.now();return M.map(H=>{const K=Y[H.tabKey];return K&&F-K<5e3?{...H,messages:[],title:""}:H})},[ge,I,Y,a]),{hiddenTabs:Te,toggleTab:J}=CM(),xe=x.useMemo(()=>_e.filter(M=>!Te.has(M.tabKey)),[_e,Te]);x.useEffect(()=>{yM()},[]);const Fe=x.useMemo(()=>xe.map(M=>({id:M.tabKey,name:M.title||M.agentName||M.ideId,status:M.status,activeModal:M.modalMessage?{message:M.modalMessage,buttons:M.modalButtons}:null})),[xe]);SM(Fe);const We=x.useMemo(()=>{const M=Array.from({length:R},()=>[]);for(const F of xe){const H=_.get(F.tabKey)??0,K=Math.min(H,R-1);M[K].push(F)}return M},[xe,_,R]);x.useEffect(()=>{const M=new Set(xe.map(F=>F.tabKey));b(F=>{let H=!1;const K=new Map;for(const[ae,se]of F)M.has(ae)?K.set(ae,se):H=!0;return H?K:F})},[_e]),x.useEffect(()=>{if(C)for(let M=R-1;M>=1;M--)[..._.values()].some(H=>H===M)||A(M)},[_,R,C,A]),x.useEffect(()=>{if(!n||L.current||_e.length===0)return;const M=_e.find(F=>F.tabKey===n)||_e.find(F=>F.ideId===n)||_e.find(F=>F.ideType===n||F.agentType===n);if(M){const F=_.get(M.tabKey)??0;k(H=>({...H,[F]:M.tabKey})),v(F),L.current=!0,r(H=>{const K=new URLSearchParams(H);return K.delete("activeTab"),K},{replace:!0})}},[n,_e,_]),x.useEffect(()=>{if(Object.keys(Y).length===0)return;const F=setTimeout(()=>{he(H=>{const K=Date.now(),ae={};for(const[se,Me]of Object.entries(H))K-Me<5e3&&(ae[se]=Me);return Object.keys(ae).length===Object.keys(H).length?H:ae})},5500);return()=>clearTimeout(F)},[Y]);const Pe=x.useMemo(()=>{var F,H;const M=y[g];if(M){const K=_e.find(ae=>ae.tabKey===M);if(K)return K}return((F=We[g])==null?void 0:F[0])||((H=We[0])==null?void 0:H[0])},[y,g,_e,We]),Je=x.useCallback((M,F)=>{},[]);x.useEffect(()=>{var K;const M=Date.now();let F=!1;const H={...V};for(const ae of _e)(K=ae.messages)!=null&&K.length&&ae.messages.forEach((se,Me)=>{const Le=`${ae.ideId}-${se.id??`i-${Me}`}`;H[Le]==null&&(H[Le]=M,F=!0)});F&&w(H)},[_e]);const Ae=x.useRef(!1);x.useEffect(()=>{if(!Z){Ae.current=!1;return}if(!Pe||Ae.current||He)return;const M=a.find(F=>F.id===Pe.ideId);M&&(!M.chats||M.chats.length===0)&&(Ae.current=!0,G())},[Z,Pe==null?void 0:Pe.ideId]),x.useEffect(()=>{const M=setInterval(()=>{const F=Date.now()-3e5;q(H=>{const K=H.filter(ae=>ae.timestamp>F).slice(-100);return K.length===H.length?H:K})},6e4);return()=>clearInterval(M)},[]);const W=x.useRef(new Map);x.useEffect(()=>{const M=(H,K)=>{var ae;if(K){w1.emit(H,K);for(const se of _e){if(!ii(se))continue;const Me=(ae=se.ideId)!=null&&ae.includes(":cli:")?se.ideId.split(":cli:")[1]:"";if(H===Me||H===se.agentType||H===se.ideType){const Ee=W.current.get(se.tabKey)||[];Ee.push(K),Ee.length>1e4&&Ee.splice(0,Ee.length-5e3),W.current.set(se.tabKey,Ee)}}}},F=I_.onPtyOutput(M);return()=>{F()}},[_e]),x.useEffect(()=>{const M=F=>{if(F.ctrlKey&&F.key==="\\"){if(F.preventDefault(),C)b(new Map),v(0);else{const H=_e[1];H&&z(H.tabKey)}return}F.ctrlKey&&(F.key==="["||F.key==="]")&&C&&(F.preventDefault(),v(H=>F.key==="]"?Math.min(H+1,R-1):Math.max(H-1,0)))};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[C,_e,z,R]);const ee=x.useRef(new Set),ye=x.useCallback(M=>{var se,Me;const F=`${M.ideId||""}:${M.event}:${Math.floor(Date.now()/2e3)}`;if(ee.current.has(F))return;ee.current.add(F),setTimeout(()=>ee.current.delete(F),3e3);const H=Mr(M.ideType||"");let K="",ae="info";if(M.event==="agent:generating_completed"){const Le=M.duration?` (${M.duration}s)`:"";K=`✅ ${H} agent task completed${Le}`,ae="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(M.ideId){const Ee={role:"system",timestamp:Date.now(),content:`✅ Task completed${Le}`,_localId:`sys_complete_${Date.now()}`};$(qe=>{for(const Xe of Object.keys(qe))if(Xe.includes(M.ideId))return{...qe,[Xe]:[...qe[Xe]||[],Ee]};return qe})}}else if(M.event==="agent:generating_started")M.ideId&&$(Le=>{const Ee={...Le};for(const qe of Object.keys(Ee))qe.includes(M.ideId)&&(Ee[qe]=(Ee[qe]||[]).filter(Xe=>{var Ge;return!(Xe.role==="system"&&((Ge=Xe._localId)!=null&&Ge.startsWith("sys_complete_")))}));return Ee});else if(M.event==="agent:waiting_approval"||M.event==="agent:approval_needed"){if(K=`⚡ ${H} approval needed`,ae="warning",M.ideId){const Le=M.modalMessage||"Approval requested",Ee=(se=M.modalButtons)!=null&&se.length?M.modalButtons.map(Xe=>`[${Xe}]`).join(" "):"[Approve] [Reject]",qe={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${Le}
190
+ ${Ee}`,_localId:`sys_approval_${Date.now()}`};$(Xe=>{for(const Ge of Object.keys(Xe))if(Ge.includes(M.ideId))return{...Xe,[Ge]:[...Xe[Ge]||[],qe]};return Xe})}if(M.ideId&&((Me=M.modalButtons)!=null&&Me.length)){const Le=M.ideId,Ee=M.agentType||M.ideType||"",qe=M.ideType||"",Xe=M.modalButtons,Ge=Or=>Or.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim(),Yr=Xe.map((Or,Ds)=>{const Ln=Ge(Or).toLowerCase(),F1=/^(run|approve|accept|yes|allow|always)/.test(Ln),W1=/^(reject|deny|delete|remove|abort|cancel|no)/.test(Ln);return{label:Ge(Or),variant:F1?"primary":W1?"danger":"default",onClick:()=>{let ip=Le;for(const Cc of a)if(Cc.id.startsWith(Le)&&(!Ee||Ee===Cc.type)){ip=Cc.id;break}const H1=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(Ln);e(ip,"resolve_action",{action:H1?"approve":"reject",button:Or,buttonIndex:Ds,agentType:Ee,ideType:qe}).catch(()=>{})}}}),kc=M.modalMessage?`⚡ ${H}: ${M.modalMessage.replace(/[\n\r]+/g," ").slice(0,80)}`:K,Is=Date.now();d(Or=>[...Or.slice(-4),{id:Is,message:kc,type:ae,timestamp:Is,ideId:Le,actions:Yr}]),setTimeout(()=>d(Or=>Or.filter(Ds=>Ds.id!==Is)),15e3),K=""}}if(K){const Le=Date.now();d(Ee=>[...Ee.slice(-4),{id:Le,message:K,type:ae,timestamp:Le,ideId:M.ideId}]),setTimeout(()=>d(Ee=>Ee.filter(qe=>qe.id!==Le)),5e3)}},[a,e]);x.useEffect(()=>{const M=TM.on("status_event",ye),F=I_.onStatusEvent((H,K)=>ye(K));return()=>{M(),F()}},[ye]),x.useEffect(()=>{var F;const M=H=>{const K=H.data;(K==null?void 0:K.type)==="notification_action"&&K.action==="approve"&&K.ideId&&e(K.ideId,"resolve_action",{action:"approve",button:"Approve"}).catch(ae=>console.error("[SW Action] approve failed:",ae))};return(F=navigator.serviceWorker)==null||F.addEventListener("message",M),()=>{var H;return(H=navigator.serviceWorker)==null?void 0:H.removeEventListener("message",M)}},[]);const{isCreatingChat:Ne,isRefreshingHistory:He,handleLaunchIde:Ot,handleSwitchSession:fr,handleNewChat:gt,handleRefreshHistory:G}=$1({sendDaemonCommand:e,activeConv:Pe,ides:a,updateIdeChats:s,setToasts:d,setLocalUserMessages:$,setClearedTabs:he,setActionLogs:q,pinTab:Je,isStandalone:Q}),le=x.useMemo(()=>a.filter(M=>M.type==="adhdev-daemon"&&M.versionMismatch),[a]),[ne,be]=x.useState(!1),[Be,Oe]=x.useState({}),Lt=x.useCallback(async M=>{var F,H;Oe(K=>({...K,[M]:"upgrading"}));try{const K=await e(M,"daemon_upgrade",{});(F=K==null?void 0:K.result)!=null&&F.upgraded||(H=K==null?void 0:K.result)!=null&&H.success?Oe(ae=>({...ae,[M]:"done"})):Oe(ae=>({...ae,[M]:"error"}))}catch{Oe(K=>({...K,[M]:"error"}))}},[e]);return h.jsxs("div",{className:"page-dashboard flex-1 min-h-0 bg-bg-primary text-text-primary flex flex-col overflow-hidden",children:[h.jsx(nR,{wsStatus:u,showReconnected:m}),le.length>0&&!ne&&h.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-2 bg-amber-500/[0.08] border-b border-amber-500/20 text-xs text-text-secondary shrink-0 flex-wrap",children:[h.jsx("span",{className:"text-sm shrink-0",children:"🔄"}),h.jsxs("span",{className:"flex-1 flex items-center gap-2 flex-wrap min-w-0",children:[h.jsxs("span",{children:["Update available: ",h.jsxs("strong",{children:["v",le[0].version]})," → ",h.jsxs("strong",{children:["v",le[0].serverVersion]})]}),le.map(M=>{var K;const F=M.machineNickname||((K=M.machine)==null?void 0:K.hostname)||M.hostname||"Machine",H=Be[M.id];return h.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-amber-500/[0.08] border border-amber-500/15",children:[h.jsx("span",{className:"font-medium text-text-primary",children:F}),h.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",M.version]}),H==="upgrading"?h.jsx("span",{className:"text-[10px] text-amber-400 animate-pulse",children:"upgrading…"}):H==="done"?h.jsx("span",{className:"text-[10px] text-green-400",children:"✓ restarting"}):H==="error"?h.jsx("button",{className:"text-[10px] text-red-400 hover:text-red-300 underline cursor-pointer",onClick:()=>Lt(M.id),children:"retry"}):h.jsx("button",{className:"text-[10px] font-semibold text-amber-400 hover:text-amber-300 cursor-pointer px-1.5 py-px rounded bg-amber-500/10 border border-amber-500/20 transition-colors",onClick:()=>Lt(M.id),children:"Upgrade"})]},M.id)})]}),h.jsx("button",{className:"text-text-muted hover:text-text-primary transition-colors text-sm px-1 shrink-0",onClick:()=>be(!0),title:"Dismiss",children:"✕"})]}),h.jsx(iR,{activeConv:Pe,agentCount:ge.length,wsStatus:u,isConnected:f,onOpenHistory:()=>oe(!0)}),h.jsxs("div",{ref:U,className:`flex-1 min-h-0 flex ${C?"flex-row":"flex-col"} overflow-hidden`,children:[We.map((M,F)=>{const H=C&&T.length===R?`${T[F]}%`:void 0;return h.jsxs(Q_.Fragment,{children:[C&&F>0&&h.jsx("div",{className:"shrink-0 w-1 cursor-col-resize hover:bg-accent-primary/30 transition-colors relative group",style:{background:"var(--border-subtle)"},onMouseDown:K=>D(F-1,K),onDoubleClick:()=>A(F),title:"Drag to resize · Double-click to merge",children:h.jsx("div",{className:"absolute inset-y-0 -left-1 -right-1 group-hover:bg-accent-primary/10"})}),h.jsx(LM,{style:C?{flexBasis:H??`${100/R}%`,flexGrow:H?0:1,flexShrink:H?0:1}:void 0,conversations:M,ides:a,messageReceivedAt:V,actionLogs:N,ptyBuffers:W,screenshotMap:o,setScreenshotMap:l,sendDaemonCommand:e,updateIdeChats:s,setToasts:d,setLocalUserMessages:$,setClearedTabs:he,setActionLogs:q,pinTab:Je,isStandalone:Q,userName:i.userName,groupIndex:F,isFocused:g===F,onFocus:()=>v(F),isSplitMode:C,numGroups:R,onMoveTab:(K,ae)=>{ae==="left"&&F>0?P(K,F-1):ae==="right"&&F<R-1?P(K,F+1):ae==="new"&&R<4&&z(K)},onClose:C?()=>A(F):void 0,onReceiveTab:K=>P(K,F),detectedIdes:F===0?ve:void 0,handleLaunchIde:F===0?Ot:void 0,onActiveTabChange:K=>k(ae=>({...ae,[F]:K})),initialActiveTabId:y[F],initialTabOrder:S[F],onTabOrderChange:K=>j(ae=>({...ae,[F]:K})),onHideTab:J})]},F)}),!E&&R<4&&h.jsxs("div",{className:"relative shrink-0 w-0 z-50",children:[h.jsx("div",{className:"fixed right-0 top-0 bottom-0 w-16",style:{pointerEvents:ke?"auto":"none"},onDragOver:M=>{M.dataTransfer.types.includes("text/tab-key")&&(M.preventDefault(),Ce(!0))},onDragLeave:()=>Ce(!1),onDrop:M=>{M.preventDefault(),Ce(!1);const F=M.dataTransfer.getData("text/tab-key");F&&z(F)}}),h.jsx("div",{className:"absolute right-0 top-0 bottom-0 pointer-events-none transition-all duration-200",style:{width:me?"120px":"0px",background:"var(--accent-primary)",opacity:me?.15:0,borderLeft:me?"2px dashed var(--accent-primary)":"none"}})]})]}),Z&&Pe&&h.jsx(lR,{activeConv:Pe,ides:a,isCreatingChat:Ne,isRefreshingHistory:He,onClose:()=>oe(!1),onNewChat:gt,onSwitchSession:fr,onRefreshHistory:G}),h.jsx("style",{children:`
191
+ body { overflow: hidden; overscroll - behavior: none; }
192
+ .btn { cursor: pointer; border - radius: 8px; font - weight: 600; font - size: 14px; transition: all 0.2s; }
193
+ .btn - sm { padding: 6px 12px; font - size: 12px; }
194
+ .pulse - amber { animation: pulse - amber 2s infinite ease -in -out; }
195
+ @keyframes pulse - amber {
196
+ 0 % { transform: scale(1); box- shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
197
+ }
198
+ 70 % { transform: scale(1.1); box- shadow: 0 0 0 10px rgba(245, 158, 11, 0);
199
+ }
200
+ 100 % { transform: scale(1); box- shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
201
+ }
202
+ `}),h.jsx(aR,{toasts:c,onDismiss:M=>d(F=>F.filter(H=>H.id!==M)),onClickToast:M=>{if(M.ideId){const F=_e.find(H=>H.ideId===M.ideId||H.tabKey===M.ideId);F&&v(_.get(F.tabKey)??0)}}}),h.jsx("style",{children:`
203
+ @keyframes toast -in {
204
+ from { opacity: 0; transform: translateX(40px); }
205
+ to { opacity: 1; transform: translateX(0); }
206
+ }
207
+ `})]})}function MM(e){return e.split(":")[0]||""}function IM({renderHeaderActions:e}={}){var Ke,ue,ve;const{id:t}=hx(),r=En(),n=np(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=ci(),l=x.useMemo(()=>MM(t||""),[t]),a=x.useMemo(()=>i.find(Q=>Q.id===t),[i,t]),c=(a==null?void 0:a.type)||void 0,d=c?c.charAt(0).toUpperCase()+c.slice(1):"IDE",u=(a==null?void 0:a.activeChat)||null,f=(a==null?void 0:a.agentStreams)||[],p=n.isConnected??!0,m=s[l]||(p?"connected":"new"),_=x.useMemo(()=>i.find(Q=>Q.id===l||Q.daemonId===l),[i,l]),b=(_==null?void 0:_.machineNickname)||((Ke=_==null?void 0:_.machine)==null?void 0:Ke.hostname)||"",g=(a==null?void 0:a.workspace)||"",[v]=mx(),y=typeof window<"u"&&window.innerWidth<=768,k=v.get("view")||(y?"chat":"split"),[L,S]=x.useState(k),[j,T]=x.useState("native"),[B,E]=x.useState(""),[O,R]=x.useState(!1),[C,P]=x.useState(null),[z,A]=x.useState(null),[U,D]=x.useState([]),V=u==null?void 0:u.status,w=(((ve=(ue=u==null?void 0:u.activeModal)==null?void 0:ue.buttons)==null?void 0:ve.length)??0)>0,Z=V==="generating"||V==="loading"||V&&V.toLowerCase()==="thinking",N=w||V==="waiting_approval"?"waiting_approval":Z?"working":V||"idle",q=x.useMemo(()=>{var Q,ge;return{ideId:t||"",daemonId:l,agentName:Ed(c||""),agentType:c||"",status:N,title:(u==null?void 0:u.title)||"",messages:(u==null?void 0:u.messages)||[],ideType:c||"",workspaceName:(a==null?void 0:a.workspaceName)||"",displayPrimary:d,displaySecondary:(a==null?void 0:a.workspaceName)||"",cdpConnected:!0,modalButtons:(Q=u==null?void 0:u.activeModal)==null?void 0:Q.buttons,modalMessage:(ge=u==null?void 0:u.activeModal)==null?void 0:ge.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,u,a,d,N]),I=x.useMemo(()=>f.map(Q=>{var _e,Te;const ge=Q.activeModal?"waiting_approval":Q.status==="streaming"?"working":Q.status||"idle";return{ideId:t||"",daemonId:l,agentName:Q.agentName,agentType:Q.agentType,status:ge,title:"",messages:Q.messages.map((J,xe)=>({role:J.role,content:J.content,kind:J.kind,id:`${Q.agentType}-${xe}`,receivedAt:J.timestamp})),ideType:Q.agentType,workspaceName:"",displayPrimary:Q.agentName,displaySecondary:"",cdpConnected:!0,modalButtons:(_e=Q.activeModal)==null?void 0:_e.buttons,modalMessage:(Te=Q.activeModal)==null?void 0:Te.message,streamSource:"agent-stream",tabKey:`agent-stream-${Q.agentType}`}}),[f,t,l]),$=x.useMemo(()=>j==="native"?q:I.find(Q=>Q.agentType===j)||q,[j,q,I]);x.useEffect(()=>l?vr.onScreenshot("ide-page",(ge,_e)=>{if(ge!==l)return;const Te=new FileReader;Te.onload=()=>P(Te.result),Te.readAsDataURL(_e)}):void 0,[l]),x.useEffect(()=>l?vr.onStatusEvent((ge,_e)=>{if(ge!==l)return;let Te="",J="info";if(_e.event==="agent:generating_completed"?(Te=`✅ Task completed${_e.duration?` (${_e.duration}s)`:""}`,J="success"):(_e.event==="agent:waiting_approval"||_e.event==="agent:approval_requested")&&(Te="⚡ Approval needed",J="warning"),Te){const xe=Date.now();D(We=>[...We.slice(-4),{id:xe,message:Te,type:J}]),setTimeout(()=>D(We=>We.filter(Pe=>Pe.id!==xe)),J==="warning"?1e4:5e3)}}):void 0,[l]);const Y=x.useMemo(()=>{if(!t)return c;const Q=t.split(":");return Q.length>=3&&Q[1]==="ide"?Q.slice(2).join(":"):c},[t,c]);x.useEffect(()=>{const Q=l?vr.get(l):null;!Q||!(m==="connected")||(L!=="chat"&&Y?Q.startScreenshots(Y):Q.stopScreenshots(Y))},[L,m,Y,l]);const he=x.useCallback(async(Q,ge={})=>{if(!t)throw new Error("No IDE ID");const _e={...ge};if(!_e._targetInstance&&t){const J=t.split(":");J.length>=3&&(J[1]==="ide"||J[1]==="cli")&&(_e._targetInstance=J.slice(2).join(":"),_e._targetType=J[1])}const Te=l?vr.get(l):null;return Te!=null&&Te.hasCommandChannel?await Te.sendCommand(Q,_e):Te&&Te.connectionState!=="failed"&&Te.connectionState!=="closed"&&await new Promise(xe=>{const Fe=Date.now(),We=()=>{if(Te.hasCommandChannel)return xe(!0);if(Date.now()-Fe>3e3)return xe(!1);setTimeout(We,200)};We()})&&Te.hasCommandChannel?await Te.sendCommand(Q,_e):await o(t,Q,_e)},[t,l]),me=async()=>{const Q=B.trim();if(!(!Q||!t||O)){E(""),R(!0);try{await he("send_chat",{message:Q,text:Q,waitForResponse:!0,...j!=="native"&&{agentType:j}})}catch(ge){console.error("[IDE] Send failed:",ge)}finally{R(!1)}}},Ce=async Q=>{if(t)try{const ge=await o(t,"screenshot",{width:Q?Math.min(Q,1280):1280});ge!=null&&ge.success&&(ge!=null&&ge.base64)&&A(`data:image/jpeg;base64,${ge.base64}`)}catch(ge){console.error("[IDE] Screenshot failed:",ge)}},ke=f.length>0;return t?h.jsxs("div",{className:"ide-page",children:[h.jsxs("header",{className:"ide-header",children:[h.jsxs("div",{className:"ide-header-left",children:[h.jsxs("div",{className:"ide-title",children:[h.jsx($a,{size:16}),h.jsx("span",{className:"ide-name",children:d}),h.jsx("span",{className:"ide-name-mobile",children:"IDE"}),g&&h.jsx("span",{className:"ide-workspace",children:g}),h.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),h.jsxs("div",{className:"ide-status-pill",children:[h.jsx("span",{className:`ide-dot ${m==="connected"?"online":"connecting"}`}),h.jsx("span",{className:"ide-status-text",children:m==="connected"?"Connected":m==="connecting"?"Connecting":"WS"})]}),b&&h.jsx("span",{className:"ide-machine-label",children:b})]}),h.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(Q=>h.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:L===Q?"1px solid var(--accent-primary)":"none",background:L===Q?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:L===Q?"var(--accent-primary)":void 0},onClick:()=>S(Q),children:Q==="chat"?h.jsx($a,{size:14}):Q==="split"?"⊞":h.jsx(ll,{size:14})},Q)),e&&e({daemonId:l,ideInstanceId:t||""}),h.jsxs("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs flex items-center justify-center shrink-0",onClick:()=>r(-1),children:["←",h.jsx("span",{className:"hidden md:inline ml-1",children:"Back"})]})]})]}),h.jsxs("div",{className:"ide-content",children:[h.jsxs("div",{className:`ide-chat-panel ${L==="chat"?"full":""} ${L==="remote"?"hidden":""}`,children:[ke&&h.jsxs("div",{className:"ide-chat-tabs",children:[h.jsx("button",{className:`ide-chat-tab ${j==="native"?"active":""}`,onClick:()=>T("native"),children:d}),f.map(Q=>{const ge=j===Q.agentType,_e=Q.status==="waiting_approval"||!!Q.activeModal,Te=Q.status==="streaming";return h.jsxs("button",{className:`ide-chat-tab ${ge?"active":""}`,onClick:()=>T(Q.agentType),children:[h.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",marginRight:5,background:_e?"#f59e0b":Te?"var(--accent-primary)":"#64748b",boxShadow:Te?"0 0 6px var(--accent-primary)":"none"}}),Q.agentName,_e&&h.jsx("span",{className:"ide-ext-badge",style:{background:"#f59e0b22",color:"#f59e0b",marginLeft:4},children:"!"})]},Q.agentType)})]}),h.jsx(y1,{activeConv:$,ides:i,agentInput:B,setAgentInput:E,handleSendChat:me,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[],userName:n.userName})]}),h.jsx("div",{className:`ide-remote-panel ${L==="remote"?"full":""} ${L==="chat"?"hidden":""}`,children:h.jsx(Z4,{screenshot:z,isCapturing:!1,onRefresh:Ce,addLog:()=>{},connState:m,connScreenshot:C,onAction:async(Q,ge)=>{const _e=l?vr.get(l):null;if(!_e||m!=="connected")return console.warn("[RemoteInput] P2P not connected"),{success:!1,error:"P2P not connected"};const Te=(a==null?void 0:a.instanceId)||Y;return await _e.sendInput(Q,ge,Te)}})})]}),U.length>0&&h.jsx("div",{className:"ide-toasts",children:U.map(Q=>h.jsx("div",{className:`ide-toast ${Q.type}`,onClick:()=>D(ge=>ge.filter(_e=>_e.id!==Q.id)),children:Q.message},Q.id))})]}):h.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function DM({machineId:e,sendDaemonCommand:t,logsEndRef:r}){const[n,i]=x.useState([]),[s,o]=x.useState(null),[l,a]=x.useState(!1),[c,d]=x.useState(!1),[u,f]=x.useState(!1),[p,m]=x.useState([]),[_,b]=x.useState([]),[g,v]=x.useState(null),[y,k]=x.useState(!1),[L,S]=x.useState(""),j=x.useRef(null),T=x.useCallback(q=>{j.current=q},[]),B=x.useCallback((q,I)=>{i($=>[...$.slice(-100),{timestamp:Date.now(),level:q,message:I}]),setTimeout(()=>{var $;return($=r.current)==null?void 0:$.scrollIntoView({behavior:"smooth"})},100)},[r]),E=x.useCallback(async q=>{if(!(!e||s)){o(q),B("info",`Launching ${Mr(q)}...`);try{const I=await t(e,"launch_ide",{ideType:q,enableCdp:!0});B(I!=null&&I.success?"info":"error",I!=null&&I.success?`${Mr(q)} launched`:`Failed: ${I==null?void 0:I.error}`)}catch(I){B("error",`Launch error: ${I.message}`)}finally{o(null)}}},[e,s,B,t]),O=x.useCallback(async q=>{if(!e)return;const{cliType:I,dir:$,workspaceId:Y,useDefaultWorkspace:he,useHome:me,argsStr:Ce,model:ke}=q;if(!I){B("warn","Select a CLI or ACP provider first");return}const Ke=Ce?Ce.split(/\s+/).filter(Boolean):void 0,ue=($==null?void 0:$.trim())||(Y?"(saved id)":he?"(default workspace)":me?"(home)":"");B("info",`Launching ${I}${ue?` in ${ue}`:""}${ke?` (model: ${ke})`:""}...`);try{const ve={cliType:I,cliArgs:Ke,initialModel:ke||void 0};$!=null&&$.trim()?ve.dir=$.trim():Y?ve.workspaceId=Y:he?ve.useDefaultWorkspace=!0:me&&(ve.useHome=!0);const Q=await t(e,"launch_cli",ve),ge=(Q==null?void 0:Q.result)||Q;Q!=null&&Q.success?(B("info",`${I} launched`),(ge==null?void 0:ge.launchSource)==="home"?B("info","📂 Running in home directory (explicit choice)"):(ge==null?void 0:ge.launchSource)==="defaultWorkspace"&&B("info","📂 Using default workspace (explicit choice)")):(B("error",`Failed: ${(Q==null?void 0:Q.error)||(ge==null?void 0:ge.error)}`),(Q==null?void 0:Q.code)==="WORKSPACE_LAUNCH_CONTEXT_REQUIRED"&&v({cliType:I,argsStr:Ce,model:ke}))}catch(ve){B("error",`Launch error: ${ve.message}`)}},[e,B,t]),R=x.useCallback((q,I,$,Y)=>{if(e){if(!q){B("warn","Select a provider");return}if(!I.trim()){v({cliType:q,argsStr:$,model:Y});return}O({cliType:q,dir:I,argsStr:$,model:Y})}},[e,B,O]),C=x.useCallback(async(q,I,$)=>{if(e&&window.confirm(`Stop ${q}?
208
+ This will terminate the process.`))try{const Y=await t(e,"stop_cli",{cliType:q,dir:I,_targetInstance:$});Y!=null&&Y.success?B("info",`${q} stopped`):B("error",`Stop failed: ${(Y==null?void 0:Y.error)||"Unknown error"}`)}catch(Y){B("error",`Stop failed: ${Y.message}`)}},[e,B,t]),P=x.useCallback(async q=>{try{await t(q.daemonId,"restart_ide",{ideType:q.type}),B("info",`${Mr(q.type)} restart initiated`)}catch(I){B("error",`Restart failed: ${I.message}`)}},[B,t]),z=x.useCallback(async q=>{if(window.confirm(`Stop ${Mr(q.type)}?
209
+ This will disconnect CDP and optionally kill the process.`))try{const I=await t(q.daemonId,"stop_ide",{ideType:q.type,killProcess:!0});I!=null&&I.success?B("info",`${Mr(q.type)} stopped`):B("error",`Stop failed: ${(I==null?void 0:I.error)||"Unknown error"}`)}catch(I){B("error",`Stop failed: ${I.message}`)}},[B,t]),A=x.useCallback(async()=>{if(e)try{const q=await t(e,"detect_ides",{});B("info",`Found ${((q==null?void 0:q.result)||[]).length} IDE(s)`)}catch(q){B("error",`Detection failed: ${q.message}`)}},[e,B,t]),U=x.useCallback(async()=>{if(e){a(!0);try{const q=await t(e,"get_recent_workspaces",{});q!=null&&q.success&&Array.isArray(q==null?void 0:q.result)&&b(q.result)}catch(q){B("error",`Failed: ${q.message}`)}finally{a(!1)}}},[e,B,t]),D=x.useCallback(async q=>{if(!(!e||!q.trim())){d(!0);try{const I=await t(e,"workspace_add",{path:q.trim()});I!=null&&I.success?B("info",`Workspace added: ${q.trim()}`):B("error",(I==null?void 0:I.error)||"workspace_add failed")}catch(I){B("error",I.message)}finally{d(!1)}return!0}},[e,B,t]),V=x.useCallback(async q=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){d(!0);try{const I=await t(e,"workspace_remove",{id:q});I!=null&&I.success?B("info","Workspace removed"):B("error",(I==null?void 0:I.error)||"workspace_remove failed")}catch(I){B("error",I.message)}finally{d(!1)}}},[e,B,t]),w=x.useCallback(async q=>{var I;if(e){d(!0);try{const $=await t(e,"workspace_set_default",q===null?{clear:!0}:{id:q});if($!=null&&$.success){B("info",q?"Default workspace updated":"Default workspace cleared");const Y=typeof $.defaultWorkspacePath=="string"?$.defaultWorkspacePath:"";Y&&((I=j.current)==null||I.call(j,Y))}else B("error",($==null?void 0:$.error)||"workspace_set_default failed")}catch($){B("error",$.message)}finally{d(!1)}}},[e,B,t]),Z=x.useCallback(async q=>{var $;if(!e||!q.trim())return;const I=q.trim();d(!0);try{const Y=await t(e,"workspace_set_default",{path:I});Y!=null&&Y.success?(B("info","Default workspace set from history"),($=j.current)==null||$.call(j,I)):B("error",(Y==null?void 0:Y.error)||"Could not set default (path missing on disk?)")}catch(Y){B("error",Y.message)}finally{d(!1)}},[e,B,t]),oe=x.useCallback(async()=>{var q;if(e){f(!0);try{const I=await t(e,"get_cli_history",{}),$=(I==null?void 0:I.history)??((q=I==null?void 0:I.result)==null?void 0:q.history);I!=null&&I.success&&Array.isArray($)&&m($)}catch{}f(!1)}},[e,t]),N=x.useCallback(async()=>{if(e)try{await t(e,"set_machine_nickname",{nickname:L}),B("info",`Nickname set to "${L||"(cleared)"}"`),k(!1)}catch(q){B("error",`Failed: ${q.message}`)}},[e,L,B,t]);return{logs:n,launchingIde:s,loadingWorkspaces:l,workspaceBusy:c,loadingHistory:u,cliHistory:p,recentWorkspaces:_,launchPick:g,setLaunchPick:v,editingNickname:y,setEditingNickname:k,nicknameInput:L,setNicknameInput:S,addLog:B,handleLaunchIde:E,runLaunchCliCore:O,handleLaunchCli:R,handleStopCli:C,handleRestartIde:P,handleStopIde:z,handleDetectIdes:A,handleLoadRecentWorkspaces:U,handleWorkspaceAdd:D,handleWorkspaceRemove:V,handleWorkspaceSetDefault:w,handleWorkspaceResumePath:Z,loadCliHistory:oe,handleSaveNickname:N,setOnDefaultWorkspaceChanged:T}}function jM(e){const t=Math.floor((Date.now()-e)/1e3);return t<45?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function AM({machine:e,managedIdes:t,managedClis:r,providers:n,getIcon:i,actions:s,setActiveTab:o}){const l=En(),{cliHistory:a,loadCliHistory:c,workspaceBusy:d,handleWorkspaceAdd:u,handleWorkspaceRemove:f,handleWorkspaceSetDefault:p,handleWorkspaceResumePath:m,runLaunchCliCore:_}=s,[b,g]=x.useState("");x.useEffect(()=>(s.setOnDefaultWorkspaceChanged(()=>{}),()=>s.setOnDefaultWorkspaceChanged(null)),[s]),x.useEffect(()=>{c()},[c]);const v=e.availableMem??e.freeMem,y=e.totalMem>0?Math.min(100,Math.max(0,Math.round((e.totalMem-v)/e.totalMem*100))):0,k=e.loadavg[0]||0,L=S=>{const j=n.find(T=>T.type===S);(j==null?void 0:j.category)==="acp"?o("acps"):o("clis")};return h.jsxs("div",{children:[h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[h.jsx(__,{icon:h.jsx(wg,{size:16}),label:"Uptime",value:sR(e.uptime)}),h.jsx(__,{icon:h.jsx(ll,{size:16}),label:"IDEs",value:`${t.length}`,sub:`${r.length} CLIs`})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),h.jsxs("div",{className:"flex gap-6",children:[h.jsx(v_,{value:Math.min(Math.round(k/e.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${k.toFixed(2)} avg / ${e.cpus} cores`}),h.jsx(v_,{value:y,max:100,label:"Memory",color:"#3b82f6",detail:`${x_(e.totalMem-v)} / ${x_(e.totalMem)}${e.platform==="darwin"?" (approx.)":""}`})]})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[h.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[h.jsx(Fa,{size:14})," Workspaces"]})}),h.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:["One list for IDE, CLI, and ACP: saved paths below, and a single ",h.jsx("strong",{className:"text-text-secondary font-medium",children:"default"}),'. The default opens in the IDE when you launch it, pre-fills CLI/ACP directories, and is what "Default" launch uses.']}),h.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[h.jsx("span",{className:"text-[10px] text-text-muted",children:"Default:"}),h.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:d,value:e.defaultWorkspaceId||"",onChange:S=>void p(S.target.value===""?null:S.target.value),children:[h.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(e.workspaces||[]).map(S=>h.jsx("option",{value:S.id,children:S.label||S.path},S.id))]}),e.defaultWorkspacePath&&h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:e.defaultWorkspacePath,children:e.defaultWorkspacePath})]}),h.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[h.jsx("input",{className:"flex-1 min-w-[200px] text-xs bg-bg-primary border border-border-subtle rounded-lg px-2.5 py-1.5",placeholder:"Absolute workspace path to add…",value:b,disabled:d,onChange:S=>g(S.target.value),onKeyDown:S=>S.key==="Enter"&&void(async()=>{await u(b)&&g("")})()}),h.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:d,onClick:async()=>{await u(b)&&g("")},children:"Add"})]}),(e.workspaces||[]).length>0&&h.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(e.workspaces||[]).map(S=>h.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[h.jsx("span",{className:"font-mono truncate flex-1",title:S.path,children:S.path}),h.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:d,onClick:()=>void f(S.id),children:"Remove"})]},S.id))})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle border-violet-500/15",children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1 flex items-center gap-1.5",children:[h.jsx(wg,{size:14})," Pick up where you left off"]}),h.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:"Same workspaces as above. Re-run CLI/ACP, or open CLIs/ACP tab with a path filled; IDE launch uses the default automatically when set."}),h.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent CLI / ACP launches"}),a.length>0?h.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:a.slice(0,10).map((S,j)=>{const T=S.label||`${S.cliType} · ${(S.dir||"").split("/").filter(Boolean).pop()||S.dir||"?"}`;return h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[h.jsxs("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,240px)]",title:S.dir,children:[i(S.cliType)," ",T]}),h.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:S.dir,children:S.dir}),h.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _({cliType:S.cliType,dir:S.dir,argsStr:(S.cliArgs||[]).join(" ")}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>L(S.cliType),children:"Open tab…"})]})]},`${S.cliType}-${S.dir}-${S.timestamp}-${j}`)})}):h.jsx("p",{className:"text-[11px] text-text-muted mb-4",children:"No launch history yet — start a CLI or ACP from the tabs below, then return here."}),(e.workspaceActivity||[]).length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent workspace paths"}),h.jsx("div",{className:"flex flex-col gap-1.5",children:(e.workspaceActivity||[]).slice(0,12).map(S=>{const j=S.path.split("/").filter(Boolean).pop()||S.path,T=S.kind==="ide"?"IDE":S.kind==="cli"?"CLI":S.kind==="acp"?"ACP":S.kind==="default"||S.kind==="active"?"●":"",B=(S.kind==="cli"||S.kind==="acp")&&!!S.agentType;return h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[h.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,200px)]",title:S.path,children:j}),T&&h.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:T}),S.agentType&&h.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:S.agentType}),h.jsx("span",{className:"text-[9px] text-text-muted",children:jM(S.lastUsedAt)}),h.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[B&&h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _({cliType:S.agentType,dir:S.path}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>o("clis"),children:"CLIs tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>o("acps"),children:"ACP tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:d,onClick:()=>void m(S.path),children:"Set default"})]})]},`${S.path}-${S.lastUsedAt}`)})})]})]}),h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),h.jsx("button",{onClick:()=>o("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),t.length===0?h.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):h.jsx("div",{className:"flex flex-col gap-1.5",children:t.map(S=>{var T;const j=(S.agentStreams||[]).some(B=>B.status==="generating"||B.status==="streaming")||((T=S.activeChat)==null?void 0:T.status)==="generating";return h.jsxs("div",{onClick:()=>l(`/ide/${S.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${j?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[h.jsx("span",{children:i(S.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:Mr(S.type)}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:S.workspace||""}),j&&h.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),h.jsx("span",{className:`${j?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:j?"#fb923c":"#22c55e",boxShadow:j?"0 0 8px rgba(249,115,22,0.4)":"none",animation:j?"pulse-dot 1.5s infinite":"none"}})]},S.id)})})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),h.jsx("button",{onClick:()=>o("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),r.length===0?h.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):h.jsx("div",{className:"flex flex-col gap-1.5",children:r.map(S=>h.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[h.jsx("span",{children:i(S.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:S.cliName}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:S.workspace.split("/").pop()}),h.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:S.status==="stopped"?"#ef4444":"#22c55e"}})]},S.id))})]})]}),e.detectedIdes.length>0&&h.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.detectedIdes.map(S=>h.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${S.running?"bg-green-500/[0.06] border border-green-500/[0.12] text-green-300":"bg-bg-glass border border-border-subtle text-text-muted"}`,children:[h.jsx("span",{children:i(S.type)}),S.name||S.type,h.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:S.running?"#22c55e":"#475569"}})]},S.type))})]})]})}function BM({machine:e,machineId:t,managedIdes:r,getIcon:n,actions:i,sendDaemonCommand:s}){const o=En(),{launchingIde:l,handleLaunchIde:a,handleRestartIde:c,handleStopIde:d,handleDetectIdes:u}=i,[f,p]=x.useState({}),[m,_]=x.useState(null),b=e.detectedIdes||[];return x.useEffect(()=>{if(!t)return;(async()=>{try{const v=await s(t,"get_ide_extensions",{}),y=(v==null?void 0:v.result)||v;y!=null&&y.success&&(y!=null&&y.ides)&&p(y.ides)}catch{}})()},[t,s]),h.jsxs("div",{children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",r.length,")"]}),r.length===0?h.jsx("div",{className:"py-10 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No IDEs currently running. Launch one below."}):h.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:r.map(g=>h.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-lg",children:n(g.type)}),h.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Mr(g.type)}),g.version&&h.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",g.version]}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs("button",{onClick:()=>o(`/ide/${g.id}`),className:"machine-btn flex items-center gap-1",children:[h.jsx(ll,{size:13})," Control"]}),h.jsx("button",{onClick:()=>c(g),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"}),h.jsx("button",{onClick:()=>d(g),className:"machine-btn text-red-400 border-red-500/30",children:"■ Stop"})]})]}),h.jsxs("div",{className:"text-xs text-text-secondary mb-2",children:[h.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",g.workspace||"—"]}),g.aiAgents.length>0&&h.jsx("div",{className:"flex gap-1 mb-2 flex-wrap",children:g.aiAgents.map(v=>h.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${v.status==="generating"||v.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[v.name," · ",v.status]},v.id))}),(f[g.type]||[]).length>0&&h.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:[h.jsx("div",{className:"text-[10px] text-text-muted font-semibold uppercase tracking-wider mb-1.5",children:"Extensions"}),h.jsx("div",{className:"flex flex-wrap gap-2",children:(f[g.type]||[]).map(v=>h.jsxs("button",{disabled:m===`${g.type}.${v.type}`,onClick:async()=>{const y=`${g.type}.${v.type}`;_(y);try{await s(t,"set_ide_extension",{ideType:g.type,extensionType:v.type,enabled:!v.enabled}),p(k=>({...k,[g.type]:(k[g.type]||[]).map(L=>L.type===v.type?{...L,enabled:!L.enabled}:L)}))}catch(k){console.error("Extension toggle failed:",k)}finally{_(null)}},className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-medium border transition-colors duration-150 cursor-pointer ${v.enabled?"bg-violet-500/[0.08] border-violet-500/20 text-violet-400":"bg-bg-glass border-border-subtle text-text-muted"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${v.enabled?"bg-violet-400 shadow-[0_0_4px_rgba(139,92,246,0.4)]":"bg-zinc-600"}`}),v.name,h.jsx("span",{className:"text-[9px] font-normal",children:v.enabled?"ON":"OFF"})]},v.type))})]})]},g.id))}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",b.length,")"]}),h.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:[e.defaultWorkspacePath?`Opens in default workspace: ${e.defaultWorkspacePath.split("/").filter(Boolean).pop()||e.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."," ","Multi-window supported — running IDEs can be launched again as a new window."]}),h.jsxs("div",{className:"flex flex-wrap gap-2",children:[b.map(g=>{const v=g.running||r.some(y=>(y.type||"").toLowerCase()===(g.type||"").toLowerCase());return h.jsxs("button",{onClick:()=>a(g.type||g.id||""),disabled:!!l,className:`machine-btn-primary flex items-center gap-1.5 ${v?"!border-green-500/30":""}`,style:{opacity:l&&l!==g.type?.4:1},children:[h.jsx("span",{children:n(g.type)}),v&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),l===g.type?"⏳ Launching...":`▶ ${g.name||Mr(g.type)}`,v&&h.jsx("span",{className:"text-[9px] text-green-400 font-normal",children:"+ window"})]},g.type)}),b.length===0&&h.jsxs("div",{className:"text-xs text-text-muted italic",children:["No IDEs detected.",h.jsxs("button",{onClick:u,className:"machine-btn ml-2 flex items-center gap-1",children:[h.jsx(wP,{size:12})," Scan"]})]})]})]})}function D_({category:e,machine:t,providers:r,managedEntries:n,getIcon:i,actions:s}){const o=En(),{handleLaunchCli:l,handleStopCli:a,runLaunchCliCore:c,handleLoadRecentWorkspaces:d,loadingWorkspaces:u,recentWorkspaces:f,cliHistory:p,loadingHistory:m,loadCliHistory:_}=s,b=e==="cli",g=b?"border-violet-500/[0.12]":"border-emerald-500/[0.12]",v=b?"CLI":"ACP Agent",y=r.filter(C=>C.category===e),[k,L]=x.useState(""),[S,j]=x.useState(""),[T,B]=x.useState(""),[E,O]=x.useState("");x.useEffect(()=>{!k&&y.length>0&&L(y[0].type)},[k,y.length]),x.useEffect(()=>{t.defaultWorkspacePath&&!S&&j(t.defaultWorkspacePath)},[t.defaultWorkspacePath]);const R=C=>b?C.cliName:C.acpName;return h.jsxs("div",{children:[h.jsxs("div",{className:`px-5 py-4 rounded-xl mb-5 bg-bg-secondary border ${g}`,children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Launch New ",v]}),h.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),h.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[h.jsx("select",{value:k,onChange:C=>L(C.target.value),className:"machine-input",children:y.length>0?y.map(C=>h.jsxs("option",{value:C.type,children:[C.icon," ",C.displayName]},C.type)):h.jsxs("option",{value:"",disabled:!0,children:["No ",e.toUpperCase()," providers available"]})}),h.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:S,onChange:C=>j(C.target.value),className:"machine-input flex-1 min-w-[200px]"}),!b&&h.jsx("input",{type:"text",placeholder:"Model (default)",value:E,onChange:C=>O(C.target.value),className:"machine-input min-w-[120px]"}),h.jsx("input",{type:"text",placeholder:"Args (optional)",value:T,onChange:C=>B(C.target.value),className:"machine-input min-w-[120px]"}),h.jsx("button",{onClick:()=>l(k,S,T||void 0,b?void 0:E||void 0),className:"machine-btn-primary",children:"▶ Launch"}),h.jsx("button",{type:"button",disabled:!(t!=null&&t.defaultWorkspacePath),title:t!=null&&t.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void c({cliType:k,useDefaultWorkspace:!0,argsStr:T||void 0,model:b?void 0:E||void 0}),className:"machine-btn text-[10px]",children:"Default"}),h.jsx("button",{type:"button",onClick:()=>void c({cliType:k,useHome:!0,argsStr:T||void 0,model:b?void 0:E||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",n.length,")"]}),n.length===0?h.jsxs("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:["No ",b?"CLIs":"ACP agents"," running"]}):h.jsx("div",{className:"flex flex-col gap-2 mb-5",children:n.map(C=>{const P=b?null:C;return h.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx("span",{className:"text-lg",children:i(C.type)}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:R(C)}),h.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[h.jsx("span",{children:C.workspace}),(P==null?void 0:P.currentModel)&&h.jsxs("span",{className:"text-cyan-500",children:["🤖 ",P.currentModel]}),(P==null?void 0:P.currentPlan)&&h.jsxs("span",{className:"text-amber-500",children:["📋 ",P.currentPlan]})]})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${C.status==="stopped"?"bg-red-500/[0.08] text-red-500":C.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:C.status}),!b&&h.jsx("button",{onClick:()=>o(`/ide/${C.id}`),className:"machine-btn",title:"View chat",children:h.jsx($a,{size:14})}),C.status==="stopped"?h.jsx("button",{onClick:()=>l(C.type,C.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):h.jsx("button",{onClick:()=>a(C.type,C.workspace,C.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},C.id)})}),b&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),h.jsx("button",{onClick:_,disabled:m,className:"machine-btn",children:m?"⏳":"↻ Load"})]}),p.length>0&&h.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:p.map((C,P)=>{var z,A;return h.jsxs("div",{onClick:()=>{L(C.cliType),j(C.dir),B((C.cliArgs||[]).join(" "))},className:"flex justify-between items-center px-2.5 py-1.5 rounded-md cursor-pointer bg-bg-glass border border-border-subtle text-xs transition-[background] duration-150",onMouseEnter:U=>U.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:U=>U.currentTarget.style.background="var(--bg-glass)",children:[h.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[h.jsx("span",{children:i(C.cliType)}),h.jsx("span",{children:((z=C.dir)==null?void 0:z.split("/").filter(Boolean).pop())||"root"}),((A=C.cliArgs)==null?void 0:A.length)>0&&h.jsx("span",{className:"text-text-muted text-[10px]",children:C.cliArgs.join(" ")})]}),h.jsx("span",{className:"text-text-muted text-[10px]",children:C.timestamp?new Date(C.timestamp).toLocaleDateString():""})]},P)})})]}),h.jsxs("div",{className:"mt-5",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),h.jsx("button",{onClick:d,disabled:u,className:"machine-btn",children:u?"⏳":"↻ Load"})]}),f.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map((C,P)=>h.jsx("button",{onClick:()=>j(C),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:C,children:h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(Fa,{size:12})," ",C.split("/").filter(Boolean).pop()||C]})},P))})]})]})}function OM({machineId:e,providers:t,sendDaemonCommand:r}){const[n,i]=x.useState([]),[s,o]=x.useState(!1),[l,a]=x.useState(null),[c,d]=x.useState("all"),u=x.useCallback(async()=>{var p;if(e){o(!0);try{const m=await r(e,"get_provider_settings",{}),_=(m==null?void 0:m.result)||m;if(m!=null&&m.success&&(_!=null&&_.settings)){const b=[];for(const[g,v]of Object.entries(_.settings)){const y=t.find(k=>k.type===g);b.push({type:g,displayName:(y==null?void 0:y.displayName)||g,icon:(y==null?void 0:y.icon)||"",category:(y==null?void 0:y.category)||"unknown",schema:v,values:((p=_.values)==null?void 0:p[g])||{}})}b.sort((g,v)=>g.category.localeCompare(v.category)||g.displayName.localeCompare(v.displayName)),i(b)}}catch{}o(!1)}},[e,t,r]);x.useEffect(()=>{n.length===0&&u()},[]);const f=async(p,m,_)=>{a(`${p}.${m}`),i(b=>b.map(g=>g.type===p?{...g,values:{...g.values,[m]:_}}:g));try{const b=await r(e,"set_provider_setting",{providerType:p,key:m,value:_});b!=null&&b.success||u()}catch{u()}a(null)};return h.jsxs("div",{children:[h.jsxs("div",{className:"flex justify-between items-center mb-4",children:[h.jsxs("div",{className:"flex gap-1 items-center",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(p=>h.jsx("button",{onClick:()=>d(p),className:`machine-btn text-[10px] px-2 py-0.5 ${c===p?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:p.toUpperCase()},p))]}),h.jsx("button",{onClick:u,disabled:s,className:"machine-btn",children:s?"⏳ Loading...":"↻ Refresh"})]}),s&&n.length===0?h.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):h.jsx("div",{className:"flex flex-col gap-2",children:n.filter(p=>c==="all"||p.category===c).map(p=>h.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-lg",children:p.icon}),h.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:p.displayName}),h.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:p.category==="acp"?"rgba(139,92,246,0.08)":p.category==="cli"?"rgba(59,130,246,0.08)":p.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:p.category==="acp"?"#a78bfa":p.category==="cli"?"#60a5fa":p.category==="ide"?"#86efac":"#fbbf24"},children:p.category})]}),h.jsx("div",{className:"flex flex-col gap-2",children:p.schema.map(m=>h.jsxs("div",{className:"flex items-center justify-between gap-3",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[m.label||m.key,l===`${p.type}.${m.key}`&&h.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),m.description&&h.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:m.description})]}),h.jsx("div",{className:"shrink-0",children:m.type==="boolean"?h.jsx("button",{onClick:()=>f(p.type,m.key,!(p.values[m.key]??m.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:p.values[m.key]??m.default?"#8b5cf6":"var(--border-subtle)"},children:h.jsx("div",{className:"w-4 h-4 rounded-full bg-white absolute top-[3px] transition-[left] duration-200 shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{left:p.values[m.key]??m.default?21:3}})}):m.type==="number"?h.jsx("input",{type:"number",value:p.values[m.key]??m.default??0,min:m.min,max:m.max,onChange:_=>{const b=parseInt(_.target.value)||0;m.min!==void 0&&b<m.min||m.max!==void 0&&b>m.max||f(p.type,m.key,b)},className:"machine-input w-20 text-center text-[11px]"}):m.type==="select"&&m.options?h.jsx("select",{value:p.values[m.key]??m.default??"",onChange:_=>f(p.type,m.key,_.target.value),className:"machine-input text-[11px]",children:m.options.map(_=>h.jsx("option",{value:_,children:_},_))}):h.jsx("input",{type:"text",value:p.values[m.key]??m.default??"",onBlur:_=>f(p.type,m.key,_.target.value),className:"machine-input w-[120px] text-[11px]"})})]},m.key))})]},p.type))})]})}function zM({machineId:e,sendDaemonCommand:t}){const[r,n]=x.useState([]),[i,s]=x.useState(0),[o,l]=x.useState(!0),[a,c]=x.useState("debug"),d=x.useRef(null),u=x.useRef(!1);return x.useEffect(()=>{if(!e||!o)return;const f=async()=>{try{const m=await t(e,"get_logs",{count:200,minLevel:a,since:i}),_=(m==null?void 0:m.result)||m;if(m!=null&&m.success&&Array.isArray(_==null?void 0:_.logs)&&_.logs.length>0){n(g=>[...g,..._.logs.map(y=>({timestamp:y.ts,level:y.level,message:`[${y.category}] ${y.message}`}))].slice(-300));const b=Math.max(..._.logs.map(g=>g.ts));s(b)}}catch{}};f();const p=setInterval(f,3e3);return()=>clearInterval(p)},[e,o,i,a,t]),x.useEffect(()=>{if(o&&r.length>0){const f=u.current?"smooth":"instant";setTimeout(()=>{var p;(p=d.current)==null||p.scrollIntoView({behavior:f}),u.current=!0},50)}},[r.length,o]),h.jsxs("div",{children:[h.jsxs("div",{className:"flex justify-between items-center mb-3",children:[h.jsxs("div",{className:"flex gap-1 items-center",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(f=>h.jsx("button",{onClick:()=>{c(f),n([]),s(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${a===f?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:f.toUpperCase()},f))]}),h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsxs("span",{className:"text-[10px] text-text-muted",children:[r.length," entries"]}),h.jsx("button",{onClick:()=>l(!o),className:`machine-btn ${o?"text-green-500 border-green-500/30":""}`,children:o?"⏸ Pause":"▶ Resume"}),h.jsx("button",{onClick:()=>{n([]),s(0)},className:"machine-btn",children:"Clear"})]})]}),h.jsxs("div",{className:"bg-bg-secondary border border-border-subtle rounded-xl p-3 min-h-[200px] max-h-[500px] overflow-y-auto font-mono text-[11px] leading-relaxed",children:[r.length===0&&h.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),r.map((f,p)=>h.jsxs("div",{className:"flex gap-2 py-px",style:{color:f.level==="error"?"#ef4444":f.level==="warn"?"#f59e0b":f.level==="debug"?"#64748b":"#94a3b8"},children:[h.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(f.timestamp).toLocaleTimeString()}),h.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:f.level==="error"?"#ef4444":f.level==="warn"?"#f59e0b":f.level==="debug"?"#475569":"#8b5cf6"},children:f.level==="error"?"ERR":f.level==="warn"?"WRN":f.level==="debug"?"DBG":"INF"}),h.jsx("span",{children:f.message})]},p)),h.jsx("div",{ref:d})]})]})}function $M({machine:e,launchPick:t,actions:r}){const{runLaunchCliCore:n,setLaunchPick:i}=r;return h.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/55 backdrop-blur-[2px]",role:"dialog","aria-modal":"true","aria-labelledby":"launch-pick-title",children:h.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border-subtle bg-bg-secondary shadow-xl p-5",children:[h.jsx("h2",{id:"launch-pick-title",className:"text-sm font-semibold text-text-primary m-0 mb-1",children:"Where should this run?"}),h.jsx("p",{className:"text-[11px] text-text-muted m-0 mb-4",children:"Nothing is assumed. Pick a saved workspace, your default workspace, or home — or cancel and type a path."}),h.jsx("div",{className:"flex flex-col gap-2 mb-4 max-h-48 overflow-y-auto",children:(e.workspaces||[]).length===0?h.jsx("span",{className:"text-[11px] text-text-muted",children:"No saved workspaces yet. Add one in Overview or type a path above."}):(e.workspaces||[]).map(s=>h.jsxs("button",{type:"button",className:"text-left text-xs px-3 py-2 rounded-lg border border-border-subtle bg-bg-primary hover:bg-violet-500/[0.08] transition-colors",onClick:()=>{i(null),n({cliType:t.cliType,workspaceId:s.id,argsStr:t.argsStr,model:t.model})},children:[h.jsx("span",{className:"font-medium text-text-primary block truncate",children:s.label||s.path}),h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:s.path})]},s.id))}),h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",disabled:!e.defaultWorkspacePath,onClick:()=>{i(null),n({cliType:t.cliType,useDefaultWorkspace:!0,argsStr:t.argsStr,model:t.model})},children:"Default workspace"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{i(null),n({cliType:t.cliType,useHome:!0,argsStr:t.argsStr,model:t.model})},children:"Home directory"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>i(null),children:"Cancel"})]})]})})}function FM(){var k,L,S,j,T,B,E,O,R,C;const{id:e}=hx(),t=En(),{sendCommand:r}=ci(),n=np(),i=n.ides||[],s=n.initialLoaded??!0,[o,l]=x.useState("overview"),a=x.useRef(null),c=DM({machineId:e,sendDaemonCommand:r,logsEndRef:a}),d=i.find(P=>P.id===e&&P.daemonMode),u=((d==null?void 0:d.availableProviders)||[]).map(P=>({type:P.type,displayName:P.displayName,icon:P.icon,category:P.category})),f={};for(const P of u)f[P.type]=P.icon;const p=P=>f[P]||"",m=d?{id:d.id,hostname:((k=d.machine)==null?void 0:k.hostname)||d.id,platform:((L=d.machine)==null?void 0:L.platform)||"unknown",arch:((S=d.machine)==null?void 0:S.arch)||"",cpus:((j=d.machine)==null?void 0:j.cpus)||0,totalMem:((T=d.machine)==null?void 0:T.totalMem)||0,freeMem:((B=d.machine)==null?void 0:B.freeMem)||0,availableMem:(E=d.machine)==null?void 0:E.availableMem,loadavg:((O=d.machine)==null?void 0:O.loadavg)||[],uptime:((R=d.machine)==null?void 0:R.uptime)||0,release:((C=d.machine)==null?void 0:C.release)||"",cdpConnected:!!(d.ides||[]).some(P=>P.cdpConnected),machineNickname:d.machineNickname||null,p2p:d.p2p||{available:!1,state:"unavailable",peers:0,screenshotActive:!1},detectedIdes:d.detectedIdes||[],managedIdeIds:d.managedIdeIds||[],managedCliIds:d.managedCliIds||[],workspaces:d.workspaces||[],defaultWorkspaceId:d.defaultWorkspaceId??d.activeWorkspaceId??null,defaultWorkspacePath:d.defaultWorkspacePath??d.activeWorkspacePath??null,workspaceActivity:d.workspaceActivity||[]}:null,_=i.filter(P=>P.daemonId===e&&!P.daemonMode).filter(P=>!y_(P)&&!w_(P)).map(P=>({id:P.id,type:P.type,version:P.version||"",instanceId:P.instanceId||"",status:P.status,workspace:P.workspace||null,terminals:P.terminals||0,aiAgents:oR(P.aiAgents||P.agents||[]),activeChat:P.activeChat||null,chats:P.chats||[],agentStreams:P.agentStreams||[],cdpConnected:P.cdpConnected||!1,daemonId:e})),b=i.filter(P=>P.daemonId===e&&y_(P)).map(P=>({id:P.id,type:P.type,cliName:P.cliName||P.type,status:P.status,workspace:P.workspace||"",activeChat:P.activeChat||null,daemonId:e})),g=i.filter(P=>P.daemonId===e&&w_(P)).map(P=>({id:P.id,type:P.type,acpName:P.cliName||P.type,status:P.status,workspace:P.workspace||"",activeChat:P.activeChat||null,currentModel:P.currentModel,currentPlan:P.currentPlan,daemonId:e}));if(!m)return s?h.jsxs("div",{className:"p-10 text-center text-text-muted",children:[h.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),h.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),h.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):h.jsx("div",{className:"p-10 text-center text-text-muted",children:h.jsx("p",{children:"⏳ Loading machine..."})});const v=m.machineNickname||m.hostname,y=[{id:"overview",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(kP,{size:14})," Overview"]})},{id:"ides",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(ll,{size:14})," IDEs"]}),count:_.length},{id:"clis",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(Ny,{size:14})," CLIs"]}),count:b.length},{id:"acps",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(NP,{size:14})," ACP Agents"]}),count:g.length},{id:"providers",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(Cy,{size:14})," Providers"]})},{id:"logs",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(vP,{size:14})," Logs"]})}];return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"dashboard-header !flex-col !items-stretch",children:[h.jsx("div",{className:"flex items-center justify-between w-full",children:h.jsxs("div",{className:"flex items-center gap-2 md:gap-3.5 w-full min-w-0",children:[h.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back flex shrink-0",children:"←"}),h.jsxs("div",{className:"min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[c.editingNickname?h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsx("input",{autoFocus:!0,value:c.nicknameInput,onChange:P=>c.setNicknameInput(P.target.value),onKeyDown:P=>{P.key==="Enter"&&c.handleSaveNickname(),P.key==="Escape"&&c.setEditingNickname(!1)},placeholder:"Machine nickname...",className:"px-2.5 py-1 rounded-md border border-violet-500/30 bg-bg-secondary text-text-primary text-sm font-semibold w-[140px] md:w-[200px]"}),h.jsx("button",{onClick:c.handleSaveNickname,className:"machine-btn text-green-500 border-green-500/30 shrink-0",children:"✓"}),h.jsx("button",{onClick:()=>c.setEditingNickname(!1),className:"machine-btn shrink-0",children:"✕"})]}):h.jsx("h1",{className:"header-title cursor-pointer truncate",onClick:()=>{c.setEditingNickname(!0),c.setNicknameInput(m.machineNickname||"")},title:"Click to set nickname",children:v}),h.jsx("span",{className:"status-dot-md online shrink-0"})]}),h.jsxs("div",{className:"header-subtitle mt-1 flex-wrap gap-1 md:gap-2 items-center display-none-mobile",children:[h.jsxs("span",{children:[m.platform," · ",m.arch," · ",m.cpus," cores"]}),m.p2p.available&&h.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:m.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:m.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",m.p2p.state==="connected"?`● ${m.p2p.peers}`:"○"]}),m.cdpConnected&&h.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500 shrink-0",children:"CDP ●"}),m.machineNickname&&h.jsxs("span",{className:"text-text-muted opacity-80 shrink-0",children:["(",m.hostname,")"]})]})]})]})}),h.jsx("div",{className:"machine-tabs w-full overflow-x-auto overflow-y-hidden pb-1 -mb-1 mt-2",children:y.map(P=>h.jsxs("button",{onClick:()=>l(P.id),className:`machine-tab shrink-0${o===P.id?" active":""}`,children:[P.label,P.count!==void 0&&h.jsx("span",{className:"tab-count",children:P.count})]},P.id))})]}),h.jsxs("div",{className:"page-content",children:[o==="overview"&&h.jsx(AM,{machine:m,managedIdes:_,managedClis:b,managedAcps:g,providers:u,getIcon:p,actions:c,setActiveTab:P=>l(P)}),o==="ides"&&h.jsx(BM,{machine:m,machineId:e,managedIdes:_,getIcon:p,actions:c,sendDaemonCommand:r}),o==="clis"&&h.jsx(D_,{category:"cli",machine:m,providers:u,managedEntries:b,getIcon:p,actions:c}),o==="acps"&&h.jsx(D_,{category:"acp",machine:m,providers:u,managedEntries:g,getIcon:p,actions:c}),o==="providers"&&h.jsx(OM,{machineId:e,providers:u,sendDaemonCommand:r}),o==="logs"&&h.jsx(zM,{machineId:e,sendDaemonCommand:r})]}),c.launchPick&&m&&h.jsx($M,{machine:m,launchPick:c.launchPick,actions:c})]})}function WM(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new URLSearchParams(window.location.search).get("token");return n?`${t}?token=${encodeURIComponent(n)}`:t}const j_=WM(),A_=3e3,HM=3e4;let mn=null,UM=0;const Xa=new Map,Td=new Set;let gi=null;async function ua(e,t,r){const n=mn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++UM}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{Xa.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);Xa.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),n.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:r||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:r||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class VM{constructor(t){js(this,"daemonId");js(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(mn==null?void 0:mn.readyState)===WebSocket.OPEN}get connectionState(){return(mn==null?void 0:mn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return ua(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId;return ua(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,gi&&(clearInterval(gi),gi=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId,i=await ua(n,"screenshot",{width:1280});if(i!=null&&i.success&&(i!=null&&i.base64)){const s=await fetch(`data:image/jpeg;base64,${i.base64}`).then(o=>o.blob());Td.forEach(o=>o(this.daemonId,s))}}catch{}};r(),gi=setInterval(r,2e3)}stopScreenshots(t){gi&&(clearInterval(gi),gi=null)}}let _i=null;function KM(e){(!_i||_i.daemonId!==e)&&(_i=new VM(e));const t=vr._originalGet||vr.get.bind(vr);vr._originalGet=t,vr.get=r=>r===e||r.startsWith("standalone")?_i:t(r),vr.getState=r=>(r===e||r.startsWith("standalone"))&&(_i==null?void 0:_i.connectionState)||"disconnected",vr.onScreenshot=(r,n)=>(Td.add(n),()=>{Td.delete(n)})}function qM({children:e}){const t=x.useRef(Sm()),r=Sm();t.current=r;const{setUserName:n}=Ho(),i=x.useRef(n);i.current=n;const[,s]=x.useState("disconnected"),o=x.useRef(null),l=x.useRef(),a=x.useRef(A_),c=x.useRef(!0);return x.useEffect(()=>{c.current=!0;function d(){var p,m;if(!c.current||((p=o.current)==null?void 0:p.readyState)===WebSocket.OPEN||((m=o.current)==null?void 0:m.readyState)===WebSocket.CONNECTING)return;s("connecting"),console.log(`[Standalone WS] Connecting to ${j_}...`);let f;try{f=new WebSocket(j_)}catch(_){console.error("[Standalone WS] Failed to create WebSocket:",_),u();return}o.current=f,f.onopen=()=>{if(!c.current){f.close();return}s("connected"),a.current=A_,console.log("[Standalone WS] Connected")},mn=f,f.onmessage=_=>{var b;try{const g=JSON.parse(_.data);if((g.type==="command_result"||g.type==="error")&&g.requestId){const v=Xa.get(g.requestId);v&&(Xa.delete(g.requestId),g.type==="error"?v.reject(new Error(((b=g.data)==null?void 0:b.message)||"Command failed")):v.resolve(g.data));return}if(g.type==="status"||g.type==="initial_state"){const v=g.data;if(!v)return;const{injectEntries:y,markLoaded:k}=t.current,L=v.id||"standalone";KM(L);const S=dR(v,{daemonId:L});S.length>0&&y(S),k(),v.userName&&i.current&&i.current(v.userName)}}catch(g){console.error("[Standalone WS] Parse error:",g)}},f.onclose=()=>{c.current&&(s("disconnected"),o.current=null,u())},f.onerror=_=>{console.warn("[Standalone WS] Error, will reconnect:",_)}}function u(){if(!c.current)return;clearTimeout(l.current);const f=a.current;console.log(`[Standalone WS] Reconnecting in ${f}ms...`),l.current=setTimeout(()=>{a.current=Math.min(a.current*1.5,HM),d()},f)}return d(),()=>{c.current=!1,clearTimeout(l.current),o.current&&(o.current.onclose=null,o.current.close(),o.current=null,mn=null)}},[]),h.jsx(h.Fragment,{children:e})}function YM({children:e}){return h.jsx(mk,{children:h.jsx(qM,{children:e})})}const XM=[{id:"dashboard",path:"/dashboard",icon:h.jsx(gP,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:h.jsx(_P,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:h.jsx(Cy,{}),label:"Settings"}];function GM({children:e}){const t=En(),r=nl(),[n,i]=x.useState(!1),[s,o]=x.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=d=>{t(d),i(!1)},a=()=>{o(d=>{const u=!d;try{localStorage.setItem("sidebar-collapsed",u?"1":"0")}catch{}return u})},c=d=>`nav-item${r.pathname.startsWith(d)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return h.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[h.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[h.jsx("span",{className:"mobile-menu-icon"}),h.jsx("span",{className:"mobile-menu-icon"}),h.jsx("span",{className:"mobile-menu-icon"})]}),n&&h.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:d=>d.key==="Escape"&&i(!1)}),h.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[h.jsxs("div",{className:"sidebar-header",children:[h.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[h.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&h.jsx("span",{children:"ADHDev"})]}),h.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),h.jsx("nav",{className:"sidebar-nav",children:XM.map(d=>h.jsxs("div",{className:c(d.path),id:`nav-${d.id}`,onClick:()=>l(d.path),title:s?d.label:void 0,children:[h.jsx("span",{className:"nav-icon",children:d.icon}),!s&&d.label]},d.id))}),h.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[h.jsxs("div",{className:`nav-item cursor-pointer${r.pathname==="/about"?" active":""} ${s?"justify-center py-2.5 px-0":""}`,id:"nav-about",onClick:()=>t("/about"),title:s?"About":void 0,children:[h.jsx("span",{className:"nav-icon",children:h.jsx(xP,{})}),!s&&"About"]}),!s&&h.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.41"]}),h.jsx(uM,{collapsed:s}),h.jsxs("div",{className:`nav-item cursor-pointer ${s?"justify-center py-2.5 px-0":"mt-1"}`,onClick:a,title:s?"Expand sidebar":"Collapse sidebar",children:[h.jsx("span",{className:"nav-icon text-base",children:s?"›":"‹"}),!s&&h.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),h.jsx("main",{className:"main-content relative",children:h.jsx("div",{className:"main-content-inner",children:e})})]})}const QM=[{icon:"🏠",title:"Local-first",desc:"Everything runs on your machine. No data leaves your network. Full privacy by design."},{icon:"💬",title:"Agent chat relay",desc:"Read and respond to AI conversations in real-time across all connected IDEs."},{icon:"📸",title:"Live screenshots",desc:"View your IDE screens directly in the browser via local WebSocket streaming."},{icon:"🎛️",title:"Remote control",desc:"Click, type, and interact with your IDE from the dashboard — no window switching."},{icon:"🔌",title:"Multi-IDE support",desc:"Monitor and control multiple IDEs simultaneously — VS Code, Cursor, Windsurf, and more."},{icon:"⚡",title:"Extension agents",desc:"Manage extension-based agents like Cline and Roo Code alongside native IDE agents."}],JM=[{icon:"🌍",title:"Access from anywhere",desc:"Control your agents from any device, any network. No VPN or port forwarding needed."},{icon:"🔗",title:"WebRTC P2P streaming",desc:"End-to-end encrypted peer-to-peer connection for zero-latency remote screenshots and control."},{icon:"📱",title:"Mobile notifications",desc:"Get push notifications when agents need approval. Quick approve/reject from your phone."},{icon:"📡",title:"REST API access",desc:"Integrate with Slack, CI/CD pipelines, or custom tools. Scoped API keys with granular permissions."},{icon:"👥",title:"Team dashboard",desc:"Share a unified view across your team. See who's running what, where, in real time."},{icon:"🔐",title:"Enterprise security",desc:"SSO, RBAC, audit logs, and SLA guarantees for production teams."}],ZM=[{feature:"Agent chat relay",selfhost:!0,cloud:!0},{feature:"Live IDE screenshots",selfhost:!0,cloud:!0},{feature:"Remote IDE control",selfhost:!0,cloud:!0},{feature:"Multi-IDE monitoring",selfhost:!0,cloud:!0},{feature:"Extension agent support",selfhost:!0,cloud:!0},{feature:"CLI agent support",selfhost:!0,cloud:!0},{feature:"Access from any network",selfhost:!1,cloud:!0},{feature:"WebRTC P2P streaming",selfhost:!1,cloud:!0},{feature:"Mobile push notifications",selfhost:!1,cloud:!0},{feature:"REST API & webhooks",selfhost:!1,cloud:!0},{feature:"Team collaboration",selfhost:!1,cloud:!0},{feature:"Multi-machine (Burrows)",selfhost:!1,cloud:!0},{feature:"SSO / RBAC / Audit logs",selfhost:!1,cloud:!0}],ju={ides:["VS Code","Cursor","Antigravity","Windsurf","Trae","PearAI","Kiro","VSCodium","VS Code Insiders"],agents:["GitHub Copilot","Cline","Roo Code"],cli:["Gemini CLI","Claude Code","Codex CLI"]};function eI(){return h.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[h.jsxs("div",{className:"text-center mb-10",children:[h.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),h.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),h.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev — Self-hosted Edition"}),h.jsxs("div",{className:"inline-block mt-3 px-3 py-1 text-[11px] font-semibold tracking-wide rounded-full bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:["SELFHOST v","0.5.41"]})]}),h.jsxs("section",{className:"mb-10",children:[h.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[h.jsx("span",{className:"text-base",children:"✅"})," What's included"]}),h.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:QM.map(e=>h.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[h.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),h.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),h.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),h.jsxs("section",{className:"mb-10",children:[h.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),h.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-5",children:[{label:"IDEs",items:ju.ides},{label:"Extension agents",items:ju.agents},{label:"CLI agents",items:ju.cli}].map(e=>h.jsxs("div",{children:[h.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),h.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>h.jsx("div",{className:"text-[12px] px-2.5 py-1.5 bg-bg-glass rounded-md border border-border-subtle",children:t},t))})]},e.label))})]}),h.jsxs("section",{className:"mb-10",children:[h.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[h.jsx("span",{className:"text-base",children:"⚖️"})," Self-hosted vs Cloud"]}),h.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:h.jsxs("table",{className:"w-full text-[13px]",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"bg-bg-secondary",children:[h.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),h.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),h.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),h.jsx("tbody",{children:ZM.map((e,t)=>h.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[h.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),h.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?h.jsx("span",{className:"text-emerald-500",children:"✓"}):h.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),h.jsx("td",{className:"text-center px-4 py-2",children:h.jsx("span",{className:"text-emerald-500",children:"✓"})})]},e.feature))})]})})]}),h.jsx("section",{className:"mb-10",children:h.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:h.jsxs("div",{className:"flex items-start gap-4",children:[h.jsx("div",{className:"text-3xl shrink-0",children:"🚀"}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),h.jsx("p",{className:"text-[13px] text-text-muted leading-relaxed mb-4",children:"Access your agents from anywhere — your phone, another laptop, or a coffee shop. Cloud adds WebRTC P2P streaming, mobile push notifications, REST API, team collaboration, and multi-machine support. Your local setup stays exactly the same."}),h.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:JM.map(e=>h.jsxs("div",{className:"flex gap-2.5 items-start",children:[h.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),h.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),h.jsxs("div",{className:"flex gap-3 flex-wrap",children:[h.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Try ADHDev Cloud →"}),h.jsx("a",{href:"https://github.com/vilmire/adhdev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"GitHub"}),h.jsx("a",{href:"https://discord.gg/WJD3tCfBzk",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Discord"})]})]})]})})}),h.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[h.jsx("p",{children:"© 2026 ADHDev · Your AI sidekick otter 🦦"}),h.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition — all data stays on your machine"})]})]})}function tI(){const{ides:e}=Ho(),t=e.find(u=>u.type==="adhdev-daemon"),r=(t==null?void 0:t.detectedIdes)||[],{sendCommand:n}=ci(),{userName:i}=Ho(),[s,o]=x.useState(i||"");x.useEffect(()=>{i!==void 0&&o(i)},[i]);const l=u=>{const f=u.target.value.trim();t!=null&&t.id&&f!==i&&n(t.id,"set_user_name",{userName:f}).catch(console.error)},[a,c]=x.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),d=u=>{c(u);try{localStorage.setItem("adhdev_sound",u?"1":"0")}catch{}};return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsx(nM,{icon:"⚙️",title:"Settings",subtitle:"Local daemon configuration & preferences"}),h.jsxs("div",{className:"page-content",children:[h.jsx(Zs,{title:"Daemon",className:"mb-4",children:h.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-x-4 gap-y-2.5 text-sm",children:[h.jsx("span",{className:"text-text-muted",children:"Version"}),h.jsxs("span",{className:"font-mono text-xs",children:["v","0.5.41"]}),h.jsx("span",{className:"text-text-muted",children:"Status"}),h.jsx("span",{className:t?"text-green-400":"text-yellow-400",children:t?"● Running":"○ Not connected"}),h.jsx("span",{className:"text-text-muted",children:"WebSocket"}),h.jsx("span",{className:"font-mono text-xs",children:"ws://localhost:19222"}),h.jsx("span",{className:"text-text-muted",children:"HTTP"}),h.jsx("span",{className:"font-mono text-xs",children:"http://localhost:19280"})]})}),h.jsx(Zs,{title:"Detected IDEs",className:"mb-4",children:r.length===0?h.jsx("p",{className:"text-sm text-text-muted",children:"No IDEs detected. Start an IDE to see it here."}):h.jsx("div",{className:"flex flex-col gap-1.5",children:r.map(u=>h.jsxs("div",{className:"flex justify-between items-center bg-bg-glass rounded-lg px-3.5 py-2.5",children:[h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx("span",{className:`w-2 h-2 rounded-full ${u.running?"bg-green-400":"bg-text-muted/30"}`}),h.jsx("span",{className:"text-sm font-medium",children:u.name})]}),h.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:u.type})]},u.type))})}),h.jsx(Zs,{title:"Machine",className:"mb-4",children:h.jsx(_M,{ides:e,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),h.jsx(Zs,{title:"Notifications",className:"mb-4",children:h.jsx(gM,{})}),h.jsx(Zs,{title:"Preferences",className:"mb-4",children:h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsxs("div",{className:"flex items-center justify-between px-3.5 py-4 bg-bg-glass rounded-xl border border-border-subtle hover:border-border-hover transition-colors",children:[h.jsxs("div",{className:"flex flex-col gap-1 pr-4 max-w-[500px]",children:[h.jsx("span",{className:"text-sm font-semibold flex items-center gap-2",children:"👤 Display Name"}),h.jsx("span",{className:"text-[12px] text-text-muted leading-relaxed",children:"Your name shown in chat threads and on the team dashboard."})]}),h.jsx("input",{type:"text",className:"bg-bg-primary border border-border-strong rounded-lg px-3 py-1.5 text-sm w-48 text-right focus:border-accent-primary focus:outline-none transition-colors",placeholder:"Anonymous",value:s,onChange:u=>o(u.target.value),onBlur:l,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur()}})]}),h.jsx(Xi,{label:"🔊 Sound Effects",description:"Play a sound when agent completes or needs approval",checked:a,onChange:d})]})})]})]})}function B_(){const{ides:e}=Ho(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?h.jsx(Zl,{to:`/machines/${t.id}`,replace:!0}):e.length>0?h.jsx(Zl,{to:`/machines/${e[0].id}`,replace:!0}):h.jsx(Zl,{to:"/dashboard",replace:!0})}function rI(){return h.jsx(fk,{children:h.jsx(YM,{children:h.jsx(xk,{value:{sendCommand:ua,sendData:()=>!1},children:h.jsx(GM,{children:h.jsxs(ck,{children:[h.jsx(dn,{path:"/dashboard",element:h.jsx(RM,{})}),h.jsx(dn,{path:"/ide/:id",element:h.jsx(IM,{})}),h.jsx(dn,{path:"/machine",element:h.jsx(B_,{})}),h.jsx(dn,{path:"/machines/:id",element:h.jsx(FM,{})}),h.jsx(dn,{path:"/machines",element:h.jsx(B_,{})}),h.jsx(dn,{path:"/about",element:h.jsx(eI,{})}),h.jsx(dn,{path:"/settings",element:h.jsx(tI,{})}),h.jsx(dn,{path:"*",element:h.jsx(Zl,{to:"/dashboard",replace:!0})})]})})})})})}tx(document.getElementById("root")).render(h.jsx(x.StrictMode,{children:h.jsx(rI,{})}));