@adhdev/daemon-standalone 0.5.7 → 0.5.8

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.
@@ -22,7 +22,7 @@ var l1=Object.defineProperty;var a1=(e,t,r)=>t in e?l1(e,t,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(I,H){var b=I.length;I.push(H);e:for(;0<b;){var te=b-1>>>1,ae=I[te];if(0<i(ae,H))I[te]=H,I[b]=ae,b=te;else break e}}function r(I){return I.length===0?null:I[0]}function n(I){if(I.length===0)return null;var H=I[0],b=I.pop();if(b!==H){I[0]=b;e:for(var te=0,ae=I.length,k=ae>>>1;te<k;){var ye=2*(te+1)-1,G=I[ye],Z=ye+1,X=I[Z];if(0>i(G,b))Z<ae&&0>i(X,G)?(I[te]=X,I[Z]=b,te=Z):(I[te]=G,I[ye]=b,te=ye);else if(Z<ae&&0>i(X,b))I[te]=X,I[Z]=b,te=Z;else break e}}return H}function i(I,H){var b=I.sortIndex-H.sortIndex;return b!==0?b:I.id-H.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,g=!1,S=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(I){for(var H=r(c);H!==null;){if(H.callback===null)n(c);else if(H.startTime<=I)n(c),H.sortIndex=H.expirationTime,t(a,H);else break;H=r(c)}}function N(I){if(g=!1,x(I),!m)if(r(a)!==null)m=!0,O(T);else{var H=r(c);H!==null&&K(N,H.startTime-I)}}function T(I,H){m=!1,g&&(g=!1,_(F),F=-1),p=!0;var b=f;try{for(x(H),u=r(a);u!==null&&(!(u.expirationTime>H)||I&&!U());){var te=u.callback;if(typeof te=="function"){u.callback=null,f=u.priorityLevel;var ae=te(u.expirationTime<=H);H=e.unstable_now(),typeof ae=="function"?u.callback=ae:u===r(a)&&n(a),x(H)}else n(a);u=r(a)}if(u!==null)var k=!0;else{var ye=r(c);ye!==null&&K(N,ye.startTime-H),k=!1}return k}finally{u=null,f=b,p=!1}}var C=!1,M=null,F=-1,$=5,E=-1;function U(){return!(e.unstable_now()-E<$)}function j(){if(M!==null){var I=e.unstable_now();E=I;var H=!0;try{H=M(!0,I)}finally{H?A():(C=!1,M=null)}}else C=!1}var A;if(typeof y=="function")A=function(){y(j)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,D=V.port2;V.port1.onmessage=j,A=function(){D.postMessage(null)}}else A=function(){S(j,0)};function O(I){M=I,C||(C=!0,A())}function K(I,H){F=S(function(){I(e.unstable_now())},H)}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(I){I.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,O(T))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(a)},e.unstable_next=function(I){switch(f){case 1:case 2:case 3:var H=3;break;default:H=f}var b=f;f=H;try{return I()}finally{f=b}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,H){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var b=f;f=I;try{return H()}finally{f=b}},e.unstable_scheduleCallback=function(I,H,b){var te=e.unstable_now();switch(typeof b=="object"&&b!==null?(b=b.delay,b=typeof b=="number"&&0<b?te+b:te):b=te,I){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=b+ae,I={id:d++,callback:H,priorityLevel:I,startTime:b,expirationTime:ae,sortIndex:-1},b>te?(I.sortIndex=b,t(c,I),r(a)===null&&I===r(c)&&(g?(_(F),F=-1):g=!0,K(N,b-te))):(I.sortIndex=ae,t(a,I),m||p||(m=!0,O(T))),I},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(I){var H=f;return function(){var b=f;f=H;try{return I.apply(this,arguments)}finally{f=b}}}})(R_);I_.exports=R_;var R1=I_.exports;/**
25
+ */(function(e){function t(R,$){var b=R.length;R.push($);e:for(;0<b;){var te=b-1>>>1,ae=R[te];if(0<i(ae,$))R[te]=$,R[b]=ae,b=te;else break e}}function r(R){return R.length===0?null:R[0]}function n(R){if(R.length===0)return null;var $=R[0],b=R.pop();if(b!==$){R[0]=b;e:for(var te=0,ae=R.length,k=ae>>>1;te<k;){var ye=2*(te+1)-1,G=R[ye],Z=ye+1,X=R[Z];if(0>i(G,b))Z<ae&&0>i(X,G)?(R[te]=X,R[Z]=b,te=Z):(R[te]=G,R[ye]=b,te=ye);else if(Z<ae&&0>i(X,b))R[te]=X,R[Z]=b,te=Z;else break e}}return $}function i(R,$){var b=R.sortIndex-$.sortIndex;return b!==0?b:R.id-$.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,g=!1,S=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(R){for(var $=r(c);$!==null;){if($.callback===null)n(c);else if($.startTime<=R)n(c),$.sortIndex=$.expirationTime,t(a,$);else break;$=r(c)}}function N(R){if(g=!1,x(R),!m)if(r(a)!==null)m=!0,B(T);else{var $=r(c);$!==null&&K(N,$.startTime-R)}}function T(R,$){m=!1,g&&(g=!1,_(F),F=-1),p=!0;var b=f;try{for(x($),u=r(a);u!==null&&(!(u.expirationTime>$)||R&&!U());){var te=u.callback;if(typeof te=="function"){u.callback=null,f=u.priorityLevel;var ae=te(u.expirationTime<=$);$=e.unstable_now(),typeof ae=="function"?u.callback=ae:u===r(a)&&n(a),x($)}else n(a);u=r(a)}if(u!==null)var k=!0;else{var ye=r(c);ye!==null&&K(N,ye.startTime-$),k=!1}return k}finally{u=null,f=b,p=!1}}var C=!1,A=null,F=-1,W=5,E=-1;function U(){return!(e.unstable_now()-E<W)}function O(){if(A!==null){var R=e.unstable_now();E=R;var $=!0;try{$=A(!0,R)}finally{$?D():(C=!1,A=null)}}else C=!1}var D;if(typeof y=="function")D=function(){y(O)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,I=V.port2;V.port1.onmessage=O,D=function(){I.postMessage(null)}}else D=function(){S(O,0)};function B(R){A=R,C||(C=!0,D())}function K(R,$){F=S(function(){R(e.unstable_now())},$)}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(R){R.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,B(T))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(a)},e.unstable_next=function(R){switch(f){case 1:case 2:case 3:var $=3;break;default:$=f}var b=f;f=$;try{return R()}finally{f=b}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,$){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var b=f;f=R;try{return $()}finally{f=b}},e.unstable_scheduleCallback=function(R,$,b){var te=e.unstable_now();switch(typeof b=="object"&&b!==null?(b=b.delay,b=typeof b=="number"&&0<b?te+b:te):b=te,R){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=b+ae,R={id:d++,callback:$,priorityLevel:R,startTime:b,expirationTime:ae,sortIndex:-1},b>te?(R.sortIndex=b,t(c,R),r(a)===null&&R===r(c)&&(g?(_(F),F=-1):g=!0,K(N,b-te))):(R.sortIndex=ae,t(a,R),m||p||(m=!0,B(T))),R},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(R){var $=f;return function(){var b=f;f=$;try{return R.apply(this,arguments)}finally{f=b}}}})(R_);I_.exports=R_;var R1=I_.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -34,8 +34,8 @@ var l1=Object.defineProperty;var a1=(e,t,r)=>t in e?l1(e,t,{enumerable:!0,config
34
34
  `+oc+e}var lc=!1;function ac(e,t){if(!e||lc)return"";lc=!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
35
  `),s=n.stack.split(`
36
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{lc=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?zs(e):""}function z1(e){switch(e.tag){case 5:return zs(e.type);case 16:return zs("Lazy");case 13:return zs("Suspense");case 19:return zs("SuspenseList");case 0:case 2:case 15:return e=ac(e.type,!1),e;case 11:return e=ac(e.type.render,!1),e;case 1:return e=ac(e.type,!0),e;default:return""}}function gu(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 Oi:return"Fragment";case Bi:return"Portal";case fu:return"Profiler";case dd:return"StrictMode";case pu:return"Suspense";case mu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case j_:return(e.displayName||"Context")+".Consumer";case A_:return(e._context.displayName||"Context")+".Provider";case fd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case pd:return t=e.displayName||null,t!==null?t:gu(e.type)||"Memo";case Tn:t=e._payload,e=e._init;try{return gu(e(t))}catch{}}return null}function F1(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 gu(t);case 8:return t===dd?"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 Kn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function O_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $1(e){var t=O_(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 Zo(e){e._valueTracker||(e._valueTracker=$1(e))}function z_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=O_(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function ql(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 _u(e,t){var r=t.checked;return Ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Jf(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Kn(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 F_(e,t){t=t.checked,t!=null&&hd(e,"checked",t,!1)}function vu(e,t){F_(e,t);var r=Kn(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")?yu(e,t.type,r):t.hasOwnProperty("defaultValue")&&yu(e,t.type,Kn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ep(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 yu(e,t,r){(t!=="number"||ql(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Fs=Array.isArray;function Gi(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=""+Kn(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 xu(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(re(91));return Ge({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function tp(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(re(92));if(Fs(r)){if(1<r.length)throw Error(re(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Kn(r)}}function $_(e,t){var r=Kn(t.value),n=Kn(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 rp(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function W_(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 wu(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?W_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Jo,H_=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(Jo=Jo||document.createElement("div"),Jo.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Jo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function uo(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Ys={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},W1=["Webkit","ms","Moz","O"];Object.keys(Ys).forEach(function(e){W1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ys[t]=Ys[e]})});function U_(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Ys.hasOwnProperty(e)&&Ys[e]?(""+t).trim():t+"px"}function V_(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=U_(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var H1=Ge({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 Su(e,t){if(t){if(H1[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(re(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(re(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(re(61))}if(t.style!=null&&typeof t.style!="object")throw Error(re(62))}}function bu(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 ku=null;function md(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Cu=null,Qi=null,Zi=null;function np(e){if(e=Bo(e)){if(typeof Cu!="function")throw Error(re(280));var t=e.stateNode;t&&(t=Ra(t),Cu(e.stateNode,e.type,t))}}function K_(e){Qi?Zi?Zi.push(e):Zi=[e]:Qi=e}function q_(){if(Qi){var e=Qi,t=Zi;if(Zi=Qi=null,np(e),t)for(e=0;e<t.length;e++)np(t[e])}}function Y_(e,t){return e(t)}function X_(){}var cc=!1;function G_(e,t,r){if(cc)return e(t,r);cc=!0;try{return Y_(e,t,r)}finally{cc=!1,(Qi!==null||Zi!==null)&&(X_(),q_())}}function ho(e,t){var r=e.stateNode;if(r===null)return null;var n=Ra(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(re(231,t,typeof r));return r}var Eu=!1;if(pn)try{var bs={};Object.defineProperty(bs,"passive",{get:function(){Eu=!0}}),window.addEventListener("test",bs,bs),window.removeEventListener("test",bs,bs)}catch{Eu=!1}function U1(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 Xs=!1,Yl=null,Xl=!1,Nu=null,V1={onError:function(e){Xs=!0,Yl=e}};function K1(e,t,r,n,i,s,o,l,a){Xs=!1,Yl=null,U1.apply(V1,arguments)}function q1(e,t,r,n,i,s,o,l,a){if(K1.apply(this,arguments),Xs){if(Xs){var c=Yl;Xs=!1,Yl=null}else throw Error(re(198));Xl||(Xl=!0,Nu=c)}}function Ti(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 Q_(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 ip(e){if(Ti(e)!==e)throw Error(re(188))}function Y1(e){var t=e.alternate;if(!t){if(t=Ti(e),t===null)throw Error(re(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 ip(i),e;if(s===n)return ip(i),t;s=s.sibling}throw Error(re(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(re(189))}}if(r.alternate!==n)throw Error(re(190))}if(r.tag!==3)throw Error(re(188));return r.stateNode.current===r?e:t}function Z_(e){return e=Y1(e),e!==null?J_(e):null}function J_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=J_(e);if(t!==null)return t;e=e.sibling}return null}var ev=dr.unstable_scheduleCallback,sp=dr.unstable_cancelCallback,X1=dr.unstable_shouldYield,G1=dr.unstable_requestPaint,rt=dr.unstable_now,Q1=dr.unstable_getCurrentPriorityLevel,gd=dr.unstable_ImmediatePriority,tv=dr.unstable_UserBlockingPriority,Gl=dr.unstable_NormalPriority,Z1=dr.unstable_LowPriority,rv=dr.unstable_IdlePriority,La=null,Zr=null;function J1(e){if(Zr&&typeof Zr.onCommitFiberRoot=="function")try{Zr.onCommitFiberRoot(La,e,void 0,(e.current.flags&128)===128)}catch{}}var zr=Math.clz32?Math.clz32:rw,ew=Math.log,tw=Math.LN2;function rw(e){return e>>>=0,e===0?32:31-(ew(e)/tw|0)|0}var el=64,tl=4194304;function $s(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 Ql(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=$s(l):(s&=o,s!==0&&(n=$s(s)))}else o=r&~i,o!==0?n=$s(o):s!==0&&(n=$s(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-zr(t),i=1<<r,n|=e[r],t&=~i;return n}function nw(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 iw(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-zr(s),l=1<<o,a=i[o];a===-1?(!(l&r)||l&n)&&(i[o]=nw(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function Tu(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function nv(){var e=el;return el<<=1,!(el&4194240)&&(el=64),e}function uc(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Ao(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-zr(t),e[t]=r}function sw(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-zr(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function _d(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-zr(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var Me=0;function iv(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var sv,vd,ov,lv,av,Lu=!1,rl=[],Bn=null,On=null,zn=null,fo=new Map,po=new Map,Dn=[],ow="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 op(e,t){switch(e){case"focusin":case"focusout":Bn=null;break;case"dragenter":case"dragleave":On=null;break;case"mouseover":case"mouseout":zn=null;break;case"pointerover":case"pointerout":fo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":po.delete(t.pointerId)}}function ks(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=Bo(t),t!==null&&vd(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function lw(e,t,r,n,i){switch(t){case"focusin":return Bn=ks(Bn,e,t,r,n,i),!0;case"dragenter":return On=ks(On,e,t,r,n,i),!0;case"mouseover":return zn=ks(zn,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return fo.set(s,ks(fo.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,po.set(s,ks(po.get(s)||null,e,t,r,n,i)),!0}return!1}function cv(e){var t=hi(e.target);if(t!==null){var r=Ti(t);if(r!==null){if(t=r.tag,t===13){if(t=Q_(r),t!==null){e.blockedOn=t,av(e.priority,function(){ov(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 Cl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Pu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);ku=n,r.target.dispatchEvent(n),ku=null}else return t=Bo(r),t!==null&&vd(t),e.blockedOn=r,!1;t.shift()}return!0}function lp(e,t,r){Cl(e)&&r.delete(t)}function aw(){Lu=!1,Bn!==null&&Cl(Bn)&&(Bn=null),On!==null&&Cl(On)&&(On=null),zn!==null&&Cl(zn)&&(zn=null),fo.forEach(lp),po.forEach(lp)}function Cs(e,t){e.blockedOn===t&&(e.blockedOn=null,Lu||(Lu=!0,dr.unstable_scheduleCallback(dr.unstable_NormalPriority,aw)))}function mo(e){function t(i){return Cs(i,e)}if(0<rl.length){Cs(rl[0],e);for(var r=1;r<rl.length;r++){var n=rl[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Bn!==null&&Cs(Bn,e),On!==null&&Cs(On,e),zn!==null&&Cs(zn,e),fo.forEach(t),po.forEach(t),r=0;r<Dn.length;r++)n=Dn[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Dn.length&&(r=Dn[0],r.blockedOn===null);)cv(r),r.blockedOn===null&&Dn.shift()}var Ji=vn.ReactCurrentBatchConfig,Zl=!0;function cw(e,t,r,n){var i=Me,s=Ji.transition;Ji.transition=null;try{Me=1,yd(e,t,r,n)}finally{Me=i,Ji.transition=s}}function uw(e,t,r,n){var i=Me,s=Ji.transition;Ji.transition=null;try{Me=4,yd(e,t,r,n)}finally{Me=i,Ji.transition=s}}function yd(e,t,r,n){if(Zl){var i=Pu(e,t,r,n);if(i===null)xc(e,t,n,Jl,r),op(e,n);else if(lw(i,e,t,r,n))n.stopPropagation();else if(op(e,n),t&4&&-1<ow.indexOf(e)){for(;i!==null;){var s=Bo(i);if(s!==null&&sv(s),s=Pu(e,t,r,n),s===null&&xc(e,t,n,Jl,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else xc(e,t,n,null,r)}}var Jl=null;function Pu(e,t,r,n){if(Jl=null,e=md(n),e=hi(e),e!==null)if(t=Ti(e),t===null)e=null;else if(r=t.tag,r===13){if(e=Q_(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 Jl=e,null}function uv(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(Q1()){case gd:return 1;case tv:return 4;case Gl:case Z1:return 16;case rv:return 536870912;default:return 16}default:return 16}}var Rn=null,xd=null,El=null;function hv(){if(El)return El;var e,t=xd,r=t.length,n,i="value"in Rn?Rn.value:Rn.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 El=i.slice(e,1<n?1-n:void 0)}function Nl(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 nl(){return!0}function ap(){return!1}function pr(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)?nl:ap,this.isPropagationStopped=ap,this}return Ge(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=nl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=nl)},persist:function(){},isPersistent:nl}),t}var fs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wd=pr(fs),jo=Ge({},fs,{view:0,detail:0}),hw=pr(jo),hc,dc,Es,Pa=Ge({},jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sd,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!==Es&&(Es&&e.type==="mousemove"?(hc=e.screenX-Es.screenX,dc=e.screenY-Es.screenY):dc=hc=0,Es=e),hc)},movementY:function(e){return"movementY"in e?e.movementY:dc}}),cp=pr(Pa),dw=Ge({},Pa,{dataTransfer:0}),fw=pr(dw),pw=Ge({},jo,{relatedTarget:0}),fc=pr(pw),mw=Ge({},fs,{animationName:0,elapsedTime:0,pseudoElement:0}),gw=pr(mw),_w=Ge({},fs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vw=pr(_w),yw=Ge({},fs,{data:0}),up=pr(yw),xw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ww={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"},Sw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sw[e])?!!t[e]:!1}function Sd(){return bw}var kw=Ge({},jo,{key:function(e){if(e.key){var t=xw[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Nl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ww[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sd,charCode:function(e){return e.type==="keypress"?Nl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Nl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Cw=pr(kw),Ew=Ge({},Pa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hp=pr(Ew),Nw=Ge({},jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sd}),Tw=pr(Nw),Lw=Ge({},fs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pw=pr(Lw),Dw=Ge({},Pa,{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}),Iw=pr(Dw),Rw=[9,13,27,32],bd=pn&&"CompositionEvent"in window,Gs=null;pn&&"documentMode"in document&&(Gs=document.documentMode);var Mw=pn&&"TextEvent"in window&&!Gs,dv=pn&&(!bd||Gs&&8<Gs&&11>=Gs),dp=" ",fp=!1;function fv(e,t){switch(e){case"keyup":return Rw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zi=!1;function Aw(e,t){switch(e){case"compositionend":return pv(t);case"keypress":return t.which!==32?null:(fp=!0,dp);case"textInput":return e=t.data,e===dp&&fp?null:e;default:return null}}function jw(e,t){if(zi)return e==="compositionend"||!bd&&fv(e,t)?(e=hv(),El=xd=Rn=null,zi=!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 Bw={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 pp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Bw[e.type]:t==="textarea"}function mv(e,t,r,n){K_(n),t=ea(t,"onChange"),0<t.length&&(r=new wd("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Qs=null,go=null;function Ow(e){Ev(e,0)}function Da(e){var t=Wi(e);if(z_(t))return e}function zw(e,t){if(e==="change")return t}var gv=!1;if(pn){var pc;if(pn){var mc="oninput"in document;if(!mc){var mp=document.createElement("div");mp.setAttribute("oninput","return;"),mc=typeof mp.oninput=="function"}pc=mc}else pc=!1;gv=pc&&(!document.documentMode||9<document.documentMode)}function gp(){Qs&&(Qs.detachEvent("onpropertychange",_v),go=Qs=null)}function _v(e){if(e.propertyName==="value"&&Da(go)){var t=[];mv(t,go,e,md(e)),G_(Ow,t)}}function Fw(e,t,r){e==="focusin"?(gp(),Qs=t,go=r,Qs.attachEvent("onpropertychange",_v)):e==="focusout"&&gp()}function $w(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Da(go)}function Ww(e,t){if(e==="click")return Da(t)}function Hw(e,t){if(e==="input"||e==="change")return Da(t)}function Uw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wr=typeof Object.is=="function"?Object.is:Uw;function _o(e,t){if(Wr(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(!du.call(t,i)||!Wr(e[i],t[i]))return!1}return!0}function _p(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vp(e,t){var r=_p(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=_p(r)}}function vv(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vv(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yv(){for(var e=window,t=ql();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ql(e.document)}return t}function kd(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 Vw(e){var t=yv(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&vv(r.ownerDocument.documentElement,r)){if(n!==null&&kd(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=vp(r,s);var o=vp(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 Kw=pn&&"documentMode"in document&&11>=document.documentMode,Fi=null,Du=null,Zs=null,Iu=!1;function yp(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Iu||Fi==null||Fi!==ql(n)||(n=Fi,"selectionStart"in n&&kd(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}),Zs&&_o(Zs,n)||(Zs=n,n=ea(Du,"onSelect"),0<n.length&&(t=new wd("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Fi)))}function il(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var $i={animationend:il("Animation","AnimationEnd"),animationiteration:il("Animation","AnimationIteration"),animationstart:il("Animation","AnimationStart"),transitionend:il("Transition","TransitionEnd")},gc={},xv={};pn&&(xv=document.createElement("div").style,"AnimationEvent"in window||(delete $i.animationend.animation,delete $i.animationiteration.animation,delete $i.animationstart.animation),"TransitionEvent"in window||delete $i.transitionend.transition);function Ia(e){if(gc[e])return gc[e];if(!$i[e])return e;var t=$i[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in xv)return gc[e]=t[r];return e}var wv=Ia("animationend"),Sv=Ia("animationiteration"),bv=Ia("animationstart"),kv=Ia("transitionend"),Cv=new Map,xp="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 Yn(e,t){Cv.set(e,t),Ni(t,[e])}for(var _c=0;_c<xp.length;_c++){var vc=xp[_c],qw=vc.toLowerCase(),Yw=vc[0].toUpperCase()+vc.slice(1);Yn(qw,"on"+Yw)}Yn(wv,"onAnimationEnd");Yn(Sv,"onAnimationIteration");Yn(bv,"onAnimationStart");Yn("dblclick","onDoubleClick");Yn("focusin","onFocus");Yn("focusout","onBlur");Yn(kv,"onTransitionEnd");ns("onMouseEnter",["mouseout","mouseover"]);ns("onMouseLeave",["mouseout","mouseover"]);ns("onPointerEnter",["pointerout","pointerover"]);ns("onPointerLeave",["pointerout","pointerover"]);Ni("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ni("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ni("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ni("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ni("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ni("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ws="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Xw=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ws));function wp(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,q1(n,t,void 0,e),e.currentTarget=null}function Ev(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;wp(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;wp(i,l,c),s=a}}}if(Xl)throw e=Nu,Xl=!1,Nu=null,e}function Fe(e,t){var r=t[Bu];r===void 0&&(r=t[Bu]=new Set);var n=e+"__bubble";r.has(n)||(Nv(t,e,2,!1),r.add(n))}function yc(e,t,r){var n=0;t&&(n|=4),Nv(r,e,n,t)}var sl="_reactListening"+Math.random().toString(36).slice(2);function vo(e){if(!e[sl]){e[sl]=!0,M_.forEach(function(r){r!=="selectionchange"&&(Xw.has(r)||yc(r,!1,e),yc(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[sl]||(t[sl]=!0,yc("selectionchange",!1,t))}}function Nv(e,t,r,n){switch(uv(t)){case 1:var i=cw;break;case 4:i=uw;break;default:i=yd}r=i.bind(null,t,r,e),i=void 0,!Eu||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 xc(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=hi(l),o===null)return;if(a=o.tag,a===5||a===6){n=s=o;continue e}l=l.parentNode}}n=n.return}G_(function(){var c=s,d=md(r),u=[];e:{var f=Cv.get(e);if(f!==void 0){var p=wd,m=e;switch(e){case"keypress":if(Nl(r)===0)break e;case"keydown":case"keyup":p=Cw;break;case"focusin":m="focus",p=fc;break;case"focusout":m="blur",p=fc;break;case"beforeblur":case"afterblur":p=fc;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=cp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=fw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Tw;break;case wv:case Sv:case bv:p=gw;break;case kv:p=Pw;break;case"scroll":p=hw;break;case"wheel":p=Iw;break;case"copy":case"cut":case"paste":p=vw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=hp}var g=(t&4)!==0,S=!g&&e==="scroll",_=g?f!==null?f+"Capture":null:f;g=[];for(var y=c,x;y!==null;){x=y;var N=x.stateNode;if(x.tag===5&&N!==null&&(x=N,_!==null&&(N=ho(y,_),N!=null&&g.push(yo(y,N,x)))),S)break;y=y.return}0<g.length&&(f=new p(f,m,null,r,d),u.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==ku&&(m=r.relatedTarget||r.fromElement)&&(hi(m)||m[mn]))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?hi(m):null,m!==null&&(S=Ti(m),m!==S||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(g=cp,N="onMouseLeave",_="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=hp,N="onPointerLeave",_="onPointerEnter",y="pointer"),S=p==null?f:Wi(p),x=m==null?f:Wi(m),f=new g(N,y+"leave",p,r,d),f.target=S,f.relatedTarget=x,N=null,hi(d)===c&&(g=new g(_,y+"enter",m,r,d),g.target=x,g.relatedTarget=S,N=g),S=N,p&&m)t:{for(g=p,_=m,y=0,x=g;x;x=Ii(x))y++;for(x=0,N=_;N;N=Ii(N))x++;for(;0<y-x;)g=Ii(g),y--;for(;0<x-y;)_=Ii(_),x--;for(;y--;){if(g===_||_!==null&&g===_.alternate)break t;g=Ii(g),_=Ii(_)}g=null}else g=null;p!==null&&Sp(u,f,p,g,!1),m!==null&&S!==null&&Sp(u,S,m,g,!0)}}e:{if(f=c?Wi(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var T=zw;else if(pp(f))if(gv)T=Hw;else{T=$w;var C=Fw}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(T=Ww);if(T&&(T=T(e,c))){mv(u,T,r,d);break e}C&&C(e,f,c),e==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&yu(f,"number",f.value)}switch(C=c?Wi(c):window,e){case"focusin":(pp(C)||C.contentEditable==="true")&&(Fi=C,Du=c,Zs=null);break;case"focusout":Zs=Du=Fi=null;break;case"mousedown":Iu=!0;break;case"contextmenu":case"mouseup":case"dragend":Iu=!1,yp(u,r,d);break;case"selectionchange":if(Kw)break;case"keydown":case"keyup":yp(u,r,d)}var M;if(bd)e:{switch(e){case"compositionstart":var F="onCompositionStart";break e;case"compositionend":F="onCompositionEnd";break e;case"compositionupdate":F="onCompositionUpdate";break e}F=void 0}else zi?fv(e,r)&&(F="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(F="onCompositionStart");F&&(dv&&r.locale!=="ko"&&(zi||F!=="onCompositionStart"?F==="onCompositionEnd"&&zi&&(M=hv()):(Rn=d,xd="value"in Rn?Rn.value:Rn.textContent,zi=!0)),C=ea(c,F),0<C.length&&(F=new up(F,e,null,r,d),u.push({event:F,listeners:C}),M?F.data=M:(M=pv(r),M!==null&&(F.data=M)))),(M=Mw?Aw(e,r):jw(e,r))&&(c=ea(c,"onBeforeInput"),0<c.length&&(d=new up("onBeforeInput","beforeinput",null,r,d),u.push({event:d,listeners:c}),d.data=M))}Ev(u,t)})}function yo(e,t,r){return{instance:e,listener:t,currentTarget:r}}function ea(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=ho(e,r),s!=null&&n.unshift(yo(e,s,i)),s=ho(e,t),s!=null&&n.push(yo(e,s,i))),e=e.return}return n}function Ii(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Sp(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=ho(r,s),a!=null&&o.unshift(yo(r,a,l))):i||(a=ho(r,s),a!=null&&o.push(yo(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var Gw=/\r\n?/g,Qw=/\u0000|\uFFFD/g;function bp(e){return(typeof e=="string"?e:""+e).replace(Gw,`
38
- `).replace(Qw,"")}function ol(e,t,r){if(t=bp(t),bp(e)!==t&&r)throw Error(re(425))}function ta(){}var Ru=null,Mu=null;function Au(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 ju=typeof setTimeout=="function"?setTimeout:void 0,Zw=typeof clearTimeout=="function"?clearTimeout:void 0,kp=typeof Promise=="function"?Promise:void 0,Jw=typeof queueMicrotask=="function"?queueMicrotask:typeof kp<"u"?function(e){return kp.resolve(null).then(e).catch(eS)}:ju;function eS(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),mo(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);mo(t)}function Fn(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 Cp(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 ps=Math.random().toString(36).slice(2),Gr="__reactFiber$"+ps,xo="__reactProps$"+ps,mn="__reactContainer$"+ps,Bu="__reactEvents$"+ps,tS="__reactListeners$"+ps,rS="__reactHandles$"+ps;function hi(e){var t=e[Gr];if(t)return t;for(var r=e.parentNode;r;){if(t=r[mn]||r[Gr]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Cp(e);e!==null;){if(r=e[Gr])return r;e=Cp(e)}return t}e=r,r=e.parentNode}return null}function Bo(e){return e=e[Gr]||e[mn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Wi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(re(33))}function Ra(e){return e[xo]||null}var Ou=[],Hi=-1;function Xn(e){return{current:e}}function We(e){0>Hi||(e.current=Ou[Hi],Ou[Hi]=null,Hi--)}function ze(e,t){Hi++,Ou[Hi]=e.current,e.current=t}var qn={},jt=Xn(qn),Zt=Xn(!1),yi=qn;function is(e,t){var r=e.type.contextTypes;if(!r)return qn;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 Jt(e){return e=e.childContextTypes,e!=null}function ra(){We(Zt),We(jt)}function Ep(e,t,r){if(jt.current!==qn)throw Error(re(168));ze(jt,t),ze(Zt,r)}function Tv(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(re(108,F1(e)||"Unknown",i));return Ge({},r,n)}function na(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qn,yi=jt.current,ze(jt,e),ze(Zt,Zt.current),!0}function Np(e,t,r){var n=e.stateNode;if(!n)throw Error(re(169));r?(e=Tv(e,t,yi),n.__reactInternalMemoizedMergedChildContext=e,We(Zt),We(jt),ze(jt,e)):We(Zt),ze(Zt,r)}var an=null,Ma=!1,Sc=!1;function Lv(e){an===null?an=[e]:an.push(e)}function nS(e){Ma=!0,Lv(e)}function Gn(){if(!Sc&&an!==null){Sc=!0;var e=0,t=Me;try{var r=an;for(Me=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}an=null,Ma=!1}catch(i){throw an!==null&&(an=an.slice(e+1)),ev(gd,Gn),i}finally{Me=t,Sc=!1}}return null}var Ui=[],Vi=0,ia=null,sa=0,br=[],kr=0,xi=null,un=1,hn="";function oi(e,t){Ui[Vi++]=sa,Ui[Vi++]=ia,ia=e,sa=t}function Pv(e,t,r){br[kr++]=un,br[kr++]=hn,br[kr++]=xi,xi=e;var n=un;e=hn;var i=32-zr(n)-1;n&=~(1<<i),r+=1;var s=32-zr(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,un=1<<32-zr(t)+i|r<<i|n,hn=s+e}else un=1<<s|r<<i|n,hn=e}function Cd(e){e.return!==null&&(oi(e,1),Pv(e,1,0))}function Ed(e){for(;e===ia;)ia=Ui[--Vi],Ui[Vi]=null,sa=Ui[--Vi],Ui[Vi]=null;for(;e===xi;)xi=br[--kr],br[kr]=null,hn=br[--kr],br[kr]=null,un=br[--kr],br[kr]=null}var ur=null,cr=null,He=!1,Br=null;function Dv(e,t){var r=Er(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 Tp(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,ur=e,cr=Fn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ur=e,cr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=xi!==null?{id:un,overflow:hn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Er(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,ur=e,cr=null,!0):!1;default:return!1}}function zu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Fu(e){if(He){var t=cr;if(t){var r=t;if(!Tp(e,t)){if(zu(e))throw Error(re(418));t=Fn(r.nextSibling);var n=ur;t&&Tp(e,t)?Dv(n,r):(e.flags=e.flags&-4097|2,He=!1,ur=e)}}else{if(zu(e))throw Error(re(418));e.flags=e.flags&-4097|2,He=!1,ur=e}}}function Lp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ur=e}function ll(e){if(e!==ur)return!1;if(!He)return Lp(e),He=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Au(e.type,e.memoizedProps)),t&&(t=cr)){if(zu(e))throw Iv(),Error(re(418));for(;t;)Dv(e,t),t=Fn(t.nextSibling)}if(Lp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(re(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){cr=Fn(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}cr=null}}else cr=ur?Fn(e.stateNode.nextSibling):null;return!0}function Iv(){for(var e=cr;e;)e=Fn(e.nextSibling)}function ss(){cr=ur=null,He=!1}function Nd(e){Br===null?Br=[e]:Br.push(e)}var iS=vn.ReactCurrentBatchConfig;function Ns(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(re(309));var n=r.stateNode}if(!n)throw Error(re(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(re(284));if(!r._owner)throw Error(re(290,e))}return e}function al(e,t){throw e=Object.prototype.toString.call(t),Error(re(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Pp(e){var t=e._init;return t(e._payload)}function Rv(e){function t(_,y){if(e){var x=_.deletions;x===null?(_.deletions=[y],_.flags|=16):x.push(y)}}function r(_,y){if(!e)return null;for(;y!==null;)t(_,y),y=y.sibling;return null}function n(_,y){for(_=new Map;y!==null;)y.key!==null?_.set(y.key,y):_.set(y.index,y),y=y.sibling;return _}function i(_,y){return _=Un(_,y),_.index=0,_.sibling=null,_}function s(_,y,x){return _.index=x,e?(x=_.alternate,x!==null?(x=x.index,x<y?(_.flags|=2,y):x):(_.flags|=2,y)):(_.flags|=1048576,y)}function o(_){return e&&_.alternate===null&&(_.flags|=2),_}function l(_,y,x,N){return y===null||y.tag!==6?(y=Lc(x,_.mode,N),y.return=_,y):(y=i(y,x),y.return=_,y)}function a(_,y,x,N){var T=x.type;return T===Oi?d(_,y,x.props.children,N,x.key):y!==null&&(y.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Tn&&Pp(T)===y.type)?(N=i(y,x.props),N.ref=Ns(_,y,x),N.return=_,N):(N=Ml(x.type,x.key,x.props,null,_.mode,N),N.ref=Ns(_,y,x),N.return=_,N)}function c(_,y,x,N){return y===null||y.tag!==4||y.stateNode.containerInfo!==x.containerInfo||y.stateNode.implementation!==x.implementation?(y=Pc(x,_.mode,N),y.return=_,y):(y=i(y,x.children||[]),y.return=_,y)}function d(_,y,x,N,T){return y===null||y.tag!==7?(y=gi(x,_.mode,N,T),y.return=_,y):(y=i(y,x),y.return=_,y)}function u(_,y,x){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Lc(""+y,_.mode,x),y.return=_,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Qo:return x=Ml(y.type,y.key,y.props,null,_.mode,x),x.ref=Ns(_,null,y),x.return=_,x;case Bi:return y=Pc(y,_.mode,x),y.return=_,y;case Tn:var N=y._init;return u(_,N(y._payload),x)}if(Fs(y)||Ss(y))return y=gi(y,_.mode,x,null),y.return=_,y;al(_,y)}return null}function f(_,y,x,N){var T=y!==null?y.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return T!==null?null:l(_,y,""+x,N);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Qo:return x.key===T?a(_,y,x,N):null;case Bi:return x.key===T?c(_,y,x,N):null;case Tn:return T=x._init,f(_,y,T(x._payload),N)}if(Fs(x)||Ss(x))return T!==null?null:d(_,y,x,N,null);al(_,x)}return null}function p(_,y,x,N,T){if(typeof N=="string"&&N!==""||typeof N=="number")return _=_.get(x)||null,l(y,_,""+N,T);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Qo:return _=_.get(N.key===null?x:N.key)||null,a(y,_,N,T);case Bi:return _=_.get(N.key===null?x:N.key)||null,c(y,_,N,T);case Tn:var C=N._init;return p(_,y,x,C(N._payload),T)}if(Fs(N)||Ss(N))return _=_.get(x)||null,d(y,_,N,T,null);al(y,N)}return null}function m(_,y,x,N){for(var T=null,C=null,M=y,F=y=0,$=null;M!==null&&F<x.length;F++){M.index>F?($=M,M=null):$=M.sibling;var E=f(_,M,x[F],N);if(E===null){M===null&&(M=$);break}e&&M&&E.alternate===null&&t(_,M),y=s(E,y,F),C===null?T=E:C.sibling=E,C=E,M=$}if(F===x.length)return r(_,M),He&&oi(_,F),T;if(M===null){for(;F<x.length;F++)M=u(_,x[F],N),M!==null&&(y=s(M,y,F),C===null?T=M:C.sibling=M,C=M);return He&&oi(_,F),T}for(M=n(_,M);F<x.length;F++)$=p(M,_,F,x[F],N),$!==null&&(e&&$.alternate!==null&&M.delete($.key===null?F:$.key),y=s($,y,F),C===null?T=$:C.sibling=$,C=$);return e&&M.forEach(function(U){return t(_,U)}),He&&oi(_,F),T}function g(_,y,x,N){var T=Ss(x);if(typeof T!="function")throw Error(re(150));if(x=T.call(x),x==null)throw Error(re(151));for(var C=T=null,M=y,F=y=0,$=null,E=x.next();M!==null&&!E.done;F++,E=x.next()){M.index>F?($=M,M=null):$=M.sibling;var U=f(_,M,E.value,N);if(U===null){M===null&&(M=$);break}e&&M&&U.alternate===null&&t(_,M),y=s(U,y,F),C===null?T=U:C.sibling=U,C=U,M=$}if(E.done)return r(_,M),He&&oi(_,F),T;if(M===null){for(;!E.done;F++,E=x.next())E=u(_,E.value,N),E!==null&&(y=s(E,y,F),C===null?T=E:C.sibling=E,C=E);return He&&oi(_,F),T}for(M=n(_,M);!E.done;F++,E=x.next())E=p(M,_,F,E.value,N),E!==null&&(e&&E.alternate!==null&&M.delete(E.key===null?F:E.key),y=s(E,y,F),C===null?T=E:C.sibling=E,C=E);return e&&M.forEach(function(j){return t(_,j)}),He&&oi(_,F),T}function S(_,y,x,N){if(typeof x=="object"&&x!==null&&x.type===Oi&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Qo:e:{for(var T=x.key,C=y;C!==null;){if(C.key===T){if(T=x.type,T===Oi){if(C.tag===7){r(_,C.sibling),y=i(C,x.props.children),y.return=_,_=y;break e}}else if(C.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Tn&&Pp(T)===C.type){r(_,C.sibling),y=i(C,x.props),y.ref=Ns(_,C,x),y.return=_,_=y;break e}r(_,C);break}else t(_,C);C=C.sibling}x.type===Oi?(y=gi(x.props.children,_.mode,N,x.key),y.return=_,_=y):(N=Ml(x.type,x.key,x.props,null,_.mode,N),N.ref=Ns(_,y,x),N.return=_,_=N)}return o(_);case Bi:e:{for(C=x.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){r(_,y.sibling),y=i(y,x.children||[]),y.return=_,_=y;break e}else{r(_,y);break}else t(_,y);y=y.sibling}y=Pc(x,_.mode,N),y.return=_,_=y}return o(_);case Tn:return C=x._init,S(_,y,C(x._payload),N)}if(Fs(x))return m(_,y,x,N);if(Ss(x))return g(_,y,x,N);al(_,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(r(_,y.sibling),y=i(y,x),y.return=_,_=y):(r(_,y),y=Lc(x,_.mode,N),y.return=_,_=y),o(_)):r(_,y)}return S}var os=Rv(!0),Mv=Rv(!1),oa=Xn(null),la=null,Ki=null,Td=null;function Ld(){Td=Ki=la=null}function Pd(e){var t=oa.current;We(oa),e._currentValue=t}function $u(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 es(e,t){la=e,Td=Ki=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Qt=!0),e.firstContext=null)}function Lr(e){var t=e._currentValue;if(Td!==e)if(e={context:e,memoizedValue:t,next:null},Ki===null){if(la===null)throw Error(re(308));Ki=e,la.dependencies={lanes:0,firstContext:e}}else Ki=Ki.next=e;return t}var di=null;function Dd(e){di===null?di=[e]:di.push(e)}function Av(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,Dd(t)):(r.next=i.next,i.next=r),t.interleaved=r,gn(e,n)}function gn(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 Ln=!1;function Id(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jv(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 fn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function $n(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Re&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,gn(e,r)}return i=n.interleaved,i===null?(t.next=t,Dd(n)):(t.next=i.next,i.next=t),n.interleaved=t,gn(e,r)}function Tl(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,_d(e,r)}}function Dp(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 aa(e,t,r,n){var i=e.updateQueue;Ln=!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,g=l;switch(f=t,p=r,g.tag){case 1:if(m=g.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=g.payload,f=typeof m=="function"?m.call(p,u,f):m,f==null)break e;u=Ge({},u,f);break e;case 2:Ln=!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);Si|=o,e.lanes=o,e.memoizedState=u}}function Ip(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(re(191,i));i.call(n)}}}var Oo={},Jr=Xn(Oo),wo=Xn(Oo),So=Xn(Oo);function fi(e){if(e===Oo)throw Error(re(174));return e}function Rd(e,t){switch(ze(So,t),ze(wo,e),ze(Jr,Oo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:wu(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=wu(t,e)}We(Jr),ze(Jr,t)}function ls(){We(Jr),We(wo),We(So)}function Bv(e){fi(So.current);var t=fi(Jr.current),r=wu(t,e.type);t!==r&&(ze(wo,e),ze(Jr,r))}function Md(e){wo.current===e&&(We(Jr),We(wo))}var Ye=Xn(0);function ca(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 bc=[];function Ad(){for(var e=0;e<bc.length;e++)bc[e]._workInProgressVersionPrimary=null;bc.length=0}var Ll=vn.ReactCurrentDispatcher,kc=vn.ReactCurrentBatchConfig,wi=0,Xe=null,ht=null,vt=null,ua=!1,Js=!1,bo=0,sS=0;function Dt(){throw Error(re(321))}function jd(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Wr(e[r],t[r]))return!1;return!0}function Bd(e,t,r,n,i,s){if(wi=s,Xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ll.current=e===null||e.memoizedState===null?cS:uS,e=r(n,i),Js){s=0;do{if(Js=!1,bo=0,25<=s)throw Error(re(301));s+=1,vt=ht=null,t.updateQueue=null,Ll.current=hS,e=r(n,i)}while(Js)}if(Ll.current=ha,t=ht!==null&&ht.next!==null,wi=0,vt=ht=Xe=null,ua=!1,t)throw Error(re(300));return e}function Od(){var e=bo!==0;return bo=0,e}function qr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?Xe.memoizedState=vt=e:vt=vt.next=e,vt}function Pr(){if(ht===null){var e=Xe.alternate;e=e!==null?e.memoizedState:null}else e=ht.next;var t=vt===null?Xe.memoizedState:vt.next;if(t!==null)vt=t,ht=e;else{if(e===null)throw Error(re(310));ht=e,e={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},vt===null?Xe.memoizedState=vt=e:vt=vt.next=e}return vt}function ko(e,t){return typeof t=="function"?t(e):t}function Cc(e){var t=Pr(),r=t.queue;if(r===null)throw Error(re(311));r.lastRenderedReducer=e;var n=ht,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((wi&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,Xe.lanes|=d,Si|=d}c=c.next}while(c!==null&&c!==s);a===null?o=n:a.next=l,Wr(n,t.memoizedState)||(Qt=!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,Xe.lanes|=s,Si|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Ec(e){var t=Pr(),r=t.queue;if(r===null)throw Error(re(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);Wr(s,t.memoizedState)||(Qt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function Ov(){}function zv(e,t){var r=Xe,n=Pr(),i=t(),s=!Wr(n.memoizedState,i);if(s&&(n.memoizedState=i,Qt=!0),n=n.queue,zd(Wv.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||vt!==null&&vt.memoizedState.tag&1){if(r.flags|=2048,Co(9,$v.bind(null,r,n,i,t),void 0,null),St===null)throw Error(re(349));wi&30||Fv(r,t,i)}return i}function Fv(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Xe.updateQueue,t===null?(t={lastEffect:null,stores:null},Xe.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function $v(e,t,r,n){t.value=r,t.getSnapshot=n,Hv(t)&&Uv(e)}function Wv(e,t,r){return r(function(){Hv(t)&&Uv(e)})}function Hv(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Wr(e,r)}catch{return!0}}function Uv(e){var t=gn(e,1);t!==null&&Fr(t,e,1,-1)}function Rp(e){var t=qr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:e},t.queue=e,e=e.dispatch=aS.bind(null,Xe,e),[t.memoizedState,e]}function Co(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=Xe.updateQueue,t===null?(t={lastEffect:null,stores:null},Xe.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 Vv(){return Pr().memoizedState}function Pl(e,t,r,n){var i=qr();Xe.flags|=e,i.memoizedState=Co(1|t,r,void 0,n===void 0?null:n)}function Aa(e,t,r,n){var i=Pr();n=n===void 0?null:n;var s=void 0;if(ht!==null){var o=ht.memoizedState;if(s=o.destroy,n!==null&&jd(n,o.deps)){i.memoizedState=Co(t,r,s,n);return}}Xe.flags|=e,i.memoizedState=Co(1|t,r,s,n)}function Mp(e,t){return Pl(8390656,8,e,t)}function zd(e,t){return Aa(2048,8,e,t)}function Kv(e,t){return Aa(4,2,e,t)}function qv(e,t){return Aa(4,4,e,t)}function Yv(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 Xv(e,t,r){return r=r!=null?r.concat([e]):null,Aa(4,4,Yv.bind(null,t,e),r)}function Fd(){}function Gv(e,t){var r=Pr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&jd(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Qv(e,t){var r=Pr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&jd(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Zv(e,t,r){return wi&21?(Wr(r,t)||(r=nv(),Xe.lanes|=r,Si|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Qt=!0),e.memoizedState=r)}function oS(e,t){var r=Me;Me=r!==0&&4>r?r:4,e(!0);var n=kc.transition;kc.transition={};try{e(!1),t()}finally{Me=r,kc.transition=n}}function Jv(){return Pr().memoizedState}function lS(e,t,r){var n=Hn(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},e0(e))t0(t,r);else if(r=Av(e,t,r,n),r!==null){var i=$t();Fr(r,e,n,i),r0(r,t,n)}}function aS(e,t,r){var n=Hn(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(e0(e))t0(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,Wr(l,o)){var a=t.interleaved;a===null?(i.next=i,Dd(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}r=Av(e,t,i,n),r!==null&&(i=$t(),Fr(r,e,n,i),r0(r,t,n))}}function e0(e){var t=e.alternate;return e===Xe||t!==null&&t===Xe}function t0(e,t){Js=ua=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function r0(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,_d(e,r)}}var ha={readContext:Lr,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useInsertionEffect:Dt,useLayoutEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useMutableSource:Dt,useSyncExternalStore:Dt,useId:Dt,unstable_isNewReconciler:!1},cS={readContext:Lr,useCallback:function(e,t){return qr().memoizedState=[e,t===void 0?null:t],e},useContext:Lr,useEffect:Mp,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Pl(4194308,4,Yv.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Pl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pl(4,2,e,t)},useMemo:function(e,t){var r=qr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=qr();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=lS.bind(null,Xe,e),[n.memoizedState,e]},useRef:function(e){var t=qr();return e={current:e},t.memoizedState=e},useState:Rp,useDebugValue:Fd,useDeferredValue:function(e){return qr().memoizedState=e},useTransition:function(){var e=Rp(!1),t=e[0];return e=oS.bind(null,e[1]),qr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Xe,i=qr();if(He){if(r===void 0)throw Error(re(407));r=r()}else{if(r=t(),St===null)throw Error(re(349));wi&30||Fv(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Mp(Wv.bind(null,n,s,e),[e]),n.flags|=2048,Co(9,$v.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=qr(),t=St.identifierPrefix;if(He){var r=hn,n=un;r=(n&~(1<<32-zr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=bo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=sS++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},uS={readContext:Lr,useCallback:Gv,useContext:Lr,useEffect:zd,useImperativeHandle:Xv,useInsertionEffect:Kv,useLayoutEffect:qv,useMemo:Qv,useReducer:Cc,useRef:Vv,useState:function(){return Cc(ko)},useDebugValue:Fd,useDeferredValue:function(e){var t=Pr();return Zv(t,ht.memoizedState,e)},useTransition:function(){var e=Cc(ko)[0],t=Pr().memoizedState;return[e,t]},useMutableSource:Ov,useSyncExternalStore:zv,useId:Jv,unstable_isNewReconciler:!1},hS={readContext:Lr,useCallback:Gv,useContext:Lr,useEffect:zd,useImperativeHandle:Xv,useInsertionEffect:Kv,useLayoutEffect:qv,useMemo:Qv,useReducer:Ec,useRef:Vv,useState:function(){return Ec(ko)},useDebugValue:Fd,useDeferredValue:function(e){var t=Pr();return ht===null?t.memoizedState=e:Zv(t,ht.memoizedState,e)},useTransition:function(){var e=Ec(ko)[0],t=Pr().memoizedState;return[e,t]},useMutableSource:Ov,useSyncExternalStore:zv,useId:Jv,unstable_isNewReconciler:!1};function Ar(e,t){if(e&&e.defaultProps){t=Ge({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Wu(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:Ge({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var ja={isMounted:function(e){return(e=e._reactInternals)?Ti(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=$t(),i=Hn(e),s=fn(n,i);s.payload=t,r!=null&&(s.callback=r),t=$n(e,s,i),t!==null&&(Fr(t,e,i,n),Tl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=$t(),i=Hn(e),s=fn(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=$n(e,s,i),t!==null&&(Fr(t,e,i,n),Tl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=$t(),n=Hn(e),i=fn(r,n);i.tag=2,t!=null&&(i.callback=t),t=$n(e,i,n),t!==null&&(Fr(t,e,n,r),Tl(t,e,n))}};function Ap(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?!_o(r,n)||!_o(i,s):!0}function n0(e,t,r){var n=!1,i=qn,s=t.contextType;return typeof s=="object"&&s!==null?s=Lr(s):(i=Jt(t)?yi:jt.current,n=t.contextTypes,s=(n=n!=null)?is(e,i):qn),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ja,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function jp(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&&ja.enqueueReplaceState(t,t.state,null)}function Hu(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},Id(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Lr(s):(s=Jt(t)?yi:jt.current,i.context=is(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Wu(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&&ja.enqueueReplaceState(i,i.state,null),aa(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function as(e,t){try{var r="",n=t;do r+=z1(n),n=n.return;while(n);var i=r}catch(s){i=`
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{lc=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?zs(e):""}function z1(e){switch(e.tag){case 5:return zs(e.type);case 16:return zs("Lazy");case 13:return zs("Suspense");case 19:return zs("SuspenseList");case 0:case 2:case 15:return e=ac(e.type,!1),e;case 11:return e=ac(e.type.render,!1),e;case 1:return e=ac(e.type,!0),e;default:return""}}function gu(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 Oi:return"Fragment";case Bi:return"Portal";case fu:return"Profiler";case dd:return"StrictMode";case pu:return"Suspense";case mu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case j_:return(e.displayName||"Context")+".Consumer";case A_:return(e._context.displayName||"Context")+".Provider";case fd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case pd:return t=e.displayName||null,t!==null?t:gu(e.type)||"Memo";case Tn:t=e._payload,e=e._init;try{return gu(e(t))}catch{}}return null}function F1(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 gu(t);case 8:return t===dd?"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 Kn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function O_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $1(e){var t=O_(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 Zo(e){e._valueTracker||(e._valueTracker=$1(e))}function z_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=O_(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function ql(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 _u(e,t){var r=t.checked;return Ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Jf(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Kn(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 F_(e,t){t=t.checked,t!=null&&hd(e,"checked",t,!1)}function vu(e,t){F_(e,t);var r=Kn(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")?yu(e,t.type,r):t.hasOwnProperty("defaultValue")&&yu(e,t.type,Kn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ep(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 yu(e,t,r){(t!=="number"||ql(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Fs=Array.isArray;function Gi(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=""+Kn(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 xu(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(re(91));return Ge({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function tp(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(re(92));if(Fs(r)){if(1<r.length)throw Error(re(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Kn(r)}}function $_(e,t){var r=Kn(t.value),n=Kn(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 rp(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function W_(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 wu(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?W_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Jo,H_=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(Jo=Jo||document.createElement("div"),Jo.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Jo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function uo(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Ys={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},W1=["Webkit","ms","Moz","O"];Object.keys(Ys).forEach(function(e){W1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ys[t]=Ys[e]})});function U_(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Ys.hasOwnProperty(e)&&Ys[e]?(""+t).trim():t+"px"}function V_(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=U_(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var H1=Ge({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 Su(e,t){if(t){if(H1[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(re(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(re(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(re(61))}if(t.style!=null&&typeof t.style!="object")throw Error(re(62))}}function bu(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 ku=null;function md(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Cu=null,Qi=null,Zi=null;function np(e){if(e=Bo(e)){if(typeof Cu!="function")throw Error(re(280));var t=e.stateNode;t&&(t=Ra(t),Cu(e.stateNode,e.type,t))}}function K_(e){Qi?Zi?Zi.push(e):Zi=[e]:Qi=e}function q_(){if(Qi){var e=Qi,t=Zi;if(Zi=Qi=null,np(e),t)for(e=0;e<t.length;e++)np(t[e])}}function Y_(e,t){return e(t)}function X_(){}var cc=!1;function G_(e,t,r){if(cc)return e(t,r);cc=!0;try{return Y_(e,t,r)}finally{cc=!1,(Qi!==null||Zi!==null)&&(X_(),q_())}}function ho(e,t){var r=e.stateNode;if(r===null)return null;var n=Ra(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(re(231,t,typeof r));return r}var Eu=!1;if(pn)try{var bs={};Object.defineProperty(bs,"passive",{get:function(){Eu=!0}}),window.addEventListener("test",bs,bs),window.removeEventListener("test",bs,bs)}catch{Eu=!1}function U1(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 Xs=!1,Yl=null,Xl=!1,Nu=null,V1={onError:function(e){Xs=!0,Yl=e}};function K1(e,t,r,n,i,s,o,l,a){Xs=!1,Yl=null,U1.apply(V1,arguments)}function q1(e,t,r,n,i,s,o,l,a){if(K1.apply(this,arguments),Xs){if(Xs){var c=Yl;Xs=!1,Yl=null}else throw Error(re(198));Xl||(Xl=!0,Nu=c)}}function Ti(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 Q_(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 ip(e){if(Ti(e)!==e)throw Error(re(188))}function Y1(e){var t=e.alternate;if(!t){if(t=Ti(e),t===null)throw Error(re(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 ip(i),e;if(s===n)return ip(i),t;s=s.sibling}throw Error(re(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(re(189))}}if(r.alternate!==n)throw Error(re(190))}if(r.tag!==3)throw Error(re(188));return r.stateNode.current===r?e:t}function Z_(e){return e=Y1(e),e!==null?J_(e):null}function J_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=J_(e);if(t!==null)return t;e=e.sibling}return null}var ev=dr.unstable_scheduleCallback,sp=dr.unstable_cancelCallback,X1=dr.unstable_shouldYield,G1=dr.unstable_requestPaint,rt=dr.unstable_now,Q1=dr.unstable_getCurrentPriorityLevel,gd=dr.unstable_ImmediatePriority,tv=dr.unstable_UserBlockingPriority,Gl=dr.unstable_NormalPriority,Z1=dr.unstable_LowPriority,rv=dr.unstable_IdlePriority,La=null,Zr=null;function J1(e){if(Zr&&typeof Zr.onCommitFiberRoot=="function")try{Zr.onCommitFiberRoot(La,e,void 0,(e.current.flags&128)===128)}catch{}}var zr=Math.clz32?Math.clz32:rw,ew=Math.log,tw=Math.LN2;function rw(e){return e>>>=0,e===0?32:31-(ew(e)/tw|0)|0}var el=64,tl=4194304;function $s(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 Ql(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=$s(l):(s&=o,s!==0&&(n=$s(s)))}else o=r&~i,o!==0?n=$s(o):s!==0&&(n=$s(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-zr(t),i=1<<r,n|=e[r],t&=~i;return n}function nw(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 iw(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-zr(s),l=1<<o,a=i[o];a===-1?(!(l&r)||l&n)&&(i[o]=nw(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function Tu(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function nv(){var e=el;return el<<=1,!(el&4194240)&&(el=64),e}function uc(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Ao(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-zr(t),e[t]=r}function sw(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-zr(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function _d(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-zr(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var Me=0;function iv(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var sv,vd,ov,lv,av,Lu=!1,rl=[],Bn=null,On=null,zn=null,fo=new Map,po=new Map,Dn=[],ow="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 op(e,t){switch(e){case"focusin":case"focusout":Bn=null;break;case"dragenter":case"dragleave":On=null;break;case"mouseover":case"mouseout":zn=null;break;case"pointerover":case"pointerout":fo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":po.delete(t.pointerId)}}function ks(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=Bo(t),t!==null&&vd(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function lw(e,t,r,n,i){switch(t){case"focusin":return Bn=ks(Bn,e,t,r,n,i),!0;case"dragenter":return On=ks(On,e,t,r,n,i),!0;case"mouseover":return zn=ks(zn,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return fo.set(s,ks(fo.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,po.set(s,ks(po.get(s)||null,e,t,r,n,i)),!0}return!1}function cv(e){var t=hi(e.target);if(t!==null){var r=Ti(t);if(r!==null){if(t=r.tag,t===13){if(t=Q_(r),t!==null){e.blockedOn=t,av(e.priority,function(){ov(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 Cl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Pu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);ku=n,r.target.dispatchEvent(n),ku=null}else return t=Bo(r),t!==null&&vd(t),e.blockedOn=r,!1;t.shift()}return!0}function lp(e,t,r){Cl(e)&&r.delete(t)}function aw(){Lu=!1,Bn!==null&&Cl(Bn)&&(Bn=null),On!==null&&Cl(On)&&(On=null),zn!==null&&Cl(zn)&&(zn=null),fo.forEach(lp),po.forEach(lp)}function Cs(e,t){e.blockedOn===t&&(e.blockedOn=null,Lu||(Lu=!0,dr.unstable_scheduleCallback(dr.unstable_NormalPriority,aw)))}function mo(e){function t(i){return Cs(i,e)}if(0<rl.length){Cs(rl[0],e);for(var r=1;r<rl.length;r++){var n=rl[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Bn!==null&&Cs(Bn,e),On!==null&&Cs(On,e),zn!==null&&Cs(zn,e),fo.forEach(t),po.forEach(t),r=0;r<Dn.length;r++)n=Dn[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Dn.length&&(r=Dn[0],r.blockedOn===null);)cv(r),r.blockedOn===null&&Dn.shift()}var Ji=vn.ReactCurrentBatchConfig,Zl=!0;function cw(e,t,r,n){var i=Me,s=Ji.transition;Ji.transition=null;try{Me=1,yd(e,t,r,n)}finally{Me=i,Ji.transition=s}}function uw(e,t,r,n){var i=Me,s=Ji.transition;Ji.transition=null;try{Me=4,yd(e,t,r,n)}finally{Me=i,Ji.transition=s}}function yd(e,t,r,n){if(Zl){var i=Pu(e,t,r,n);if(i===null)xc(e,t,n,Jl,r),op(e,n);else if(lw(i,e,t,r,n))n.stopPropagation();else if(op(e,n),t&4&&-1<ow.indexOf(e)){for(;i!==null;){var s=Bo(i);if(s!==null&&sv(s),s=Pu(e,t,r,n),s===null&&xc(e,t,n,Jl,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else xc(e,t,n,null,r)}}var Jl=null;function Pu(e,t,r,n){if(Jl=null,e=md(n),e=hi(e),e!==null)if(t=Ti(e),t===null)e=null;else if(r=t.tag,r===13){if(e=Q_(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 Jl=e,null}function uv(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(Q1()){case gd:return 1;case tv:return 4;case Gl:case Z1:return 16;case rv:return 536870912;default:return 16}default:return 16}}var Rn=null,xd=null,El=null;function hv(){if(El)return El;var e,t=xd,r=t.length,n,i="value"in Rn?Rn.value:Rn.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 El=i.slice(e,1<n?1-n:void 0)}function Nl(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 nl(){return!0}function ap(){return!1}function pr(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)?nl:ap,this.isPropagationStopped=ap,this}return Ge(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=nl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=nl)},persist:function(){},isPersistent:nl}),t}var fs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wd=pr(fs),jo=Ge({},fs,{view:0,detail:0}),hw=pr(jo),hc,dc,Es,Pa=Ge({},jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sd,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!==Es&&(Es&&e.type==="mousemove"?(hc=e.screenX-Es.screenX,dc=e.screenY-Es.screenY):dc=hc=0,Es=e),hc)},movementY:function(e){return"movementY"in e?e.movementY:dc}}),cp=pr(Pa),dw=Ge({},Pa,{dataTransfer:0}),fw=pr(dw),pw=Ge({},jo,{relatedTarget:0}),fc=pr(pw),mw=Ge({},fs,{animationName:0,elapsedTime:0,pseudoElement:0}),gw=pr(mw),_w=Ge({},fs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vw=pr(_w),yw=Ge({},fs,{data:0}),up=pr(yw),xw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ww={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"},Sw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sw[e])?!!t[e]:!1}function Sd(){return bw}var kw=Ge({},jo,{key:function(e){if(e.key){var t=xw[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Nl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ww[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sd,charCode:function(e){return e.type==="keypress"?Nl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Nl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Cw=pr(kw),Ew=Ge({},Pa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hp=pr(Ew),Nw=Ge({},jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sd}),Tw=pr(Nw),Lw=Ge({},fs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pw=pr(Lw),Dw=Ge({},Pa,{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}),Iw=pr(Dw),Rw=[9,13,27,32],bd=pn&&"CompositionEvent"in window,Gs=null;pn&&"documentMode"in document&&(Gs=document.documentMode);var Mw=pn&&"TextEvent"in window&&!Gs,dv=pn&&(!bd||Gs&&8<Gs&&11>=Gs),dp=" ",fp=!1;function fv(e,t){switch(e){case"keyup":return Rw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zi=!1;function Aw(e,t){switch(e){case"compositionend":return pv(t);case"keypress":return t.which!==32?null:(fp=!0,dp);case"textInput":return e=t.data,e===dp&&fp?null:e;default:return null}}function jw(e,t){if(zi)return e==="compositionend"||!bd&&fv(e,t)?(e=hv(),El=xd=Rn=null,zi=!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 Bw={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 pp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Bw[e.type]:t==="textarea"}function mv(e,t,r,n){K_(n),t=ea(t,"onChange"),0<t.length&&(r=new wd("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Qs=null,go=null;function Ow(e){Ev(e,0)}function Da(e){var t=Wi(e);if(z_(t))return e}function zw(e,t){if(e==="change")return t}var gv=!1;if(pn){var pc;if(pn){var mc="oninput"in document;if(!mc){var mp=document.createElement("div");mp.setAttribute("oninput","return;"),mc=typeof mp.oninput=="function"}pc=mc}else pc=!1;gv=pc&&(!document.documentMode||9<document.documentMode)}function gp(){Qs&&(Qs.detachEvent("onpropertychange",_v),go=Qs=null)}function _v(e){if(e.propertyName==="value"&&Da(go)){var t=[];mv(t,go,e,md(e)),G_(Ow,t)}}function Fw(e,t,r){e==="focusin"?(gp(),Qs=t,go=r,Qs.attachEvent("onpropertychange",_v)):e==="focusout"&&gp()}function $w(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Da(go)}function Ww(e,t){if(e==="click")return Da(t)}function Hw(e,t){if(e==="input"||e==="change")return Da(t)}function Uw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wr=typeof Object.is=="function"?Object.is:Uw;function _o(e,t){if(Wr(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(!du.call(t,i)||!Wr(e[i],t[i]))return!1}return!0}function _p(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vp(e,t){var r=_p(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=_p(r)}}function vv(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vv(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yv(){for(var e=window,t=ql();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ql(e.document)}return t}function kd(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 Vw(e){var t=yv(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&vv(r.ownerDocument.documentElement,r)){if(n!==null&&kd(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=vp(r,s);var o=vp(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 Kw=pn&&"documentMode"in document&&11>=document.documentMode,Fi=null,Du=null,Zs=null,Iu=!1;function yp(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Iu||Fi==null||Fi!==ql(n)||(n=Fi,"selectionStart"in n&&kd(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}),Zs&&_o(Zs,n)||(Zs=n,n=ea(Du,"onSelect"),0<n.length&&(t=new wd("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Fi)))}function il(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var $i={animationend:il("Animation","AnimationEnd"),animationiteration:il("Animation","AnimationIteration"),animationstart:il("Animation","AnimationStart"),transitionend:il("Transition","TransitionEnd")},gc={},xv={};pn&&(xv=document.createElement("div").style,"AnimationEvent"in window||(delete $i.animationend.animation,delete $i.animationiteration.animation,delete $i.animationstart.animation),"TransitionEvent"in window||delete $i.transitionend.transition);function Ia(e){if(gc[e])return gc[e];if(!$i[e])return e;var t=$i[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in xv)return gc[e]=t[r];return e}var wv=Ia("animationend"),Sv=Ia("animationiteration"),bv=Ia("animationstart"),kv=Ia("transitionend"),Cv=new Map,xp="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 Yn(e,t){Cv.set(e,t),Ni(t,[e])}for(var _c=0;_c<xp.length;_c++){var vc=xp[_c],qw=vc.toLowerCase(),Yw=vc[0].toUpperCase()+vc.slice(1);Yn(qw,"on"+Yw)}Yn(wv,"onAnimationEnd");Yn(Sv,"onAnimationIteration");Yn(bv,"onAnimationStart");Yn("dblclick","onDoubleClick");Yn("focusin","onFocus");Yn("focusout","onBlur");Yn(kv,"onTransitionEnd");ns("onMouseEnter",["mouseout","mouseover"]);ns("onMouseLeave",["mouseout","mouseover"]);ns("onPointerEnter",["pointerout","pointerover"]);ns("onPointerLeave",["pointerout","pointerover"]);Ni("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ni("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ni("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ni("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ni("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ni("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ws="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Xw=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ws));function wp(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,q1(n,t,void 0,e),e.currentTarget=null}function Ev(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;wp(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;wp(i,l,c),s=a}}}if(Xl)throw e=Nu,Xl=!1,Nu=null,e}function Fe(e,t){var r=t[Bu];r===void 0&&(r=t[Bu]=new Set);var n=e+"__bubble";r.has(n)||(Nv(t,e,2,!1),r.add(n))}function yc(e,t,r){var n=0;t&&(n|=4),Nv(r,e,n,t)}var sl="_reactListening"+Math.random().toString(36).slice(2);function vo(e){if(!e[sl]){e[sl]=!0,M_.forEach(function(r){r!=="selectionchange"&&(Xw.has(r)||yc(r,!1,e),yc(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[sl]||(t[sl]=!0,yc("selectionchange",!1,t))}}function Nv(e,t,r,n){switch(uv(t)){case 1:var i=cw;break;case 4:i=uw;break;default:i=yd}r=i.bind(null,t,r,e),i=void 0,!Eu||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 xc(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=hi(l),o===null)return;if(a=o.tag,a===5||a===6){n=s=o;continue e}l=l.parentNode}}n=n.return}G_(function(){var c=s,d=md(r),u=[];e:{var f=Cv.get(e);if(f!==void 0){var p=wd,m=e;switch(e){case"keypress":if(Nl(r)===0)break e;case"keydown":case"keyup":p=Cw;break;case"focusin":m="focus",p=fc;break;case"focusout":m="blur",p=fc;break;case"beforeblur":case"afterblur":p=fc;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=cp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=fw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Tw;break;case wv:case Sv:case bv:p=gw;break;case kv:p=Pw;break;case"scroll":p=hw;break;case"wheel":p=Iw;break;case"copy":case"cut":case"paste":p=vw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=hp}var g=(t&4)!==0,S=!g&&e==="scroll",_=g?f!==null?f+"Capture":null:f;g=[];for(var y=c,x;y!==null;){x=y;var N=x.stateNode;if(x.tag===5&&N!==null&&(x=N,_!==null&&(N=ho(y,_),N!=null&&g.push(yo(y,N,x)))),S)break;y=y.return}0<g.length&&(f=new p(f,m,null,r,d),u.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==ku&&(m=r.relatedTarget||r.fromElement)&&(hi(m)||m[mn]))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?hi(m):null,m!==null&&(S=Ti(m),m!==S||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(g=cp,N="onMouseLeave",_="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=hp,N="onPointerLeave",_="onPointerEnter",y="pointer"),S=p==null?f:Wi(p),x=m==null?f:Wi(m),f=new g(N,y+"leave",p,r,d),f.target=S,f.relatedTarget=x,N=null,hi(d)===c&&(g=new g(_,y+"enter",m,r,d),g.target=x,g.relatedTarget=S,N=g),S=N,p&&m)t:{for(g=p,_=m,y=0,x=g;x;x=Ii(x))y++;for(x=0,N=_;N;N=Ii(N))x++;for(;0<y-x;)g=Ii(g),y--;for(;0<x-y;)_=Ii(_),x--;for(;y--;){if(g===_||_!==null&&g===_.alternate)break t;g=Ii(g),_=Ii(_)}g=null}else g=null;p!==null&&Sp(u,f,p,g,!1),m!==null&&S!==null&&Sp(u,S,m,g,!0)}}e:{if(f=c?Wi(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var T=zw;else if(pp(f))if(gv)T=Hw;else{T=$w;var C=Fw}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(T=Ww);if(T&&(T=T(e,c))){mv(u,T,r,d);break e}C&&C(e,f,c),e==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&yu(f,"number",f.value)}switch(C=c?Wi(c):window,e){case"focusin":(pp(C)||C.contentEditable==="true")&&(Fi=C,Du=c,Zs=null);break;case"focusout":Zs=Du=Fi=null;break;case"mousedown":Iu=!0;break;case"contextmenu":case"mouseup":case"dragend":Iu=!1,yp(u,r,d);break;case"selectionchange":if(Kw)break;case"keydown":case"keyup":yp(u,r,d)}var A;if(bd)e:{switch(e){case"compositionstart":var F="onCompositionStart";break e;case"compositionend":F="onCompositionEnd";break e;case"compositionupdate":F="onCompositionUpdate";break e}F=void 0}else zi?fv(e,r)&&(F="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(F="onCompositionStart");F&&(dv&&r.locale!=="ko"&&(zi||F!=="onCompositionStart"?F==="onCompositionEnd"&&zi&&(A=hv()):(Rn=d,xd="value"in Rn?Rn.value:Rn.textContent,zi=!0)),C=ea(c,F),0<C.length&&(F=new up(F,e,null,r,d),u.push({event:F,listeners:C}),A?F.data=A:(A=pv(r),A!==null&&(F.data=A)))),(A=Mw?Aw(e,r):jw(e,r))&&(c=ea(c,"onBeforeInput"),0<c.length&&(d=new up("onBeforeInput","beforeinput",null,r,d),u.push({event:d,listeners:c}),d.data=A))}Ev(u,t)})}function yo(e,t,r){return{instance:e,listener:t,currentTarget:r}}function ea(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=ho(e,r),s!=null&&n.unshift(yo(e,s,i)),s=ho(e,t),s!=null&&n.push(yo(e,s,i))),e=e.return}return n}function Ii(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Sp(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=ho(r,s),a!=null&&o.unshift(yo(r,a,l))):i||(a=ho(r,s),a!=null&&o.push(yo(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var Gw=/\r\n?/g,Qw=/\u0000|\uFFFD/g;function bp(e){return(typeof e=="string"?e:""+e).replace(Gw,`
38
+ `).replace(Qw,"")}function ol(e,t,r){if(t=bp(t),bp(e)!==t&&r)throw Error(re(425))}function ta(){}var Ru=null,Mu=null;function Au(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 ju=typeof setTimeout=="function"?setTimeout:void 0,Zw=typeof clearTimeout=="function"?clearTimeout:void 0,kp=typeof Promise=="function"?Promise:void 0,Jw=typeof queueMicrotask=="function"?queueMicrotask:typeof kp<"u"?function(e){return kp.resolve(null).then(e).catch(eS)}:ju;function eS(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),mo(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);mo(t)}function Fn(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 Cp(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 ps=Math.random().toString(36).slice(2),Gr="__reactFiber$"+ps,xo="__reactProps$"+ps,mn="__reactContainer$"+ps,Bu="__reactEvents$"+ps,tS="__reactListeners$"+ps,rS="__reactHandles$"+ps;function hi(e){var t=e[Gr];if(t)return t;for(var r=e.parentNode;r;){if(t=r[mn]||r[Gr]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Cp(e);e!==null;){if(r=e[Gr])return r;e=Cp(e)}return t}e=r,r=e.parentNode}return null}function Bo(e){return e=e[Gr]||e[mn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Wi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(re(33))}function Ra(e){return e[xo]||null}var Ou=[],Hi=-1;function Xn(e){return{current:e}}function We(e){0>Hi||(e.current=Ou[Hi],Ou[Hi]=null,Hi--)}function ze(e,t){Hi++,Ou[Hi]=e.current,e.current=t}var qn={},jt=Xn(qn),Zt=Xn(!1),yi=qn;function is(e,t){var r=e.type.contextTypes;if(!r)return qn;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 Jt(e){return e=e.childContextTypes,e!=null}function ra(){We(Zt),We(jt)}function Ep(e,t,r){if(jt.current!==qn)throw Error(re(168));ze(jt,t),ze(Zt,r)}function Tv(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(re(108,F1(e)||"Unknown",i));return Ge({},r,n)}function na(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qn,yi=jt.current,ze(jt,e),ze(Zt,Zt.current),!0}function Np(e,t,r){var n=e.stateNode;if(!n)throw Error(re(169));r?(e=Tv(e,t,yi),n.__reactInternalMemoizedMergedChildContext=e,We(Zt),We(jt),ze(jt,e)):We(Zt),ze(Zt,r)}var an=null,Ma=!1,Sc=!1;function Lv(e){an===null?an=[e]:an.push(e)}function nS(e){Ma=!0,Lv(e)}function Gn(){if(!Sc&&an!==null){Sc=!0;var e=0,t=Me;try{var r=an;for(Me=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}an=null,Ma=!1}catch(i){throw an!==null&&(an=an.slice(e+1)),ev(gd,Gn),i}finally{Me=t,Sc=!1}}return null}var Ui=[],Vi=0,ia=null,sa=0,br=[],kr=0,xi=null,un=1,hn="";function oi(e,t){Ui[Vi++]=sa,Ui[Vi++]=ia,ia=e,sa=t}function Pv(e,t,r){br[kr++]=un,br[kr++]=hn,br[kr++]=xi,xi=e;var n=un;e=hn;var i=32-zr(n)-1;n&=~(1<<i),r+=1;var s=32-zr(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,un=1<<32-zr(t)+i|r<<i|n,hn=s+e}else un=1<<s|r<<i|n,hn=e}function Cd(e){e.return!==null&&(oi(e,1),Pv(e,1,0))}function Ed(e){for(;e===ia;)ia=Ui[--Vi],Ui[Vi]=null,sa=Ui[--Vi],Ui[Vi]=null;for(;e===xi;)xi=br[--kr],br[kr]=null,hn=br[--kr],br[kr]=null,un=br[--kr],br[kr]=null}var ur=null,cr=null,He=!1,Br=null;function Dv(e,t){var r=Er(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 Tp(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,ur=e,cr=Fn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ur=e,cr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=xi!==null?{id:un,overflow:hn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Er(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,ur=e,cr=null,!0):!1;default:return!1}}function zu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Fu(e){if(He){var t=cr;if(t){var r=t;if(!Tp(e,t)){if(zu(e))throw Error(re(418));t=Fn(r.nextSibling);var n=ur;t&&Tp(e,t)?Dv(n,r):(e.flags=e.flags&-4097|2,He=!1,ur=e)}}else{if(zu(e))throw Error(re(418));e.flags=e.flags&-4097|2,He=!1,ur=e}}}function Lp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ur=e}function ll(e){if(e!==ur)return!1;if(!He)return Lp(e),He=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Au(e.type,e.memoizedProps)),t&&(t=cr)){if(zu(e))throw Iv(),Error(re(418));for(;t;)Dv(e,t),t=Fn(t.nextSibling)}if(Lp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(re(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){cr=Fn(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}cr=null}}else cr=ur?Fn(e.stateNode.nextSibling):null;return!0}function Iv(){for(var e=cr;e;)e=Fn(e.nextSibling)}function ss(){cr=ur=null,He=!1}function Nd(e){Br===null?Br=[e]:Br.push(e)}var iS=vn.ReactCurrentBatchConfig;function Ns(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(re(309));var n=r.stateNode}if(!n)throw Error(re(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(re(284));if(!r._owner)throw Error(re(290,e))}return e}function al(e,t){throw e=Object.prototype.toString.call(t),Error(re(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Pp(e){var t=e._init;return t(e._payload)}function Rv(e){function t(_,y){if(e){var x=_.deletions;x===null?(_.deletions=[y],_.flags|=16):x.push(y)}}function r(_,y){if(!e)return null;for(;y!==null;)t(_,y),y=y.sibling;return null}function n(_,y){for(_=new Map;y!==null;)y.key!==null?_.set(y.key,y):_.set(y.index,y),y=y.sibling;return _}function i(_,y){return _=Un(_,y),_.index=0,_.sibling=null,_}function s(_,y,x){return _.index=x,e?(x=_.alternate,x!==null?(x=x.index,x<y?(_.flags|=2,y):x):(_.flags|=2,y)):(_.flags|=1048576,y)}function o(_){return e&&_.alternate===null&&(_.flags|=2),_}function l(_,y,x,N){return y===null||y.tag!==6?(y=Lc(x,_.mode,N),y.return=_,y):(y=i(y,x),y.return=_,y)}function a(_,y,x,N){var T=x.type;return T===Oi?d(_,y,x.props.children,N,x.key):y!==null&&(y.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Tn&&Pp(T)===y.type)?(N=i(y,x.props),N.ref=Ns(_,y,x),N.return=_,N):(N=Ml(x.type,x.key,x.props,null,_.mode,N),N.ref=Ns(_,y,x),N.return=_,N)}function c(_,y,x,N){return y===null||y.tag!==4||y.stateNode.containerInfo!==x.containerInfo||y.stateNode.implementation!==x.implementation?(y=Pc(x,_.mode,N),y.return=_,y):(y=i(y,x.children||[]),y.return=_,y)}function d(_,y,x,N,T){return y===null||y.tag!==7?(y=gi(x,_.mode,N,T),y.return=_,y):(y=i(y,x),y.return=_,y)}function u(_,y,x){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Lc(""+y,_.mode,x),y.return=_,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Qo:return x=Ml(y.type,y.key,y.props,null,_.mode,x),x.ref=Ns(_,null,y),x.return=_,x;case Bi:return y=Pc(y,_.mode,x),y.return=_,y;case Tn:var N=y._init;return u(_,N(y._payload),x)}if(Fs(y)||Ss(y))return y=gi(y,_.mode,x,null),y.return=_,y;al(_,y)}return null}function f(_,y,x,N){var T=y!==null?y.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return T!==null?null:l(_,y,""+x,N);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Qo:return x.key===T?a(_,y,x,N):null;case Bi:return x.key===T?c(_,y,x,N):null;case Tn:return T=x._init,f(_,y,T(x._payload),N)}if(Fs(x)||Ss(x))return T!==null?null:d(_,y,x,N,null);al(_,x)}return null}function p(_,y,x,N,T){if(typeof N=="string"&&N!==""||typeof N=="number")return _=_.get(x)||null,l(y,_,""+N,T);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Qo:return _=_.get(N.key===null?x:N.key)||null,a(y,_,N,T);case Bi:return _=_.get(N.key===null?x:N.key)||null,c(y,_,N,T);case Tn:var C=N._init;return p(_,y,x,C(N._payload),T)}if(Fs(N)||Ss(N))return _=_.get(x)||null,d(y,_,N,T,null);al(y,N)}return null}function m(_,y,x,N){for(var T=null,C=null,A=y,F=y=0,W=null;A!==null&&F<x.length;F++){A.index>F?(W=A,A=null):W=A.sibling;var E=f(_,A,x[F],N);if(E===null){A===null&&(A=W);break}e&&A&&E.alternate===null&&t(_,A),y=s(E,y,F),C===null?T=E:C.sibling=E,C=E,A=W}if(F===x.length)return r(_,A),He&&oi(_,F),T;if(A===null){for(;F<x.length;F++)A=u(_,x[F],N),A!==null&&(y=s(A,y,F),C===null?T=A:C.sibling=A,C=A);return He&&oi(_,F),T}for(A=n(_,A);F<x.length;F++)W=p(A,_,F,x[F],N),W!==null&&(e&&W.alternate!==null&&A.delete(W.key===null?F:W.key),y=s(W,y,F),C===null?T=W:C.sibling=W,C=W);return e&&A.forEach(function(U){return t(_,U)}),He&&oi(_,F),T}function g(_,y,x,N){var T=Ss(x);if(typeof T!="function")throw Error(re(150));if(x=T.call(x),x==null)throw Error(re(151));for(var C=T=null,A=y,F=y=0,W=null,E=x.next();A!==null&&!E.done;F++,E=x.next()){A.index>F?(W=A,A=null):W=A.sibling;var U=f(_,A,E.value,N);if(U===null){A===null&&(A=W);break}e&&A&&U.alternate===null&&t(_,A),y=s(U,y,F),C===null?T=U:C.sibling=U,C=U,A=W}if(E.done)return r(_,A),He&&oi(_,F),T;if(A===null){for(;!E.done;F++,E=x.next())E=u(_,E.value,N),E!==null&&(y=s(E,y,F),C===null?T=E:C.sibling=E,C=E);return He&&oi(_,F),T}for(A=n(_,A);!E.done;F++,E=x.next())E=p(A,_,F,E.value,N),E!==null&&(e&&E.alternate!==null&&A.delete(E.key===null?F:E.key),y=s(E,y,F),C===null?T=E:C.sibling=E,C=E);return e&&A.forEach(function(O){return t(_,O)}),He&&oi(_,F),T}function S(_,y,x,N){if(typeof x=="object"&&x!==null&&x.type===Oi&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Qo:e:{for(var T=x.key,C=y;C!==null;){if(C.key===T){if(T=x.type,T===Oi){if(C.tag===7){r(_,C.sibling),y=i(C,x.props.children),y.return=_,_=y;break e}}else if(C.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Tn&&Pp(T)===C.type){r(_,C.sibling),y=i(C,x.props),y.ref=Ns(_,C,x),y.return=_,_=y;break e}r(_,C);break}else t(_,C);C=C.sibling}x.type===Oi?(y=gi(x.props.children,_.mode,N,x.key),y.return=_,_=y):(N=Ml(x.type,x.key,x.props,null,_.mode,N),N.ref=Ns(_,y,x),N.return=_,_=N)}return o(_);case Bi:e:{for(C=x.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){r(_,y.sibling),y=i(y,x.children||[]),y.return=_,_=y;break e}else{r(_,y);break}else t(_,y);y=y.sibling}y=Pc(x,_.mode,N),y.return=_,_=y}return o(_);case Tn:return C=x._init,S(_,y,C(x._payload),N)}if(Fs(x))return m(_,y,x,N);if(Ss(x))return g(_,y,x,N);al(_,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(r(_,y.sibling),y=i(y,x),y.return=_,_=y):(r(_,y),y=Lc(x,_.mode,N),y.return=_,_=y),o(_)):r(_,y)}return S}var os=Rv(!0),Mv=Rv(!1),oa=Xn(null),la=null,Ki=null,Td=null;function Ld(){Td=Ki=la=null}function Pd(e){var t=oa.current;We(oa),e._currentValue=t}function $u(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 es(e,t){la=e,Td=Ki=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Qt=!0),e.firstContext=null)}function Lr(e){var t=e._currentValue;if(Td!==e)if(e={context:e,memoizedValue:t,next:null},Ki===null){if(la===null)throw Error(re(308));Ki=e,la.dependencies={lanes:0,firstContext:e}}else Ki=Ki.next=e;return t}var di=null;function Dd(e){di===null?di=[e]:di.push(e)}function Av(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,Dd(t)):(r.next=i.next,i.next=r),t.interleaved=r,gn(e,n)}function gn(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 Ln=!1;function Id(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jv(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 fn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function $n(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Re&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,gn(e,r)}return i=n.interleaved,i===null?(t.next=t,Dd(n)):(t.next=i.next,i.next=t),n.interleaved=t,gn(e,r)}function Tl(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,_d(e,r)}}function Dp(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 aa(e,t,r,n){var i=e.updateQueue;Ln=!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,g=l;switch(f=t,p=r,g.tag){case 1:if(m=g.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=g.payload,f=typeof m=="function"?m.call(p,u,f):m,f==null)break e;u=Ge({},u,f);break e;case 2:Ln=!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);Si|=o,e.lanes=o,e.memoizedState=u}}function Ip(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(re(191,i));i.call(n)}}}var Oo={},Jr=Xn(Oo),wo=Xn(Oo),So=Xn(Oo);function fi(e){if(e===Oo)throw Error(re(174));return e}function Rd(e,t){switch(ze(So,t),ze(wo,e),ze(Jr,Oo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:wu(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=wu(t,e)}We(Jr),ze(Jr,t)}function ls(){We(Jr),We(wo),We(So)}function Bv(e){fi(So.current);var t=fi(Jr.current),r=wu(t,e.type);t!==r&&(ze(wo,e),ze(Jr,r))}function Md(e){wo.current===e&&(We(Jr),We(wo))}var Ye=Xn(0);function ca(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 bc=[];function Ad(){for(var e=0;e<bc.length;e++)bc[e]._workInProgressVersionPrimary=null;bc.length=0}var Ll=vn.ReactCurrentDispatcher,kc=vn.ReactCurrentBatchConfig,wi=0,Xe=null,ht=null,vt=null,ua=!1,Js=!1,bo=0,sS=0;function Dt(){throw Error(re(321))}function jd(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Wr(e[r],t[r]))return!1;return!0}function Bd(e,t,r,n,i,s){if(wi=s,Xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ll.current=e===null||e.memoizedState===null?cS:uS,e=r(n,i),Js){s=0;do{if(Js=!1,bo=0,25<=s)throw Error(re(301));s+=1,vt=ht=null,t.updateQueue=null,Ll.current=hS,e=r(n,i)}while(Js)}if(Ll.current=ha,t=ht!==null&&ht.next!==null,wi=0,vt=ht=Xe=null,ua=!1,t)throw Error(re(300));return e}function Od(){var e=bo!==0;return bo=0,e}function qr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?Xe.memoizedState=vt=e:vt=vt.next=e,vt}function Pr(){if(ht===null){var e=Xe.alternate;e=e!==null?e.memoizedState:null}else e=ht.next;var t=vt===null?Xe.memoizedState:vt.next;if(t!==null)vt=t,ht=e;else{if(e===null)throw Error(re(310));ht=e,e={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},vt===null?Xe.memoizedState=vt=e:vt=vt.next=e}return vt}function ko(e,t){return typeof t=="function"?t(e):t}function Cc(e){var t=Pr(),r=t.queue;if(r===null)throw Error(re(311));r.lastRenderedReducer=e;var n=ht,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((wi&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,Xe.lanes|=d,Si|=d}c=c.next}while(c!==null&&c!==s);a===null?o=n:a.next=l,Wr(n,t.memoizedState)||(Qt=!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,Xe.lanes|=s,Si|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Ec(e){var t=Pr(),r=t.queue;if(r===null)throw Error(re(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);Wr(s,t.memoizedState)||(Qt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function Ov(){}function zv(e,t){var r=Xe,n=Pr(),i=t(),s=!Wr(n.memoizedState,i);if(s&&(n.memoizedState=i,Qt=!0),n=n.queue,zd(Wv.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||vt!==null&&vt.memoizedState.tag&1){if(r.flags|=2048,Co(9,$v.bind(null,r,n,i,t),void 0,null),St===null)throw Error(re(349));wi&30||Fv(r,t,i)}return i}function Fv(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Xe.updateQueue,t===null?(t={lastEffect:null,stores:null},Xe.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function $v(e,t,r,n){t.value=r,t.getSnapshot=n,Hv(t)&&Uv(e)}function Wv(e,t,r){return r(function(){Hv(t)&&Uv(e)})}function Hv(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Wr(e,r)}catch{return!0}}function Uv(e){var t=gn(e,1);t!==null&&Fr(t,e,1,-1)}function Rp(e){var t=qr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:e},t.queue=e,e=e.dispatch=aS.bind(null,Xe,e),[t.memoizedState,e]}function Co(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=Xe.updateQueue,t===null?(t={lastEffect:null,stores:null},Xe.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 Vv(){return Pr().memoizedState}function Pl(e,t,r,n){var i=qr();Xe.flags|=e,i.memoizedState=Co(1|t,r,void 0,n===void 0?null:n)}function Aa(e,t,r,n){var i=Pr();n=n===void 0?null:n;var s=void 0;if(ht!==null){var o=ht.memoizedState;if(s=o.destroy,n!==null&&jd(n,o.deps)){i.memoizedState=Co(t,r,s,n);return}}Xe.flags|=e,i.memoizedState=Co(1|t,r,s,n)}function Mp(e,t){return Pl(8390656,8,e,t)}function zd(e,t){return Aa(2048,8,e,t)}function Kv(e,t){return Aa(4,2,e,t)}function qv(e,t){return Aa(4,4,e,t)}function Yv(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 Xv(e,t,r){return r=r!=null?r.concat([e]):null,Aa(4,4,Yv.bind(null,t,e),r)}function Fd(){}function Gv(e,t){var r=Pr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&jd(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Qv(e,t){var r=Pr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&jd(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Zv(e,t,r){return wi&21?(Wr(r,t)||(r=nv(),Xe.lanes|=r,Si|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Qt=!0),e.memoizedState=r)}function oS(e,t){var r=Me;Me=r!==0&&4>r?r:4,e(!0);var n=kc.transition;kc.transition={};try{e(!1),t()}finally{Me=r,kc.transition=n}}function Jv(){return Pr().memoizedState}function lS(e,t,r){var n=Hn(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},e0(e))t0(t,r);else if(r=Av(e,t,r,n),r!==null){var i=$t();Fr(r,e,n,i),r0(r,t,n)}}function aS(e,t,r){var n=Hn(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(e0(e))t0(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,Wr(l,o)){var a=t.interleaved;a===null?(i.next=i,Dd(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}r=Av(e,t,i,n),r!==null&&(i=$t(),Fr(r,e,n,i),r0(r,t,n))}}function e0(e){var t=e.alternate;return e===Xe||t!==null&&t===Xe}function t0(e,t){Js=ua=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function r0(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,_d(e,r)}}var ha={readContext:Lr,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useInsertionEffect:Dt,useLayoutEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useMutableSource:Dt,useSyncExternalStore:Dt,useId:Dt,unstable_isNewReconciler:!1},cS={readContext:Lr,useCallback:function(e,t){return qr().memoizedState=[e,t===void 0?null:t],e},useContext:Lr,useEffect:Mp,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Pl(4194308,4,Yv.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Pl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pl(4,2,e,t)},useMemo:function(e,t){var r=qr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=qr();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=lS.bind(null,Xe,e),[n.memoizedState,e]},useRef:function(e){var t=qr();return e={current:e},t.memoizedState=e},useState:Rp,useDebugValue:Fd,useDeferredValue:function(e){return qr().memoizedState=e},useTransition:function(){var e=Rp(!1),t=e[0];return e=oS.bind(null,e[1]),qr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Xe,i=qr();if(He){if(r===void 0)throw Error(re(407));r=r()}else{if(r=t(),St===null)throw Error(re(349));wi&30||Fv(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Mp(Wv.bind(null,n,s,e),[e]),n.flags|=2048,Co(9,$v.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=qr(),t=St.identifierPrefix;if(He){var r=hn,n=un;r=(n&~(1<<32-zr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=bo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=sS++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},uS={readContext:Lr,useCallback:Gv,useContext:Lr,useEffect:zd,useImperativeHandle:Xv,useInsertionEffect:Kv,useLayoutEffect:qv,useMemo:Qv,useReducer:Cc,useRef:Vv,useState:function(){return Cc(ko)},useDebugValue:Fd,useDeferredValue:function(e){var t=Pr();return Zv(t,ht.memoizedState,e)},useTransition:function(){var e=Cc(ko)[0],t=Pr().memoizedState;return[e,t]},useMutableSource:Ov,useSyncExternalStore:zv,useId:Jv,unstable_isNewReconciler:!1},hS={readContext:Lr,useCallback:Gv,useContext:Lr,useEffect:zd,useImperativeHandle:Xv,useInsertionEffect:Kv,useLayoutEffect:qv,useMemo:Qv,useReducer:Ec,useRef:Vv,useState:function(){return Ec(ko)},useDebugValue:Fd,useDeferredValue:function(e){var t=Pr();return ht===null?t.memoizedState=e:Zv(t,ht.memoizedState,e)},useTransition:function(){var e=Ec(ko)[0],t=Pr().memoizedState;return[e,t]},useMutableSource:Ov,useSyncExternalStore:zv,useId:Jv,unstable_isNewReconciler:!1};function Ar(e,t){if(e&&e.defaultProps){t=Ge({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Wu(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:Ge({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var ja={isMounted:function(e){return(e=e._reactInternals)?Ti(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=$t(),i=Hn(e),s=fn(n,i);s.payload=t,r!=null&&(s.callback=r),t=$n(e,s,i),t!==null&&(Fr(t,e,i,n),Tl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=$t(),i=Hn(e),s=fn(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=$n(e,s,i),t!==null&&(Fr(t,e,i,n),Tl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=$t(),n=Hn(e),i=fn(r,n);i.tag=2,t!=null&&(i.callback=t),t=$n(e,i,n),t!==null&&(Fr(t,e,n,r),Tl(t,e,n))}};function Ap(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?!_o(r,n)||!_o(i,s):!0}function n0(e,t,r){var n=!1,i=qn,s=t.contextType;return typeof s=="object"&&s!==null?s=Lr(s):(i=Jt(t)?yi:jt.current,n=t.contextTypes,s=(n=n!=null)?is(e,i):qn),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ja,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function jp(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&&ja.enqueueReplaceState(t,t.state,null)}function Hu(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},Id(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Lr(s):(s=Jt(t)?yi:jt.current,i.context=is(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Wu(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&&ja.enqueueReplaceState(i,i.state,null),aa(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function as(e,t){try{var r="",n=t;do r+=z1(n),n=n.return;while(n);var i=r}catch(s){i=`
39
39
  Error generating stack: `+s.message+`
40
40
  `+s.stack}return{value:e,source:t,stack:i,digest:null}}function Nc(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Uu(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var dS=typeof WeakMap=="function"?WeakMap:Map;function i0(e,t,r){r=fn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){fa||(fa=!0,eh=n),Uu(e,t)},r}function s0(e,t,r){r=fn(-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(){Uu(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){Uu(e,t),typeof n!="function"&&(Wn===null?Wn=new Set([this]):Wn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function Bp(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new dS;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=ES.bind(null,e,t,r),t.then(e,e))}function Op(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 zp(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=fn(-1,1),t.tag=2,$n(r,t,1))),r.lanes|=1),e)}var fS=vn.ReactCurrentOwner,Qt=!1;function zt(e,t,r,n){t.child=e===null?Mv(t,null,r,n):os(t,e.child,r,n)}function Fp(e,t,r,n,i){r=r.render;var s=t.ref;return es(t,i),n=Bd(e,t,r,n,s,i),r=Od(),e!==null&&!Qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,_n(e,t,i)):(He&&r&&Cd(t),t.flags|=1,zt(e,t,n,i),t.child)}function $p(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!Yd(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,o0(e,t,s,n,i)):(e=Ml(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:_o,r(o,n)&&e.ref===t.ref)return _n(e,t,i)}return t.flags|=1,e=Un(s,n),e.ref=t.ref,e.return=t,t.child=e}function o0(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(_o(s,n)&&e.ref===t.ref)if(Qt=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(Qt=!0);else return t.lanes=e.lanes,_n(e,t,i)}return Vu(e,t,r,n,i)}function l0(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},ze(Yi,lr),lr|=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,ze(Yi,lr),lr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,ze(Yi,lr),lr|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,ze(Yi,lr),lr|=n;return zt(e,t,i,r),t.child}function a0(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Vu(e,t,r,n,i){var s=Jt(r)?yi:jt.current;return s=is(t,s),es(t,i),r=Bd(e,t,r,n,s,i),n=Od(),e!==null&&!Qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,_n(e,t,i)):(He&&n&&Cd(t),t.flags|=1,zt(e,t,r,i),t.child)}function Wp(e,t,r,n,i){if(Jt(r)){var s=!0;na(t)}else s=!1;if(es(t,i),t.stateNode===null)Dl(e,t),n0(t,r,n),Hu(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=Lr(c):(c=Jt(r)?yi:jt.current,c=is(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)&&jp(t,o,n,c),Ln=!1;var f=t.memoizedState;o.state=f,aa(t,n,o,i),a=t.memoizedState,l!==n||f!==a||Zt.current||Ln?(typeof d=="function"&&(Wu(t,r,d,n),a=t.memoizedState),(l=Ln||Ap(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,jv(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Ar(t.type,l),o.props=c,u=t.pendingProps,f=o.context,a=r.contextType,typeof a=="object"&&a!==null?a=Lr(a):(a=Jt(r)?yi:jt.current,a=is(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)&&jp(t,o,n,a),Ln=!1,f=t.memoizedState,o.state=f,aa(t,n,o,i);var m=t.memoizedState;l!==u||f!==m||Zt.current||Ln?(typeof p=="function"&&(Wu(t,r,p,n),m=t.memoizedState),(c=Ln||Ap(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 Ku(e,t,r,n,s,i)}function Ku(e,t,r,n,i,s){a0(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&Np(t,r,!1),_n(e,t,s);n=t.stateNode,fS.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=os(t,e.child,null,s),t.child=os(t,null,l,s)):zt(e,t,l,s),t.memoizedState=n.state,i&&Np(t,r,!0),t.child}function c0(e){var t=e.stateNode;t.pendingContext?Ep(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ep(e,t.context,!1),Rd(e,t.containerInfo)}function Hp(e,t,r,n,i){return ss(),Nd(i),t.flags|=256,zt(e,t,r,n),t.child}var qu={dehydrated:null,treeContext:null,retryLane:0};function Yu(e){return{baseLanes:e,cachePool:null,transitions:null}}function u0(e,t,r){var n=t.pendingProps,i=Ye.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),ze(Ye,i&1),e===null)return Fu(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=za(o,n,0,null),e=gi(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Yu(r),t.memoizedState=qu,e):$d(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return pS(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=Un(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=Un(l,s):(s=gi(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?Yu(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=qu,n}return s=e.child,e=s.sibling,n=Un(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 $d(e,t){return t=za({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function cl(e,t,r,n){return n!==null&&Nd(n),os(t,e.child,null,r),e=$d(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function pS(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=Nc(Error(re(422))),cl(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=za({mode:"visible",children:n.children},i,0,null),s=gi(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&os(t,e.child,null,o),t.child.memoizedState=Yu(o),t.memoizedState=qu,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(re(419)),n=Nc(s,n,void 0),cl(e,t,o,n)}if(l=(o&e.childLanes)!==0,Qt||l){if(n=St,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,gn(e,i),Fr(n,e,i,-1))}return qd(),n=Nc(Error(re(421))),cl(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=NS.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,cr=Fn(i.nextSibling),ur=t,He=!0,Br=null,e!==null&&(br[kr++]=un,br[kr++]=hn,br[kr++]=xi,un=e.id,hn=e.overflow,xi=t),t=$d(t,n.children),t.flags|=4096,t)}function Up(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),$u(e.return,t,r)}function Tc(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 h0(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(zt(e,t,n.children,r),n=Ye.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&&Up(e,r,t);else if(e.tag===19)Up(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(ze(Ye,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&&ca(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),Tc(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&&ca(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}Tc(t,!0,r,null,s);break;case"together":Tc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Dl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function _n(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Si|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(re(153));if(t.child!==null){for(e=t.child,r=Un(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Un(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function mS(e,t,r){switch(t.tag){case 3:c0(t),ss();break;case 5:Bv(t);break;case 1:Jt(t.type)&&na(t);break;case 4:Rd(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;ze(oa,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(ze(Ye,Ye.current&1),t.flags|=128,null):r&t.child.childLanes?u0(e,t,r):(ze(Ye,Ye.current&1),e=_n(e,t,r),e!==null?e.sibling:null);ze(Ye,Ye.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return h0(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ze(Ye,Ye.current),n)break;return null;case 22:case 23:return t.lanes=0,l0(e,t,r)}return _n(e,t,r)}var d0,Xu,f0,p0;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}};Xu=function(){};f0=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,fi(Jr.current);var s=null;switch(r){case"input":i=_u(e,i),n=_u(e,n),s=[];break;case"select":i=Ge({},i,{value:void 0}),n=Ge({},n,{value:void 0}),s=[];break;case"textarea":i=xu(e,i),n=xu(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=ta)}Su(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"&&(co.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"&&(co.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&Fe("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)}};p0=function(e,t,r,n){r!==n&&(t.flags|=4)};function Ts(e,t){if(!He)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 It(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 gS(e,t,r){var n=t.pendingProps;switch(Ed(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return It(t),null;case 1:return Jt(t.type)&&ra(),It(t),null;case 3:return n=t.stateNode,ls(),We(Zt),We(jt),Ad(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ll(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Br!==null&&(nh(Br),Br=null))),Xu(e,t),It(t),null;case 5:Md(t);var i=fi(So.current);if(r=t.type,e!==null&&t.stateNode!=null)f0(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(re(166));return It(t),null}if(e=fi(Jr.current),ll(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[Gr]=t,n[xo]=s,e=(t.mode&1)!==0,r){case"dialog":Fe("cancel",n),Fe("close",n);break;case"iframe":case"object":case"embed":Fe("load",n);break;case"video":case"audio":for(i=0;i<Ws.length;i++)Fe(Ws[i],n);break;case"source":Fe("error",n);break;case"img":case"image":case"link":Fe("error",n),Fe("load",n);break;case"details":Fe("toggle",n);break;case"input":Jf(n,s),Fe("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},Fe("invalid",n);break;case"textarea":tp(n,s),Fe("invalid",n)}Su(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&&ol(n.textContent,l,e),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&ol(n.textContent,l,e),i=["children",""+l]):co.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Fe("scroll",n)}switch(r){case"input":Zo(n),ep(n,s,!0);break;case"textarea":Zo(n),rp(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=ta)}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=W_(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[Gr]=t,e[xo]=n,d0(e,t,!1,!1),t.stateNode=e;e:{switch(o=bu(r,n),r){case"dialog":Fe("cancel",e),Fe("close",e),i=n;break;case"iframe":case"object":case"embed":Fe("load",e),i=n;break;case"video":case"audio":for(i=0;i<Ws.length;i++)Fe(Ws[i],e);i=n;break;case"source":Fe("error",e),i=n;break;case"img":case"image":case"link":Fe("error",e),Fe("load",e),i=n;break;case"details":Fe("toggle",e),i=n;break;case"input":Jf(e,n),i=_u(e,n),Fe("invalid",e);break;case"option":i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=Ge({},n,{value:void 0}),Fe("invalid",e);break;case"textarea":tp(e,n),i=xu(e,n),Fe("invalid",e);break;default:i=n}Su(r,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?V_(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&H_(e,a)):s==="children"?typeof a=="string"?(r!=="textarea"||a!=="")&&uo(e,a):typeof a=="number"&&uo(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(co.hasOwnProperty(s)?a!=null&&s==="onScroll"&&Fe("scroll",e):a!=null&&hd(e,s,a,o))}switch(r){case"input":Zo(e),ep(e,n,!1);break;case"textarea":Zo(e),rp(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Kn(n.value));break;case"select":e.multiple=!!n.multiple,s=n.value,s!=null?Gi(e,!!n.multiple,s,!1):n.defaultValue!=null&&Gi(e,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=ta)}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 It(t),null;case 6:if(e&&t.stateNode!=null)p0(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(re(166));if(r=fi(So.current),fi(Jr.current),ll(t)){if(n=t.stateNode,r=t.memoizedProps,n[Gr]=t,(s=n.nodeValue!==r)&&(e=ur,e!==null))switch(e.tag){case 3:ol(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ol(n.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Gr]=t,t.stateNode=n}return It(t),null;case 13:if(We(Ye),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(He&&cr!==null&&t.mode&1&&!(t.flags&128))Iv(),ss(),t.flags|=98560,s=!1;else if(s=ll(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(re(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(re(317));s[Gr]=t}else ss(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;It(t),s=!1}else Br!==null&&(nh(Br),Br=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||Ye.current&1?dt===0&&(dt=3):qd())),t.updateQueue!==null&&(t.flags|=4),It(t),null);case 4:return ls(),Xu(e,t),e===null&&vo(t.stateNode.containerInfo),It(t),null;case 10:return Pd(t.type._context),It(t),null;case 17:return Jt(t.type)&&ra(),It(t),null;case 19:if(We(Ye),s=t.memoizedState,s===null)return It(t),null;if(n=(t.flags&128)!==0,o=s.rendering,o===null)if(n)Ts(s,!1);else{if(dt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ca(e),o!==null){for(t.flags|=128,Ts(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 ze(Ye,Ye.current&1|2),t.child}e=e.sibling}s.tail!==null&&rt()>cs&&(t.flags|=128,n=!0,Ts(s,!1),t.lanes=4194304)}else{if(!n)if(e=ca(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ts(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!He)return It(t),null}else 2*rt()-s.renderingStartTime>cs&&r!==1073741824&&(t.flags|=128,n=!0,Ts(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=rt(),t.sibling=null,r=Ye.current,ze(Ye,n?r&1|2:r&1),t):(It(t),null);case 22:case 23:return Kd(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?lr&1073741824&&(It(t),t.subtreeFlags&6&&(t.flags|=8192)):It(t),null;case 24:return null;case 25:return null}throw Error(re(156,t.tag))}function _S(e,t){switch(Ed(t),t.tag){case 1:return Jt(t.type)&&ra(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ls(),We(Zt),We(jt),Ad(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Md(t),null;case 13:if(We(Ye),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(re(340));ss()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return We(Ye),null;case 4:return ls(),null;case 10:return Pd(t.type._context),null;case 22:case 23:return Kd(),null;case 24:return null;default:return null}}var ul=!1,Mt=!1,vS=typeof WeakSet=="function"?WeakSet:Set,pe=null;function qi(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Je(e,t,n)}else r.current=null}function Gu(e,t,r){try{r()}catch(n){Je(e,t,n)}}var Vp=!1;function yS(e,t){if(Ru=Zl,e=yv(),kd(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(Mu={focusedElem:e,selectionRange:r},Zl=!1,pe=t;pe!==null;)if(t=pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,pe=e;else for(;pe!==null;){t=pe;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 g=m.memoizedProps,S=m.memoizedState,_=t.stateNode,y=_.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ar(t.type,g),S);_.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(N){Je(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,pe=e;break}pe=t.return}return m=Vp,Vp=!1,m}function eo(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&&Gu(t,r,s)}i=i.next}while(i!==n)}}function Ba(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 Qu(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 m0(e){var t=e.alternate;t!==null&&(e.alternate=null,m0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Gr],delete t[xo],delete t[Bu],delete t[tS],delete t[rS])),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 g0(e){return e.tag===5||e.tag===3||e.tag===4}function Kp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||g0(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 Zu(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=ta));else if(n!==4&&(e=e.child,e!==null))for(Zu(e,t,r),e=e.sibling;e!==null;)Zu(e,t,r),e=e.sibling}function Ju(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(Ju(e,t,r),e=e.sibling;e!==null;)Ju(e,t,r),e=e.sibling}var Ct=null,jr=!1;function Sn(e,t,r){for(r=r.child;r!==null;)_0(e,t,r),r=r.sibling}function _0(e,t,r){if(Zr&&typeof Zr.onCommitFiberUnmount=="function")try{Zr.onCommitFiberUnmount(La,r)}catch{}switch(r.tag){case 5:Mt||qi(r,t);case 6:var n=Ct,i=jr;Ct=null,Sn(e,t,r),Ct=n,jr=i,Ct!==null&&(jr?(e=Ct,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ct.removeChild(r.stateNode));break;case 18:Ct!==null&&(jr?(e=Ct,r=r.stateNode,e.nodeType===8?wc(e.parentNode,r):e.nodeType===1&&wc(e,r),mo(e)):wc(Ct,r.stateNode));break;case 4:n=Ct,i=jr,Ct=r.stateNode.containerInfo,jr=!0,Sn(e,t,r),Ct=n,jr=i;break;case 0:case 11:case 14:case 15:if(!Mt&&(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)&&Gu(r,t,o),i=i.next}while(i!==n)}Sn(e,t,r);break;case 1:if(!Mt&&(qi(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){Je(r,t,l)}Sn(e,t,r);break;case 21:Sn(e,t,r);break;case 22:r.mode&1?(Mt=(n=Mt)||r.memoizedState!==null,Sn(e,t,r),Mt=n):Sn(e,t,r);break;default:Sn(e,t,r)}}function qp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new vS),t.forEach(function(n){var i=TS.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Rr(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:Ct=l.stateNode,jr=!1;break e;case 3:Ct=l.stateNode.containerInfo,jr=!0;break e;case 4:Ct=l.stateNode.containerInfo,jr=!0;break e}l=l.return}if(Ct===null)throw Error(re(160));_0(s,o,i),Ct=null,jr=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){Je(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)v0(t,e),t=t.sibling}function v0(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Rr(t,e),Hr(e),n&4){try{eo(3,e,e.return),Ba(3,e)}catch(g){Je(e,e.return,g)}try{eo(5,e,e.return)}catch(g){Je(e,e.return,g)}}break;case 1:Rr(t,e),Hr(e),n&512&&r!==null&&qi(r,r.return);break;case 5:if(Rr(t,e),Hr(e),n&512&&r!==null&&qi(r,r.return),e.flags&32){var i=e.stateNode;try{uo(i,"")}catch(g){Je(e,e.return,g)}}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&&F_(i,s),bu(l,o);var c=bu(l,s);for(o=0;o<a.length;o+=2){var d=a[o],u=a[o+1];d==="style"?V_(i,u):d==="dangerouslySetInnerHTML"?H_(i,u):d==="children"?uo(i,u):hd(i,d,u,c)}switch(l){case"input":vu(i,s);break;case"textarea":$_(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?Gi(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?Gi(i,!!s.multiple,s.defaultValue,!0):Gi(i,!!s.multiple,s.multiple?[]:"",!1))}i[xo]=s}catch(g){Je(e,e.return,g)}}break;case 6:if(Rr(t,e),Hr(e),n&4){if(e.stateNode===null)throw Error(re(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(g){Je(e,e.return,g)}}break;case 3:if(Rr(t,e),Hr(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{mo(t.containerInfo)}catch(g){Je(e,e.return,g)}break;case 4:Rr(t,e),Hr(e);break;case 13:Rr(t,e),Hr(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Ud=rt())),n&4&&qp(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(Mt=(c=Mt)||d,Rr(t,e),Mt=c):Rr(t,e),Hr(e),n&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!d&&e.mode&1)for(pe=e,d=e.child;d!==null;){for(u=pe=d;pe!==null;){switch(f=pe,p=f.child,f.tag){case 0:case 11:case 14:case 15:eo(4,f,f.return);break;case 1:qi(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(g){Je(n,r,g)}}break;case 5:qi(f,f.return);break;case 22:if(f.memoizedState!==null){Xp(u);continue}}p!==null?(p.return=f,pe=p):Xp(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=U_("display",o))}catch(g){Je(e,e.return,g)}}}else if(u.tag===6){if(d===null)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(g){Je(e,e.return,g)}}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:Rr(t,e),Hr(e),n&4&&qp(e);break;case 21:break;default:Rr(t,e),Hr(e)}}function Hr(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(g0(r)){var n=r;break e}r=r.return}throw Error(re(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(uo(i,""),n.flags&=-33);var s=Kp(e);Ju(e,s,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=Kp(e);Zu(e,l,o);break;default:throw Error(re(161))}}catch(a){Je(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xS(e,t,r){pe=e,y0(e)}function y0(e,t,r){for(var n=(e.mode&1)!==0;pe!==null;){var i=pe,s=i.child;if(i.tag===22&&n){var o=i.memoizedState!==null||ul;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||Mt;l=ul;var c=Mt;if(ul=o,(Mt=a)&&!c)for(pe=i;pe!==null;)o=pe,a=o.child,o.tag===22&&o.memoizedState!==null?Gp(i):a!==null?(a.return=o,pe=a):Gp(i);for(;s!==null;)pe=s,y0(s),s=s.sibling;pe=i,ul=l,Mt=c}Yp(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,pe=s):Yp(e)}}function Yp(e){for(;pe!==null;){var t=pe;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Mt||Ba(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Mt)if(r===null)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:Ar(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Ip(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}Ip(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&&mo(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(re(163))}Mt||t.flags&512&&Qu(t)}catch(f){Je(t,t.return,f)}}if(t===e){pe=null;break}if(r=t.sibling,r!==null){r.return=t.return,pe=r;break}pe=t.return}}function Xp(e){for(;pe!==null;){var t=pe;if(t===e){pe=null;break}var r=t.sibling;if(r!==null){r.return=t.return,pe=r;break}pe=t.return}}function Gp(e){for(;pe!==null;){var t=pe;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Ba(4,t)}catch(a){Je(t,r,a)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var i=t.return;try{n.componentDidMount()}catch(a){Je(t,i,a)}}var s=t.return;try{Qu(t)}catch(a){Je(t,s,a)}break;case 5:var o=t.return;try{Qu(t)}catch(a){Je(t,o,a)}}}catch(a){Je(t,t.return,a)}if(t===e){pe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,pe=l;break}pe=t.return}}var wS=Math.ceil,da=vn.ReactCurrentDispatcher,Wd=vn.ReactCurrentOwner,Nr=vn.ReactCurrentBatchConfig,Re=0,St=null,lt=null,Tt=0,lr=0,Yi=Xn(0),dt=0,Eo=null,Si=0,Oa=0,Hd=0,to=null,Gt=null,Ud=0,cs=1/0,ln=null,fa=!1,eh=null,Wn=null,hl=!1,Mn=null,pa=0,ro=0,th=null,Il=-1,Rl=0;function $t(){return Re&6?rt():Il!==-1?Il:Il=rt()}function Hn(e){return e.mode&1?Re&2&&Tt!==0?Tt&-Tt:iS.transition!==null?(Rl===0&&(Rl=nv()),Rl):(e=Me,e!==0||(e=window.event,e=e===void 0?16:uv(e.type)),e):1}function Fr(e,t,r,n){if(50<ro)throw ro=0,th=null,Error(re(185));Ao(e,r,n),(!(Re&2)||e!==St)&&(e===St&&(!(Re&2)&&(Oa|=r),dt===4&&In(e,Tt)),er(e,n),r===1&&Re===0&&!(t.mode&1)&&(cs=rt()+500,Ma&&Gn()))}function er(e,t){var r=e.callbackNode;iw(e,t);var n=Ql(e,e===St?Tt:0);if(n===0)r!==null&&sp(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&sp(r),t===1)e.tag===0?nS(Qp.bind(null,e)):Lv(Qp.bind(null,e)),Jw(function(){!(Re&6)&&Gn()}),r=null;else{switch(iv(n)){case 1:r=gd;break;case 4:r=tv;break;case 16:r=Gl;break;case 536870912:r=rv;break;default:r=Gl}r=N0(r,x0.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function x0(e,t){if(Il=-1,Rl=0,Re&6)throw Error(re(327));var r=e.callbackNode;if(ts()&&e.callbackNode!==r)return null;var n=Ql(e,e===St?Tt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=ma(e,n);else{t=n;var i=Re;Re|=2;var s=S0();(St!==e||Tt!==t)&&(ln=null,cs=rt()+500,mi(e,t));do try{kS();break}catch(l){w0(e,l)}while(!0);Ld(),da.current=s,Re=i,lt!==null?t=0:(St=null,Tt=0,t=dt)}if(t!==0){if(t===2&&(i=Tu(e),i!==0&&(n=i,t=rh(e,i))),t===1)throw r=Eo,mi(e,0),In(e,n),er(e,rt()),r;if(t===6)In(e,n);else{if(i=e.current.alternate,!(n&30)&&!SS(i)&&(t=ma(e,n),t===2&&(s=Tu(e),s!==0&&(n=s,t=rh(e,s))),t===1))throw r=Eo,mi(e,0),In(e,n),er(e,rt()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(re(345));case 2:li(e,Gt,ln);break;case 3:if(In(e,n),(n&130023424)===n&&(t=Ud+500-rt(),10<t)){if(Ql(e,0)!==0)break;if(i=e.suspendedLanes,(i&n)!==n){$t(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=ju(li.bind(null,e,Gt,ln),t);break}li(e,Gt,ln);break;case 4:if(In(e,n),(n&4194240)===n)break;for(t=e.eventTimes,i=-1;0<n;){var o=31-zr(n);s=1<<o,o=t[o],o>i&&(i=o),n&=~s}if(n=i,n=rt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*wS(n/1960))-n,10<n){e.timeoutHandle=ju(li.bind(null,e,Gt,ln),n);break}li(e,Gt,ln);break;case 5:li(e,Gt,ln);break;default:throw Error(re(329))}}}return er(e,rt()),e.callbackNode===r?x0.bind(null,e):null}function rh(e,t){var r=to;return e.current.memoizedState.isDehydrated&&(mi(e,t).flags|=256),e=ma(e,t),e!==2&&(t=Gt,Gt=r,t!==null&&nh(t)),e}function nh(e){Gt===null?Gt=e:Gt.push.apply(Gt,e)}function SS(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(!Wr(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 In(e,t){for(t&=~Hd,t&=~Oa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-zr(t),n=1<<r;e[r]=-1,t&=~n}}function Qp(e){if(Re&6)throw Error(re(327));ts();var t=Ql(e,0);if(!(t&1))return er(e,rt()),null;var r=ma(e,t);if(e.tag!==0&&r===2){var n=Tu(e);n!==0&&(t=n,r=rh(e,n))}if(r===1)throw r=Eo,mi(e,0),In(e,t),er(e,rt()),r;if(r===6)throw Error(re(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,li(e,Gt,ln),er(e,rt()),null}function Vd(e,t){var r=Re;Re|=1;try{return e(t)}finally{Re=r,Re===0&&(cs=rt()+500,Ma&&Gn())}}function bi(e){Mn!==null&&Mn.tag===0&&!(Re&6)&&ts();var t=Re;Re|=1;var r=Nr.transition,n=Me;try{if(Nr.transition=null,Me=1,e)return e()}finally{Me=n,Nr.transition=r,Re=t,!(Re&6)&&Gn()}}function Kd(){lr=Yi.current,We(Yi)}function mi(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Zw(r)),lt!==null)for(r=lt.return;r!==null;){var n=r;switch(Ed(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&ra();break;case 3:ls(),We(Zt),We(jt),Ad();break;case 5:Md(n);break;case 4:ls();break;case 13:We(Ye);break;case 19:We(Ye);break;case 10:Pd(n.type._context);break;case 22:case 23:Kd()}r=r.return}if(St=e,lt=e=Un(e.current,null),Tt=lr=t,dt=0,Eo=null,Hd=Oa=Si=0,Gt=to=null,di!==null){for(t=0;t<di.length;t++)if(r=di[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}di=null}return e}function w0(e,t){do{var r=lt;try{if(Ld(),Ll.current=ha,ua){for(var n=Xe.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}ua=!1}if(wi=0,vt=ht=Xe=null,Js=!1,bo=0,Wd.current=null,r===null||r.return===null){dt=1,Eo=t,lt=null;break}e:{var s=e,o=r.return,l=r,a=t;if(t=Tt,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=Op(o);if(p!==null){p.flags&=-257,zp(p,o,l,s,t),p.mode&1&&Bp(s,c,t),t=p,a=c;var m=t.updateQueue;if(m===null){var g=new Set;g.add(a),t.updateQueue=g}else m.add(a);break e}else{if(!(t&1)){Bp(s,c,t),qd();break e}a=Error(re(426))}}else if(He&&l.mode&1){var S=Op(o);if(S!==null){!(S.flags&65536)&&(S.flags|=256),zp(S,o,l,s,t),Nd(as(a,l));break e}}s=a=as(a,l),dt!==4&&(dt=2),to===null?to=[s]:to.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var _=i0(s,a,t);Dp(s,_);break e;case 1:l=a;var y=s.type,x=s.stateNode;if(!(s.flags&128)&&(typeof y.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Wn===null||!Wn.has(x)))){s.flags|=65536,t&=-t,s.lanes|=t;var N=s0(s,l,t);Dp(s,N);break e}}s=s.return}while(s!==null)}k0(r)}catch(T){t=T,lt===r&&r!==null&&(lt=r=r.return);continue}break}while(!0)}function S0(){var e=da.current;return da.current=ha,e===null?ha:e}function qd(){(dt===0||dt===3||dt===2)&&(dt=4),St===null||!(Si&268435455)&&!(Oa&268435455)||In(St,Tt)}function ma(e,t){var r=Re;Re|=2;var n=S0();(St!==e||Tt!==t)&&(ln=null,mi(e,t));do try{bS();break}catch(i){w0(e,i)}while(!0);if(Ld(),Re=r,da.current=n,lt!==null)throw Error(re(261));return St=null,Tt=0,dt}function bS(){for(;lt!==null;)b0(lt)}function kS(){for(;lt!==null&&!X1();)b0(lt)}function b0(e){var t=E0(e.alternate,e,lr);e.memoizedProps=e.pendingProps,t===null?k0(e):lt=t,Wd.current=null}function k0(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=_S(r,t),r!==null){r.flags&=32767,lt=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{dt=6,lt=null;return}}else if(r=gS(r,t,lr),r!==null){lt=r;return}if(t=t.sibling,t!==null){lt=t;return}lt=t=e}while(t!==null);dt===0&&(dt=5)}function li(e,t,r){var n=Me,i=Nr.transition;try{Nr.transition=null,Me=1,CS(e,t,r,n)}finally{Nr.transition=i,Me=n}return null}function CS(e,t,r,n){do ts();while(Mn!==null);if(Re&6)throw Error(re(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(re(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(sw(e,s),e===St&&(lt=St=null,Tt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||hl||(hl=!0,N0(Gl,function(){return ts(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=Nr.transition,Nr.transition=null;var o=Me;Me=1;var l=Re;Re|=4,Wd.current=null,yS(e,r),v0(r,e),Vw(Mu),Zl=!!Ru,Mu=Ru=null,e.current=r,xS(r),G1(),Re=l,Me=o,Nr.transition=s}else e.current=r;if(hl&&(hl=!1,Mn=e,pa=i),s=e.pendingLanes,s===0&&(Wn=null),J1(r.stateNode),er(e,rt()),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(fa)throw fa=!1,e=eh,eh=null,e;return pa&1&&e.tag!==0&&ts(),s=e.pendingLanes,s&1?e===th?ro++:(ro=0,th=e):ro=0,Gn(),null}function ts(){if(Mn!==null){var e=iv(pa),t=Nr.transition,r=Me;try{if(Nr.transition=null,Me=16>e?16:e,Mn===null)var n=!1;else{if(e=Mn,Mn=null,pa=0,Re&6)throw Error(re(331));var i=Re;for(Re|=4,pe=e.current;pe!==null;){var s=pe,o=s.child;if(pe.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(pe=c;pe!==null;){var d=pe;switch(d.tag){case 0:case 11:case 15:eo(8,d,s)}var u=d.child;if(u!==null)u.return=d,pe=u;else for(;pe!==null;){d=pe;var f=d.sibling,p=d.return;if(m0(d),d===c){pe=null;break}if(f!==null){f.return=p,pe=f;break}pe=p}}}var m=s.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var S=g.sibling;g.sibling=null,g=S}while(g!==null)}}pe=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,pe=o;else e:for(;pe!==null;){if(s=pe,s.flags&2048)switch(s.tag){case 0:case 11:case 15:eo(9,s,s.return)}var _=s.sibling;if(_!==null){_.return=s.return,pe=_;break e}pe=s.return}}var y=e.current;for(pe=y;pe!==null;){o=pe;var x=o.child;if(o.subtreeFlags&2064&&x!==null)x.return=o,pe=x;else e:for(o=y;pe!==null;){if(l=pe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ba(9,l)}}catch(T){Je(l,l.return,T)}if(l===o){pe=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,pe=N;break e}pe=l.return}}if(Re=i,Gn(),Zr&&typeof Zr.onPostCommitFiberRoot=="function")try{Zr.onPostCommitFiberRoot(La,e)}catch{}n=!0}return n}finally{Me=r,Nr.transition=t}}return!1}function Zp(e,t,r){t=as(r,t),t=i0(e,t,1),e=$n(e,t,1),t=$t(),e!==null&&(Ao(e,1,t),er(e,t))}function Je(e,t,r){if(e.tag===3)Zp(e,e,r);else for(;t!==null;){if(t.tag===3){Zp(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Wn===null||!Wn.has(n))){e=as(r,e),e=s0(t,e,1),t=$n(t,e,1),e=$t(),t!==null&&(Ao(t,1,e),er(t,e));break}}t=t.return}}function ES(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=$t(),e.pingedLanes|=e.suspendedLanes&r,St===e&&(Tt&r)===r&&(dt===4||dt===3&&(Tt&130023424)===Tt&&500>rt()-Ud?mi(e,0):Hd|=r),er(e,t)}function C0(e,t){t===0&&(e.mode&1?(t=tl,tl<<=1,!(tl&130023424)&&(tl=4194304)):t=1);var r=$t();e=gn(e,t),e!==null&&(Ao(e,t,r),er(e,r))}function NS(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),C0(e,r)}function TS(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(re(314))}n!==null&&n.delete(t),C0(e,r)}var E0;E0=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Zt.current)Qt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Qt=!1,mS(e,t,r);Qt=!!(e.flags&131072)}else Qt=!1,He&&t.flags&1048576&&Pv(t,sa,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Dl(e,t),e=t.pendingProps;var i=is(t,jt.current);es(t,r),i=Bd(null,t,n,e,i,r);var s=Od();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,Jt(n)?(s=!0,na(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Id(t),i.updater=ja,t.stateNode=i,i._reactInternals=t,Hu(t,n,e,r),t=Ku(null,t,n,!0,s,r)):(t.tag=0,He&&s&&Cd(t),zt(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Dl(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=PS(n),e=Ar(n,e),i){case 0:t=Vu(null,t,n,e,r);break e;case 1:t=Wp(null,t,n,e,r);break e;case 11:t=Fp(null,t,n,e,r);break e;case 14:t=$p(null,t,n,Ar(n.type,e),r);break e}throw Error(re(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Ar(n,i),Vu(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Ar(n,i),Wp(e,t,n,i,r);case 3:e:{if(c0(t),e===null)throw Error(re(387));n=t.pendingProps,s=t.memoizedState,i=s.element,jv(e,t),aa(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=as(Error(re(423)),t),t=Hp(e,t,n,r,i);break e}else if(n!==i){i=as(Error(re(424)),t),t=Hp(e,t,n,r,i);break e}else for(cr=Fn(t.stateNode.containerInfo.firstChild),ur=t,He=!0,Br=null,r=Mv(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ss(),n===i){t=_n(e,t,r);break e}zt(e,t,n,r)}t=t.child}return t;case 5:return Bv(t),e===null&&Fu(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Au(n,i)?o=null:s!==null&&Au(n,s)&&(t.flags|=32),a0(e,t),zt(e,t,o,r),t.child;case 6:return e===null&&Fu(t),null;case 13:return u0(e,t,r);case 4:return Rd(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=os(t,null,n,r):zt(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Ar(n,i),Fp(e,t,n,i,r);case 7:return zt(e,t,t.pendingProps,r),t.child;case 8:return zt(e,t,t.pendingProps.children,r),t.child;case 12:return zt(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,ze(oa,n._currentValue),n._currentValue=o,s!==null)if(Wr(s.value,o)){if(s.children===i.children&&!Zt.current){t=_n(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=fn(-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),$u(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(re(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),$u(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}zt(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,es(t,r),i=Lr(i),n=n(i),t.flags|=1,zt(e,t,n,r),t.child;case 14:return n=t.type,i=Ar(n,t.pendingProps),i=Ar(n.type,i),$p(e,t,n,i,r);case 15:return o0(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Ar(n,i),Dl(e,t),t.tag=1,Jt(n)?(e=!0,na(t)):e=!1,es(t,r),n0(t,n,i),Hu(t,n,i,r),Ku(null,t,n,!0,e,r);case 19:return h0(e,t,r);case 22:return l0(e,t,r)}throw Error(re(156,t.tag))};function N0(e,t){return ev(e,t)}function LS(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 Er(e,t,r,n){return new LS(e,t,r,n)}function Yd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function PS(e){if(typeof e=="function")return Yd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===fd)return 11;if(e===pd)return 14}return 2}function Un(e,t){var r=e.alternate;return r===null?(r=Er(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 Ml(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")Yd(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Oi:return gi(r.children,i,s,t);case dd:o=8,i|=8;break;case fu:return e=Er(12,r,t,i|2),e.elementType=fu,e.lanes=s,e;case pu:return e=Er(13,r,t,i),e.elementType=pu,e.lanes=s,e;case mu:return e=Er(19,r,t,i),e.elementType=mu,e.lanes=s,e;case B_:return za(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A_:o=10;break e;case j_:o=9;break e;case fd:o=11;break e;case pd:o=14;break e;case Tn:o=16,n=null;break e}throw Error(re(130,e==null?e:typeof e,""))}return t=Er(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function gi(e,t,r,n){return e=Er(7,e,n,t),e.lanes=r,e}function za(e,t,r,n){return e=Er(22,e,n,t),e.elementType=B_,e.lanes=r,e.stateNode={isHidden:!1},e}function Lc(e,t,r){return e=Er(6,e,null,t),e.lanes=r,e}function Pc(e,t,r){return t=Er(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function DS(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=uc(0),this.expirationTimes=uc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Xd(e,t,r,n,i,s,o,l,a){return e=new DS(e,t,r,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Er(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Id(s),e}function IS(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Bi,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function T0(e){if(!e)return qn;e=e._reactInternals;e:{if(Ti(e)!==e||e.tag!==1)throw Error(re(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Jt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(re(171))}if(e.tag===1){var r=e.type;if(Jt(r))return Tv(e,r,t)}return t}function L0(e,t,r,n,i,s,o,l,a){return e=Xd(r,n,!0,e,i,s,o,l,a),e.context=T0(null),r=e.current,n=$t(),i=Hn(r),s=fn(n,i),s.callback=t??null,$n(r,s,i),e.current.lanes=i,Ao(e,i,n),er(e,n),e}function Fa(e,t,r,n){var i=t.current,s=$t(),o=Hn(i);return r=T0(r),t.context===null?t.context=r:t.pendingContext=r,t=fn(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=$n(i,t,o),e!==null&&(Fr(e,i,o,s),Tl(e,i,o)),o}function ga(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 Jp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Gd(e,t){Jp(e,t),(e=e.alternate)&&Jp(e,t)}function RS(){return null}var P0=typeof reportError=="function"?reportError:function(e){console.error(e)};function Qd(e){this._internalRoot=e}$a.prototype.render=Qd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(re(409));Fa(e,t,null,null)};$a.prototype.unmount=Qd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bi(function(){Fa(null,e,null,null)}),t[mn]=null}};function $a(e){this._internalRoot=e}$a.prototype.unstable_scheduleHydration=function(e){if(e){var t=lv();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Dn.length&&t!==0&&t<Dn[r].priority;r++);Dn.splice(r,0,e),r===0&&cv(e)}};function Zd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Wa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function em(){}function MS(e,t,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=ga(o);s.call(c)}}var o=L0(t,n,e,0,null,!1,!1,"",em);return e._reactRootContainer=o,e[mn]=o.current,vo(e.nodeType===8?e.parentNode:e),bi(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var c=ga(a);l.call(c)}}var a=Xd(e,0,!1,null,null,!1,!1,"",em);return e._reactRootContainer=a,e[mn]=a.current,vo(e.nodeType===8?e.parentNode:e),bi(function(){Fa(t,a,r,n)}),a}function Ha(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=ga(o);l.call(a)}}Fa(t,o,e,i)}else o=MS(r,t,e,i,n);return ga(o)}sv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=$s(t.pendingLanes);r!==0&&(_d(t,r|1),er(t,rt()),!(Re&6)&&(cs=rt()+500,Gn()))}break;case 13:bi(function(){var n=gn(e,1);if(n!==null){var i=$t();Fr(n,e,1,i)}}),Gd(e,1)}};vd=function(e){if(e.tag===13){var t=gn(e,134217728);if(t!==null){var r=$t();Fr(t,e,134217728,r)}Gd(e,134217728)}};ov=function(e){if(e.tag===13){var t=Hn(e),r=gn(e,t);if(r!==null){var n=$t();Fr(r,e,t,n)}Gd(e,t)}};lv=function(){return Me};av=function(e,t){var r=Me;try{return Me=e,t()}finally{Me=r}};Cu=function(e,t,r){switch(t){case"input":if(vu(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=Ra(n);if(!i)throw Error(re(90));z_(n),vu(n,i)}}}break;case"textarea":$_(e,r);break;case"select":t=r.value,t!=null&&Gi(e,!!r.multiple,t,!1)}};Y_=Vd;X_=bi;var AS={usingClientEntryPoint:!1,Events:[Bo,Wi,Ra,K_,q_,Vd]},Ls={findFiberByHostInstance:hi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jS={bundleType:Ls.bundleType,version:Ls.version,rendererPackageName:Ls.rendererPackageName,rendererConfig:Ls.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Z_(e),e===null?null:e.stateNode},findFiberByHostInstance:Ls.findFiberByHostInstance||RS,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 dl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!dl.isDisabled&&dl.supportsFiber)try{La=dl.inject(jS),Zr=dl}catch{}}fr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AS;fr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Zd(t))throw Error(re(200));return IS(e,t,null,r)};fr.createRoot=function(e,t){if(!Zd(e))throw Error(re(299));var r=!1,n="",i=P0;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Xd(e,1,!1,null,null,r,!1,n,i),e[mn]=t.current,vo(e.nodeType===8?e.parentNode:e),new Qd(t)};fr.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(re(188)):(e=Object.keys(e).join(","),Error(re(268,e)));return e=Z_(t),e=e===null?null:e.stateNode,e};fr.flushSync=function(e){return bi(e)};fr.hydrate=function(e,t,r){if(!Wa(t))throw Error(re(200));return Ha(null,e,t,!0,r)};fr.hydrateRoot=function(e,t,r){if(!Zd(e))throw Error(re(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",o=P0;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=L0(t,null,e,1,r??null,i,!1,s,o),e[mn]=t.current,vo(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 $a(t)};fr.render=function(e,t,r){if(!Wa(t))throw Error(re(200));return Ha(null,e,t,!1,r)};fr.unmountComponentAtNode=function(e){if(!Wa(e))throw Error(re(40));return e._reactRootContainer?(bi(function(){Ha(null,null,e,!1,function(){e._reactRootContainer=null,e[mn]=null})}),!0):!1};fr.unstable_batchedUpdates=Vd;fr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Wa(r))throw Error(re(200));if(e==null||e._reactInternals===void 0)throw Error(re(38));return Ha(e,t,r,!1,n)};fr.version="18.3.1-next-f1338f8080-20240426";function D0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(D0)}catch(e){console.error(e)}}D0(),D_.exports=fr;var BS=D_.exports,I0,tm=BS;I0=tm.createRoot,tm.hydrateRoot;/**
41
41
  * @remix-run/router v1.23.2
@@ -65,9 +65,9 @@ Error generating stack: `+s.message+`
65
65
  *
66
66
  * @license MIT
67
67
  */function oh(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 Lb(e,t){let r=oh(e);return t&&t.forEach((n,i)=>{r.has(i)||t.getAll(i).forEach(s=>{r.append(i,s)})}),r}const Pb="6";try{window.__reactRouterVersion=Pb}catch{}const Db="startTransition",am=E1[Db];function Ib(e){let{basename:t,children:r,future:n,window:i}=e,s=w.useRef();s.current==null&&(s.current=OS({window:i,v5Compat:!0}));let o=s.current,[l,a]=w.useState({action:o.action,location:o.location}),{v7_startTransition:c}=n||{},d=w.useCallback(u=>{c&&am?am(()=>a(u)):a(u)},[a,c]);return w.useLayoutEffect(()=>o.listen(d),[o,d]),w.useEffect(()=>Eb(n),[n]),w.createElement(Nb,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}var cm;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(cm||(cm={}));var um;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(um||(um={}));function Rb(e){let t=w.useRef(oh(e)),r=w.useRef(!1),n=$o(),i=w.useMemo(()=>Lb(n.search,r.current?null:t.current),[n.search]),s=gs(),o=w.useCallback((l,a)=>{const c=oh(typeof l=="function"?l(i):l);r.current=!0,s("?"+c,a)},[s,i]);return[i,o]}const K0=w.createContext({ides:[],updateIdeChats:()=>{},screenshotMap:{},setScreenshotMap:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{},wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1}),q0=w.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function Mb(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 Ab({children:e}){const[t,r]=w.useState([]),[n,i]=w.useState({}),[s,o]=w.useState(!1),[l,a]=w.useState([]),c=w.useCallback((u,f)=>{r(p=>p.map(m=>m.id===u?{...m,chats:f}:m))},[]),d={injectEntries:u=>{r(f=>f.length===0?u:Mb(u,f))},markLoaded:()=>o(!0),getIdes:()=>t};return h.jsx(q0.Provider,{value:d,children:h.jsx(K0.Provider,{value:{ides:t,updateIdeChats:c,screenshotMap:n,setScreenshotMap:i,initialLoaded:s,toasts:l,setToasts:a,wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1},children:e})})}function Y0(){return w.useContext(K0)}function hm(){return w.useContext(q0)}function jb(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/agents/${s}/send`,{method:"POST",body:JSON.stringify({agentType:o,message:l})}),getAgentStatus:s=>i(`/api/v1/agents/${s}/status`),approveAgent:(s,o,l)=>i(`/api/v1/agents/${s}/approve`,{method:"POST",body:JSON.stringify({agentType:o,approve:l})}),request:i}}const Bb=jb({baseUrl:"http://localhost:3847"});w.createContext(Bb);const Ob={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},X0=w.createContext(Ob);function zb({value:e,children:t}){return h.jsx(X0.Provider,{value:e,children:t})}function Li(){return w.useContext(X0)}function Fb(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const $b=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Wb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hb={};function dm(e,t){return(Hb.jsx?Wb:$b).test(e)}const Ub=/[ \t\n\f\r]/g;function Vb(e){return typeof e=="object"?e.type==="text"?fm(e.value):!1:fm(e)}function fm(e){return e.replace(Ub,"")===""}class Wo{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Wo.prototype.normal={};Wo.prototype.property={};Wo.prototype.space=void 0;function G0(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Wo(r,n,t)}function lh(e){return e.toLowerCase()}class tr{constructor(t,r){this.attribute=r,this.property=t}}tr.prototype.attribute="";tr.prototype.booleanish=!1;tr.prototype.boolean=!1;tr.prototype.commaOrSpaceSeparated=!1;tr.prototype.commaSeparated=!1;tr.prototype.defined=!1;tr.prototype.mustUseProperty=!1;tr.prototype.number=!1;tr.prototype.overloadedBoolean=!1;tr.prototype.property="";tr.prototype.spaceSeparated=!1;tr.prototype.space=void 0;let Kb=0;const Ee=Pi(),it=Pi(),ah=Pi(),ne=Pi(),Oe=Pi(),rs=Pi(),or=Pi();function Pi(){return 2**++Kb}const ch=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ee,booleanish:it,commaOrSpaceSeparated:or,commaSeparated:rs,number:ne,overloadedBoolean:ah,spaceSeparated:Oe},Symbol.toStringTag,{value:"Module"})),Ic=Object.keys(ch);class tf extends tr{constructor(t,r,n,i){let s=-1;if(super(t,r),pm(this,"space",i),typeof n=="number")for(;++s<Ic.length;){const o=Ic[s];pm(this,Ic[s],(n&ch[o])===ch[o])}}}tf.prototype.defined=!0;function pm(e,t,r){r&&(e[t]=r)}function _s(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new tf(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[lh(n)]=n,r[lh(s.attribute)]=n}return new Wo(t,r,e.space)}const Q0=_s({properties:{ariaActiveDescendant:null,ariaAtomic:it,ariaAutoComplete:null,ariaBusy:it,ariaChecked:it,ariaColCount:ne,ariaColIndex:ne,ariaColSpan:ne,ariaControls:Oe,ariaCurrent:null,ariaDescribedBy:Oe,ariaDetails:null,ariaDisabled:it,ariaDropEffect:Oe,ariaErrorMessage:null,ariaExpanded:it,ariaFlowTo:Oe,ariaGrabbed:it,ariaHasPopup:null,ariaHidden:it,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Oe,ariaLevel:ne,ariaLive:null,ariaModal:it,ariaMultiLine:it,ariaMultiSelectable:it,ariaOrientation:null,ariaOwns:Oe,ariaPlaceholder:null,ariaPosInSet:ne,ariaPressed:it,ariaReadOnly:it,ariaRelevant:null,ariaRequired:it,ariaRoleDescription:Oe,ariaRowCount:ne,ariaRowIndex:ne,ariaRowSpan:ne,ariaSelected:it,ariaSetSize:ne,ariaSort:null,ariaValueMax:ne,ariaValueMin:ne,ariaValueNow:ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Z0(e,t){return t in e?e[t]:t}function J0(e,t){return Z0(e,t.toLowerCase())}const qb=_s({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:rs,acceptCharset:Oe,accessKey:Oe,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:Oe,autoFocus:Ee,autoPlay:Ee,blocking:Oe,capture:null,charSet:null,checked:Ee,cite:null,className:Oe,cols:ne,colSpan:null,content:null,contentEditable:it,controls:Ee,controlsList:Oe,coords:ne|rs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:ah,draggable:it,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:Oe,height:ne,hidden:ah,high:ne,href:null,hrefLang:null,htmlFor:Oe,httpEquiv:Oe,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:Oe,itemRef:Oe,itemScope:Ee,itemType:Oe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:ne,manifest:null,max:null,maxLength:ne,media:null,method:null,min:null,minLength:ne,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,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:Ee,optimum:ne,pattern:null,ping:Oe,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:Oe,required:Ee,reversed:Ee,rows:ne,rowSpan:ne,sandbox:Oe,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shape:null,size:ne,sizes:null,slot:null,span:ne,spellCheck:it,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ne,step:null,style:null,tabIndex:ne,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:it,width:ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Oe,axis:null,background:null,bgColor:null,border:ne,borderColor:null,bottomMargin:ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:ne,leftMargin:ne,link:null,longDesc:null,lowSrc:null,marginHeight:ne,marginWidth:ne,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:ne,rules:null,scheme:null,scrolling:it,standby:null,summary:null,text:null,topMargin:ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ee,disableRemotePlayback:Ee,prefix:null,property:null,results:ne,security:null,unselectable:null},space:"html",transform:J0}),Yb=_s({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:or,accentHeight:ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ne,amplitude:ne,arabicForm:null,ascent:ne,attributeName:null,attributeType:null,azimuth:ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ne,by:null,calcMode:null,capHeight:ne,className:Oe,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:ne,diffuseConstant:ne,direction:null,display:null,dur:null,divisor:ne,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:ne,enableBackground:null,end:null,event:null,exponent:ne,externalResourcesRequired:null,fill:null,fillOpacity:ne,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:rs,g2:rs,glyphName:rs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ne,horizOriginX:ne,horizOriginY:ne,id:null,ideographic:ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ne,k:ne,k1:ne,k2:ne,k3:ne,k4:ne,kernelMatrix:or,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ne,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:ne,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:ne,overlineThickness:ne,paintOrder:null,panose1:null,path:null,pathLength:ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Oe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ne,pointsAtY:ne,pointsAtZ:ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:or,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:or,rev:or,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:or,requiredFeatures:or,requiredFonts:or,requiredFormats:or,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:ne,specularExponent:ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ne,strikethroughThickness:ne,string:null,stroke:null,strokeDashArray:or,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ne,strokeOpacity:ne,strokeWidth:null,style:null,surfaceScale:ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:or,tabIndex:ne,tableValues:null,target:null,targetX:ne,targetY:ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:or,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ne,underlineThickness:ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ne,values:null,vAlphabetic:ne,vMathematical:ne,vectorEffect:null,vHanging:ne,vIdeographic:ne,version:null,vertAdvY:ne,vertOriginX:ne,vertOriginY:ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Z0}),ey=_s({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()}}),ty=_s({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:J0}),ry=_s({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Xb={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"},Gb=/[A-Z]/g,mm=/-[a-z]/g,Qb=/^data[-\w.:]+$/i;function Zb(e,t){const r=lh(t);let n=t,i=tr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Qb.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(mm,ek);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!mm.test(s)){let o=s.replace(Gb,Jb);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=tf}return new i(n,t)}function Jb(e){return"-"+e.toLowerCase()}function ek(e){return e.charAt(1).toUpperCase()}const tk=G0([Q0,qb,ey,ty,ry],"html"),rf=G0([Q0,Yb,ey,ty,ry],"svg");function rk(e){return e.join(" ").trim()}var nf={},gm=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,nk=/\n/g,ik=/^\s*/,sk=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,ok=/^:\s*/,lk=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ak=/^[;\s]*/,ck=/^\s+|\s+$/g,uk=`
68
- `,_m="/",vm="*",ui="",hk="comment",dk="declaration";function fk(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 g=m.match(nk);g&&(r+=g.length);var S=m.lastIndexOf(uk);n=~S?m.length-S:n+m.length}function s(){var m={line:r,column:n};return function(g){return g.position=new o(m),c(),g}}function o(m){this.start=m,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(m){var g=new Error(t.source+":"+r+":"+n+": "+m);if(g.reason=m,g.filename=t.source,g.line=r,g.column=n,g.source=e,!t.silent)throw g}function a(m){var g=m.exec(e);if(g){var S=g[0];return i(S),e=e.slice(S.length),g}}function c(){a(ik)}function d(m){var g;for(m=m||[];g=u();)g!==!1&&m.push(g);return m}function u(){var m=s();if(!(_m!=e.charAt(0)||vm!=e.charAt(1))){for(var g=2;ui!=e.charAt(g)&&(vm!=e.charAt(g)||_m!=e.charAt(g+1));)++g;if(g+=2,ui===e.charAt(g-1))return l("End of comment missing");var S=e.slice(2,g-2);return n+=2,i(S),e=e.slice(g),n+=2,m({type:hk,comment:S})}}function f(){var m=s(),g=a(sk);if(g){if(u(),!a(ok))return l("property missing ':'");var S=a(lk),_=m({type:dk,property:ym(g[0].replace(gm,ui)),value:S?ym(S[0].replace(gm,ui)):ui});return a(ak),_}}function p(){var m=[];d(m);for(var g;g=f();)g!==!1&&(m.push(g),d(m));return m}return c(),p()}function ym(e){return e?e.replace(ck,ui):ui}var pk=fk,mk=Kl&&Kl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nf,"__esModule",{value:!0});nf.default=_k;const gk=mk(pk);function _k(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 Va={};Object.defineProperty(Va,"__esModule",{value:!0});Va.camelCase=void 0;var vk=/^--[a-zA-Z0-9_-]+$/,yk=/-([a-z])/g,xk=/^[^-]+$/,wk=/^-(webkit|moz|ms|o|khtml)-/,Sk=/^-(ms)-/,bk=function(e){return!e||xk.test(e)||vk.test(e)},kk=function(e,t){return t.toUpperCase()},xm=function(e,t){return"".concat(t,"-")},Ck=function(e,t){return t===void 0&&(t={}),bk(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Sk,xm):e=e.replace(wk,xm),e.replace(yk,kk))};Va.camelCase=Ck;var Ek=Kl&&Kl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Nk=Ek(nf),Tk=Va;function uh(e,t){var r={};return!e||typeof e!="string"||(0,Nk.default)(e,function(n,i){n&&i&&(r[(0,Tk.camelCase)(n,t)]=i)}),r}uh.default=uh;var Lk=uh;const Pk=id(Lk),ny=iy("end"),sf=iy("start");function iy(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 Dk(e){const t=sf(e),r=ny(e);if(t&&r)return{start:t,end:r}}function no(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?wm(e.position):"start"in e||"end"in e?wm(e):"line"in e||"column"in e?hh(e):""}function hh(e){return Sm(e&&e.line)+":"+Sm(e&&e.column)}function wm(e){return hh(e&&e.start)+"-"+hh(e&&e.end)}function Sm(e){return e&&typeof e=="number"?e:1}class Bt 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=no(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}}Bt.prototype.file="";Bt.prototype.name="";Bt.prototype.reason="";Bt.prototype.message="";Bt.prototype.stack="";Bt.prototype.column=void 0;Bt.prototype.line=void 0;Bt.prototype.ancestors=void 0;Bt.prototype.cause=void 0;Bt.prototype.fatal=void 0;Bt.prototype.place=void 0;Bt.prototype.ruleId=void 0;Bt.prototype.source=void 0;const of={}.hasOwnProperty,Ik=new Map,Rk=/[A-Z]/g,Mk=new Set(["table","tbody","thead","tfoot","tr"]),Ak=new Set(["td","th"]),sy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jk(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=Uk(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=Hk(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"?rf:tk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=oy(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function oy(e,t,r){if(t.type==="element")return Bk(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Ok(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Fk(e,t,r);if(t.type==="mdxjsEsm")return zk(e,t);if(t.type==="root")return $k(e,t,r);if(t.type==="text")return Wk(e,t)}function Bk(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=rf,e.schema=i),e.ancestors.push(t);const s=ay(e,t.tagName,!1),o=Vk(e,t);let l=af(e,t);return Mk.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Vb(a):!0})),ly(e,o,s,t),lf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function Ok(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)}Lo(e,t.position)}function zk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lo(e,t.position)}function Fk(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=rf,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:ay(e,t.name,!0),o=Kk(e,t),l=af(e,t);return ly(e,o,s,t),lf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function $k(e,t,r){const n={};return lf(n,af(e,t)),e.create(t,e.Fragment,n,r)}function Wk(e,t){return t.value}function ly(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function lf(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function Hk(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 Uk(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),a=sf(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 Vk(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&of.call(t.properties,i)){const s=qk(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Ak.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 Kk(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 Lo(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 Lo(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function af(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:Ik;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=oy(e,s,o);l!==void 0&&r.push(l)}return r}function qk(e,t,r){const n=Zb(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Fb(r):rk(r)),n.property==="style"){let i=typeof r=="object"?r:Yk(e,String(r));return e.stylePropertyNameCase==="css"&&(i=Xk(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?Xb[n.property]||n.property:n.attribute,r]}}function Yk(e,t){try{return Pk(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new Bt("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=sy+"#cannot-parse-style-attribute",i}}function ay(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=dm(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=dm(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return of.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);Lo(e)}function Lo(e,t){const r=new Bt("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=sy+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Xk(e){const t={};let r;for(r in e)of.call(e,r)&&(t[Gk(r)]=e[r]);return t}function Gk(e){let t=e.replace(Rk,Qk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Qk(e){return"-"+e.toLowerCase()}const Rc={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"]},Zk={};function cf(e,t){const r=Zk,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return cy(e,n,i)}function cy(e,t,r){if(Jk(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 bm(e.children,t,r)}return Array.isArray(e)?bm(e,t,r):""}function bm(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=cy(e[i],t,r);return n.join("")}function Jk(e){return!!(e&&typeof e=="object")}const km=document.createElement("i");function uf(e){const t="&"+e+";";km.innerHTML=t;const r=km.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function hr(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 Cr(e,t){return e.length>0?(hr(e,e.length,0,t),e):t}const Cm={}.hasOwnProperty;function uy(e){const t={};let r=-1;for(;++r<e.length;)eC(t,e[r]);return t}function eC(e,t){let r;for(r in t){const i=(Cm.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){Cm.call(i,o)||(i[o]=[]);const l=s[o];tC(i[o],Array.isArray(l)?l:l?[l]:[])}}}function tC(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);hr(e,0,0,n)}function hy(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 $r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ft=Zn(/[A-Za-z]/),At=Zn(/[\dA-Za-z]/),rC=Zn(/[#-'*+\--9=?A-Z^-~]/);function _a(e){return e!==null&&(e<32||e===127)}const dh=Zn(/\d/),nC=Zn(/[\dA-Fa-f]/),iC=Zn(/[!-/:-@[-`{-~]/);function Se(e){return e!==null&&e<-2}function Be(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const Ka=Zn(new RegExp("\\p{P}|\\p{S}","u")),ki=Zn(/\s/);function Zn(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function vs(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&At(e.charCodeAt(r+1))&&At(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 Ie(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return Pe(a)?(e.enter(r),l(a)):t(a)}function l(a){return Pe(a)&&s++<i?(e.consume(a),l):(e.exit(r),t(a))}}const sC={tokenize:oC};function oC(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"),Ie(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 Se(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const lC={tokenize:aC},Em={tokenize:cC};function aC(e){const t=this,r=[];let n=0,i,s,o;return l;function l(x){if(n<r.length){const N=r[n];return t.containerState=N[1],e.attempt(N[0].continuation,a,c)(x)}return c(x)}function a(x){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const N=t.events.length;let T=N,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){C=t.events[T][1].end;break}_(n);let M=N;for(;M<t.events.length;)t.events[M][1].end={...C},M++;return hr(t.events,T+1,0,t.events.slice(N)),t.events.length=M,c(x)}return l(x)}function c(x){if(n===r.length){if(!i)return f(x);if(i.currentConstruct&&i.currentConstruct.concrete)return m(x);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Em,d,u)(x)}function d(x){return i&&y(),_(n),f(x)}function u(x){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,m(x)}function f(x){return t.containerState={},e.attempt(Em,p,m)(x)}function p(x){return n++,r.push([t.currentConstruct,t.containerState]),f(x)}function m(x){if(x===null){i&&y(),_(0),e.consume(x);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(x)}function g(x){if(x===null){S(e.exit("chunkFlow"),!0),_(0),e.consume(x);return}return Se(x)?(e.consume(x),S(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(x),g)}function S(x,N){const T=t.sliceStream(x);if(N&&T.push(null),x.previous=s,s&&(s.next=x),s=x,i.defineSkip(x.start),i.write(T),t.parser.lazy[x.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;const M=t.events.length;let F=M,$,E;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if($){E=t.events[F][1].end;break}$=!0}for(_(n),C=M;C<t.events.length;)t.events[C][1].end={...E},C++;hr(t.events,F+1,0,t.events.slice(M)),t.events.length=C}}function _(x){let N=r.length;for(;N-- >x;){const T=r[N];t.containerState=T[1],T[0].exit.call(t,e)}r.length=x}function y(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function cC(e,t,r){return Ie(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function us(e){if(e===null||Be(e)||ki(e))return 1;if(Ka(e))return 2}function qa(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 fh={name:"attention",resolveAll:uC,tokenize:hC};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};Nm(u,-a),Nm(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=Cr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=Cr(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=Cr(c,qa(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=Cr(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=Cr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):d=0,hr(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 hC(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=us(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=us(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 Nm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const dC={name:"autolink",tokenize:fC};function fC(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 Ft(p)?(e.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||At(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||At(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||_a(p)?r(p):(e.consume(p),a)}function c(p){return p===64?(e.consume(p),d):rC(p)?(e.consume(p),c):r(p)}function d(p){return At(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||At(p))&&n++<63){const m=p===45?f:u;return e.consume(p),m}return r(p)}}const Ho={partial:!0,tokenize:pC};function pC(e,t,r){return n;function n(s){return Pe(s)?Ie(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Se(s)?t(s):r(s)}}const dy={continuation:{tokenize:gC},exit:_C,name:"blockQuote",tokenize:mC};function mC(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 Pe(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 Pe(o)?Ie(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(dy,t,r)(o)}}function _C(e){e.exit("blockQuote")}const fy={name:"characterEscape",tokenize:vC};function vC(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 iC(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const py={name:"characterReference",tokenize:yC};function yC(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=At,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=nC,d):(e.enter("characterReferenceValue"),s=7,o=dh,d(u))}function d(u){if(u===59&&i){const f=e.exit("characterReferenceValue");return o===At&&!uf(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 Tm={partial:!0,tokenize:wC},Lm={concrete:!0,name:"codeFenced",tokenize:xC};function xC(e,t,r){const n=this,i={partial:!0,tokenize:T};let s=0,o=0,l;return a;function a(C){return c(C)}function c(C){const M=n.events[n.events.length-1];return s=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,l=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===l?(o++,e.consume(C),d):o<3?r(C):(e.exit("codeFencedFenceSequence"),Pe(C)?Ie(e,u,"whitespace")(C):u(C))}function u(C){return C===null||Se(C)?(e.exit("codeFencedFence"),n.interrupt?t(C):e.check(Tm,g,N)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||Se(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(C)):Pe(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ie(e,p,"whitespace")(C)):C===96&&C===l?r(C):(e.consume(C),f)}function p(C){return C===null||Se(C)?u(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||Se(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(C)):C===96&&C===l?r(C):(e.consume(C),m)}function g(C){return e.attempt(i,N,S)(C)}function S(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),_}function _(C){return s>0&&Pe(C)?Ie(e,y,"linePrefix",s+1)(C):y(C)}function y(C){return C===null||Se(C)?e.check(Tm,g,N)(C):(e.enter("codeFlowValue"),x(C))}function x(C){return C===null||Se(C)?(e.exit("codeFlowValue"),y(C)):(e.consume(C),x)}function N(C){return e.exit("codeFenced"),t(C)}function T(C,M,F){let $=0;return E;function E(D){return C.enter("lineEnding"),C.consume(D),C.exit("lineEnding"),U}function U(D){return C.enter("codeFencedFence"),Pe(D)?Ie(C,j,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):j(D)}function j(D){return D===l?(C.enter("codeFencedFenceSequence"),A(D)):F(D)}function A(D){return D===l?($++,C.consume(D),A):$>=o?(C.exit("codeFencedFenceSequence"),Pe(D)?Ie(C,V,"whitespace")(D):V(D)):F(D)}function V(D){return D===null||Se(D)?(C.exit("codeFencedFence"),M(D)):F(D)}}}function wC(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 Mc={name:"codeIndented",tokenize:bC},SC={partial:!0,tokenize:kC};function bC(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Ie(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):Se(c)?e.attempt(SC,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||Se(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function kC(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Se(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ie(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):Se(o)?i(o):r(o)}}const CC={name:"codeText",previous:NC,resolve:EC,tokenize:TC};function EC(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 NC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TC(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)):Se(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||Se(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 LC{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&&Ps(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),Ps(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ps(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);Ps(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ps(this.left,r.reverse())}}}function Ps(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 my(e){const t={};let r=-1,n,i,s,o,l,a,c;const d=new LC(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,PC(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 hr(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function PC(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,g=0;const S=[g];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&&(g=f+1,S.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):S.pop(),f=S.length;f--;){const _=l.slice(S[f],S[f+1]),y=s.pop();a.push([y,y+_.length-1]),e.splice(y,2,_)}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 DC={resolve:RC,tokenize:MC},IC={partial:!0,tokenize:AC};function RC(e){return my(e),e}function MC(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):Se(l)?e.check(IC,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 AC(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ie(e,s,"linePrefix")}function s(o){if(o===null||Se(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 gy(e,t,r,n,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let d=0;return u;function u(_){return _===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(_),e.exit(s),f):_===null||_===32||_===41||_a(_)?r(_):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(_))}function f(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===62?(e.exit("chunkString"),e.exit(l),f(_)):_===null||_===60||Se(_)?r(_):(e.consume(_),_===92?m:p)}function m(_){return _===60||_===62||_===92?(e.consume(_),p):p(_)}function g(_){return!d&&(_===null||_===41||Be(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(_)):d<c&&_===40?(e.consume(_),d++,g):_===41?(e.consume(_),d--,g):_===null||_===32||_===40||_a(_)?r(_):(e.consume(_),_===92?S:g)}function S(_){return _===40||_===41||_===92?(e.consume(_),g):g(_)}}function _y(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):Se(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||Se(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),a||(a=!Pe(p)),p===92?f:u)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,u):u(p)}}function vy(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):Se(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ie(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||Se(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 io(e,t){let r;return n;function n(i){return Se(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Pe(i)?Ie(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const jC={name:"definition",tokenize:OC},BC={partial:!0,tokenize:zC};function OC(e,t,r){const n=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return _y.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=$r(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 Be(p)?io(e,c)(p):c(p)}function c(p){return gy(e,d,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(BC,u,u)(p)}function u(p){return Pe(p)?Ie(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Se(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function zC(e,t,r){return n;function n(l){return Be(l)?io(e,i)(l):r(l)}function i(l){return vy(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Pe(l)?Ie(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Se(l)?t(l):r(l)}}const FC={name:"hardBreakEscape",tokenize:$C};function $C(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Se(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const WC={name:"headingAtx",resolve:HC,tokenize:UC};function HC(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"},hr(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function UC(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||Be(d)?(e.exit("atxHeadingSequence"),l(d)):r(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),a(d)):d===null||Se(d)?(e.exit("atxHeading"),t(d)):Pe(d)?Ie(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||Be(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const VC=["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"],Pm=["pre","script","style","textarea"],KC={concrete:!0,name:"htmlFlow",resolveTo:XC,tokenize:GC},qC={partial:!0,tokenize:ZC},YC={partial:!0,tokenize:QC};function XC(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 GC(e,t,r){const n=this;let i,s,o,l,a;return c;function c(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),u}function u(k){return k===33?(e.consume(k),f):k===47?(e.consume(k),s=!0,g):k===63?(e.consume(k),i=3,n.interrupt?t:b):Ft(k)?(e.consume(k),o=String.fromCharCode(k),S):r(k)}function f(k){return k===45?(e.consume(k),i=2,p):k===91?(e.consume(k),i=5,l=0,m):Ft(k)?(e.consume(k),i=4,n.interrupt?t:b):r(k)}function p(k){return k===45?(e.consume(k),n.interrupt?t:b):r(k)}function m(k){const ye="CDATA[";return k===ye.charCodeAt(l++)?(e.consume(k),l===ye.length?n.interrupt?t:j:m):r(k)}function g(k){return Ft(k)?(e.consume(k),o=String.fromCharCode(k),S):r(k)}function S(k){if(k===null||k===47||k===62||Be(k)){const ye=k===47,G=o.toLowerCase();return!ye&&!s&&Pm.includes(G)?(i=1,n.interrupt?t(k):j(k)):VC.includes(o.toLowerCase())?(i=6,ye?(e.consume(k),_):n.interrupt?t(k):j(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(k):s?y(k):x(k))}return k===45||At(k)?(e.consume(k),o+=String.fromCharCode(k),S):r(k)}function _(k){return k===62?(e.consume(k),n.interrupt?t:j):r(k)}function y(k){return Pe(k)?(e.consume(k),y):E(k)}function x(k){return k===47?(e.consume(k),E):k===58||k===95||Ft(k)?(e.consume(k),N):Pe(k)?(e.consume(k),x):E(k)}function N(k){return k===45||k===46||k===58||k===95||At(k)?(e.consume(k),N):T(k)}function T(k){return k===61?(e.consume(k),C):Pe(k)?(e.consume(k),T):x(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),a=k,M):Pe(k)?(e.consume(k),C):F(k)}function M(k){return k===a?(e.consume(k),a=null,$):k===null||Se(k)?r(k):(e.consume(k),M)}function F(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Be(k)?T(k):(e.consume(k),F)}function $(k){return k===47||k===62||Pe(k)?x(k):r(k)}function E(k){return k===62?(e.consume(k),U):r(k)}function U(k){return k===null||Se(k)?j(k):Pe(k)?(e.consume(k),U):r(k)}function j(k){return k===45&&i===2?(e.consume(k),O):k===60&&i===1?(e.consume(k),K):k===62&&i===4?(e.consume(k),te):k===63&&i===3?(e.consume(k),b):k===93&&i===5?(e.consume(k),H):Se(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(qC,ae,A)(k)):k===null||Se(k)?(e.exit("htmlFlowData"),A(k)):(e.consume(k),j)}function A(k){return e.check(YC,V,ae)(k)}function V(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),D}function D(k){return k===null||Se(k)?A(k):(e.enter("htmlFlowData"),j(k))}function O(k){return k===45?(e.consume(k),b):j(k)}function K(k){return k===47?(e.consume(k),o="",I):j(k)}function I(k){if(k===62){const ye=o.toLowerCase();return Pm.includes(ye)?(e.consume(k),te):j(k)}return Ft(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),I):j(k)}function H(k){return k===93?(e.consume(k),b):j(k)}function b(k){return k===62?(e.consume(k),te):k===45&&i===2?(e.consume(k),b):j(k)}function te(k){return k===null||Se(k)?(e.exit("htmlFlowData"),ae(k)):(e.consume(k),te)}function ae(k){return e.exit("htmlFlow"),t(k)}}function QC(e,t,r){const n=this;return i;function i(o){return Se(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 ZC(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ho,t,r)}}const JC={name:"htmlText",tokenize:e2};function e2(e,t,r){const n=this;let i,s,o;return l;function l(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),a}function a(b){return b===33?(e.consume(b),c):b===47?(e.consume(b),T):b===63?(e.consume(b),x):Ft(b)?(e.consume(b),F):r(b)}function c(b){return b===45?(e.consume(b),d):b===91?(e.consume(b),s=0,m):Ft(b)?(e.consume(b),y):r(b)}function d(b){return b===45?(e.consume(b),p):r(b)}function u(b){return b===null?r(b):b===45?(e.consume(b),f):Se(b)?(o=u,K(b)):(e.consume(b),u)}function f(b){return b===45?(e.consume(b),p):u(b)}function p(b){return b===62?O(b):b===45?f(b):u(b)}function m(b){const te="CDATA[";return b===te.charCodeAt(s++)?(e.consume(b),s===te.length?g:m):r(b)}function g(b){return b===null?r(b):b===93?(e.consume(b),S):Se(b)?(o=g,K(b)):(e.consume(b),g)}function S(b){return b===93?(e.consume(b),_):g(b)}function _(b){return b===62?O(b):b===93?(e.consume(b),_):g(b)}function y(b){return b===null||b===62?O(b):Se(b)?(o=y,K(b)):(e.consume(b),y)}function x(b){return b===null?r(b):b===63?(e.consume(b),N):Se(b)?(o=x,K(b)):(e.consume(b),x)}function N(b){return b===62?O(b):x(b)}function T(b){return Ft(b)?(e.consume(b),C):r(b)}function C(b){return b===45||At(b)?(e.consume(b),C):M(b)}function M(b){return Se(b)?(o=M,K(b)):Pe(b)?(e.consume(b),M):O(b)}function F(b){return b===45||At(b)?(e.consume(b),F):b===47||b===62||Be(b)?$(b):r(b)}function $(b){return b===47?(e.consume(b),O):b===58||b===95||Ft(b)?(e.consume(b),E):Se(b)?(o=$,K(b)):Pe(b)?(e.consume(b),$):O(b)}function E(b){return b===45||b===46||b===58||b===95||At(b)?(e.consume(b),E):U(b)}function U(b){return b===61?(e.consume(b),j):Se(b)?(o=U,K(b)):Pe(b)?(e.consume(b),U):$(b)}function j(b){return b===null||b===60||b===61||b===62||b===96?r(b):b===34||b===39?(e.consume(b),i=b,A):Se(b)?(o=j,K(b)):Pe(b)?(e.consume(b),j):(e.consume(b),V)}function A(b){return b===i?(e.consume(b),i=void 0,D):b===null?r(b):Se(b)?(o=A,K(b)):(e.consume(b),A)}function V(b){return b===null||b===34||b===39||b===60||b===61||b===96?r(b):b===47||b===62||Be(b)?$(b):(e.consume(b),V)}function D(b){return b===47||b===62||Be(b)?$(b):r(b)}function O(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):r(b)}function K(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),I}function I(b){return Pe(b)?Ie(e,H,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):H(b)}function H(b){return e.enter("htmlTextData"),o(b)}}const hf={name:"labelEnd",resolveAll:i2,resolveTo:s2,tokenize:o2},t2={tokenize:l2},r2={tokenize:a2},n2={tokenize:c2};function i2(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&&hr(e,0,e.length,r),e}function s2(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=Cr(l,e.slice(s+1,s+n+3)),l=Cr(l,[["enter",d,t]]),l=Cr(l,qa(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=Cr(l,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),l=Cr(l,e.slice(o+1)),l=Cr(l,[["exit",a,t]]),hr(e,s,e.length,l),e}function o2(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($r(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(t2,d,o?d:u)(f):f===91?e.attempt(r2,d,o?c:u)(f):o?d(f):u(f)}function c(f){return e.attempt(n2,d,u)(f)}function d(f){return t(f)}function u(f){return s._balanced=!0,r(f)}}function l2(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 Be(u)?io(e,s)(u):s(u)}function s(u){return u===41?d(u):gy(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return Be(u)?io(e,a)(u):d(u)}function l(u){return r(u)}function a(u){return u===34||u===39||u===40?vy(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):d(u)}function c(u){return Be(u)?io(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 a2(e,t,r){const n=this;return i;function i(l){return _y.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes($r(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function c2(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:hf.resolveAll,tokenize:h2};function h2(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 d2={name:"labelStartLink",resolveAll:hf.resolveAll,tokenize:f2};function f2(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 Ac={name:"lineEnding",tokenize:p2};function p2(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ie(e,t,"linePrefix")}}const jl={name:"thematicBreak",tokenize:m2};function m2(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||Se(c))?(e.exit("thematicBreak"),t(c)):r(c)}function a(c){return c===i?(e.consume(c),n++,a):(e.exit("thematicBreakSequence"),Pe(c)?Ie(e,l,"whitespace")(c):l(c))}}const Yt={continuation:{tokenize:y2},exit:w2,name:"list",tokenize:v2},g2={partial:!0,tokenize:S2},_2={partial:!0,tokenize:x2};function v2(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:dh(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(jl,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 dh(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(Ho,n.interrupt?r:d,e.attempt(g2,f,u))}function d(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function u(p){return Pe(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 y2(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(Ho,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ie(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!Pe(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(_2,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ie(e,e.attempt(Yt,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function x2(e,t,r){const n=this;return Ie(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 w2(e){e.exit(this.containerState.type)}function S2(e,t,r){const n=this;return Ie(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!Pe(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const Dm={name:"setextUnderline",resolveTo:b2,tokenize:k2};function b2(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 k2(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"),Pe(c)?Ie(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||Se(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const C2={tokenize:E2};function E2(e){const t=this,r=e.attempt(Ho,n,e.attempt(this.parser.constructs.flowInitial,i,Ie(e,e.attempt(this.parser.constructs.flow,i,e.attempt(DC,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 N2={resolveAll:xy()},T2=yy("string"),L2=yy("text");function yy(e){return{resolveAll:xy(e==="text"?P2: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 xy(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 P2(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 D2={42:Yt,43:Yt,45:Yt,48:Yt,49:Yt,50:Yt,51:Yt,52:Yt,53:Yt,54:Yt,55:Yt,56:Yt,57:Yt,62:dy},I2={91:jC},R2={[-2]:Mc,[-1]:Mc,32:Mc},M2={35:WC,42:jl,45:[Dm,jl],60:KC,61:Dm,95:jl,96:Lm,126:Lm},A2={38:py,92:fy},j2={[-5]:Ac,[-4]:Ac,[-3]:Ac,33:u2,38:py,42:fh,60:[dC,JC],91:d2,92:[FC,fy],93:hf,95:fh,96:CC},B2={null:[fh,N2]},O2={null:[42,95]},z2={null:[]},F2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:O2,contentInitial:I2,disable:z2,document:D2,flow:M2,flowInitial:R2,insideSpan:B2,string:A2,text:j2},Symbol.toStringTag,{value:"Module"}));function $2(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:M(T),check:M(C),consume:y,enter:x,exit:N,interrupt:M(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,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(U){return o=Cr(o,U),S(),o[o.length-1]!==null?[]:(F(t,0),c.events=qa(s,c.events,c),c.events)}function f(U,j){return H2(p(U),j)}function p(U){return W2(o,U)}function m(){const{_bufferIndex:U,_index:j,line:A,column:V,offset:D}=n;return{_bufferIndex:U,_index:j,line:A,column:V,offset:D}}function g(U){i[U.line]=U.column,E()}function S(){let U;for(;n._index<o.length;){const j=o[n._index];if(typeof j=="string")for(U=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===U&&n._bufferIndex<j.length;)_(j.charCodeAt(n._bufferIndex));else _(j)}}function _(U){d=d(U)}function y(U){Se(U)?(n.line++,n.column=1,n.offset+=U===-3?2:1,E()):U!==-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=U}function x(U,j){const A=j||{};return A.type=U,A.start=m(),c.events.push(["enter",A,c]),l.push(A),A}function N(U){const j=l.pop();return j.end=m(),c.events.push(["exit",j,c]),j}function T(U,j){F(U,j.from)}function C(U,j){j.restore()}function M(U,j){return A;function A(V,D,O){let K,I,H,b;return Array.isArray(V)?ae(V):"tokenize"in V?ae([V]):te(V);function te(Z){return X;function X(ce){const me=ce!==null&&Z[ce],fe=ce!==null&&Z.null,xe=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return ae(xe)(ce)}}function ae(Z){return K=Z,I=0,Z.length===0?O:k(Z[I])}function k(Z){return X;function X(ce){return b=$(),H=Z,Z.partial||(c.currentConstruct=Z),Z.name&&c.parser.constructs.disable.null.includes(Z.name)?G():Z.tokenize.call(j?Object.assign(Object.create(c),j):c,a,ye,G)(ce)}}function ye(Z){return U(H,b),D}function G(Z){return b.restore(),++I<K.length?k(K[I]):O}}}function F(U,j){U.resolveAll&&!s.includes(U)&&s.push(U),U.resolve&&hr(c.events,j,c.events.length-j,U.resolve(c.events.slice(j),c)),U.resolveTo&&(c.events=U.resolveTo(c.events,c))}function $(){const U=m(),j=c.previous,A=c.currentConstruct,V=c.events.length,D=Array.from(l);return{from:V,restore:O};function O(){n=U,c.previous=j,c.currentConstruct=A,c.events.length=V,l=D,E()}}function E(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function W2(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 H2(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=`
68
+ `,_m="/",vm="*",ui="",hk="comment",dk="declaration";function fk(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 g=m.match(nk);g&&(r+=g.length);var S=m.lastIndexOf(uk);n=~S?m.length-S:n+m.length}function s(){var m={line:r,column:n};return function(g){return g.position=new o(m),c(),g}}function o(m){this.start=m,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(m){var g=new Error(t.source+":"+r+":"+n+": "+m);if(g.reason=m,g.filename=t.source,g.line=r,g.column=n,g.source=e,!t.silent)throw g}function a(m){var g=m.exec(e);if(g){var S=g[0];return i(S),e=e.slice(S.length),g}}function c(){a(ik)}function d(m){var g;for(m=m||[];g=u();)g!==!1&&m.push(g);return m}function u(){var m=s();if(!(_m!=e.charAt(0)||vm!=e.charAt(1))){for(var g=2;ui!=e.charAt(g)&&(vm!=e.charAt(g)||_m!=e.charAt(g+1));)++g;if(g+=2,ui===e.charAt(g-1))return l("End of comment missing");var S=e.slice(2,g-2);return n+=2,i(S),e=e.slice(g),n+=2,m({type:hk,comment:S})}}function f(){var m=s(),g=a(sk);if(g){if(u(),!a(ok))return l("property missing ':'");var S=a(lk),_=m({type:dk,property:ym(g[0].replace(gm,ui)),value:S?ym(S[0].replace(gm,ui)):ui});return a(ak),_}}function p(){var m=[];d(m);for(var g;g=f();)g!==!1&&(m.push(g),d(m));return m}return c(),p()}function ym(e){return e?e.replace(ck,ui):ui}var pk=fk,mk=Kl&&Kl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nf,"__esModule",{value:!0});nf.default=_k;const gk=mk(pk);function _k(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 Va={};Object.defineProperty(Va,"__esModule",{value:!0});Va.camelCase=void 0;var vk=/^--[a-zA-Z0-9_-]+$/,yk=/-([a-z])/g,xk=/^[^-]+$/,wk=/^-(webkit|moz|ms|o|khtml)-/,Sk=/^-(ms)-/,bk=function(e){return!e||xk.test(e)||vk.test(e)},kk=function(e,t){return t.toUpperCase()},xm=function(e,t){return"".concat(t,"-")},Ck=function(e,t){return t===void 0&&(t={}),bk(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Sk,xm):e=e.replace(wk,xm),e.replace(yk,kk))};Va.camelCase=Ck;var Ek=Kl&&Kl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Nk=Ek(nf),Tk=Va;function uh(e,t){var r={};return!e||typeof e!="string"||(0,Nk.default)(e,function(n,i){n&&i&&(r[(0,Tk.camelCase)(n,t)]=i)}),r}uh.default=uh;var Lk=uh;const Pk=id(Lk),ny=iy("end"),sf=iy("start");function iy(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 Dk(e){const t=sf(e),r=ny(e);if(t&&r)return{start:t,end:r}}function no(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?wm(e.position):"start"in e||"end"in e?wm(e):"line"in e||"column"in e?hh(e):""}function hh(e){return Sm(e&&e.line)+":"+Sm(e&&e.column)}function wm(e){return hh(e&&e.start)+"-"+hh(e&&e.end)}function Sm(e){return e&&typeof e=="number"?e:1}class Bt 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=no(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}}Bt.prototype.file="";Bt.prototype.name="";Bt.prototype.reason="";Bt.prototype.message="";Bt.prototype.stack="";Bt.prototype.column=void 0;Bt.prototype.line=void 0;Bt.prototype.ancestors=void 0;Bt.prototype.cause=void 0;Bt.prototype.fatal=void 0;Bt.prototype.place=void 0;Bt.prototype.ruleId=void 0;Bt.prototype.source=void 0;const of={}.hasOwnProperty,Ik=new Map,Rk=/[A-Z]/g,Mk=new Set(["table","tbody","thead","tfoot","tr"]),Ak=new Set(["td","th"]),sy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jk(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=Uk(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=Hk(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"?rf:tk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=oy(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function oy(e,t,r){if(t.type==="element")return Bk(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Ok(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Fk(e,t,r);if(t.type==="mdxjsEsm")return zk(e,t);if(t.type==="root")return $k(e,t,r);if(t.type==="text")return Wk(e,t)}function Bk(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=rf,e.schema=i),e.ancestors.push(t);const s=ay(e,t.tagName,!1),o=Vk(e,t);let l=af(e,t);return Mk.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Vb(a):!0})),ly(e,o,s,t),lf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function Ok(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)}Lo(e,t.position)}function zk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lo(e,t.position)}function Fk(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=rf,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:ay(e,t.name,!0),o=Kk(e,t),l=af(e,t);return ly(e,o,s,t),lf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function $k(e,t,r){const n={};return lf(n,af(e,t)),e.create(t,e.Fragment,n,r)}function Wk(e,t){return t.value}function ly(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function lf(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function Hk(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 Uk(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),a=sf(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 Vk(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&of.call(t.properties,i)){const s=qk(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Ak.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 Kk(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 Lo(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 Lo(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function af(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:Ik;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=oy(e,s,o);l!==void 0&&r.push(l)}return r}function qk(e,t,r){const n=Zb(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Fb(r):rk(r)),n.property==="style"){let i=typeof r=="object"?r:Yk(e,String(r));return e.stylePropertyNameCase==="css"&&(i=Xk(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?Xb[n.property]||n.property:n.attribute,r]}}function Yk(e,t){try{return Pk(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new Bt("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=sy+"#cannot-parse-style-attribute",i}}function ay(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=dm(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=dm(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return of.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);Lo(e)}function Lo(e,t){const r=new Bt("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=sy+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Xk(e){const t={};let r;for(r in e)of.call(e,r)&&(t[Gk(r)]=e[r]);return t}function Gk(e){let t=e.replace(Rk,Qk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Qk(e){return"-"+e.toLowerCase()}const Rc={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"]},Zk={};function cf(e,t){const r=Zk,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return cy(e,n,i)}function cy(e,t,r){if(Jk(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 bm(e.children,t,r)}return Array.isArray(e)?bm(e,t,r):""}function bm(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=cy(e[i],t,r);return n.join("")}function Jk(e){return!!(e&&typeof e=="object")}const km=document.createElement("i");function uf(e){const t="&"+e+";";km.innerHTML=t;const r=km.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function hr(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 Cr(e,t){return e.length>0?(hr(e,e.length,0,t),e):t}const Cm={}.hasOwnProperty;function uy(e){const t={};let r=-1;for(;++r<e.length;)eC(t,e[r]);return t}function eC(e,t){let r;for(r in t){const i=(Cm.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){Cm.call(i,o)||(i[o]=[]);const l=s[o];tC(i[o],Array.isArray(l)?l:l?[l]:[])}}}function tC(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);hr(e,0,0,n)}function hy(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 $r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ft=Zn(/[A-Za-z]/),At=Zn(/[\dA-Za-z]/),rC=Zn(/[#-'*+\--9=?A-Z^-~]/);function _a(e){return e!==null&&(e<32||e===127)}const dh=Zn(/\d/),nC=Zn(/[\dA-Fa-f]/),iC=Zn(/[!-/:-@[-`{-~]/);function Se(e){return e!==null&&e<-2}function Be(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const Ka=Zn(new RegExp("\\p{P}|\\p{S}","u")),ki=Zn(/\s/);function Zn(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function vs(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&At(e.charCodeAt(r+1))&&At(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 Ie(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return Pe(a)?(e.enter(r),l(a)):t(a)}function l(a){return Pe(a)&&s++<i?(e.consume(a),l):(e.exit(r),t(a))}}const sC={tokenize:oC};function oC(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"),Ie(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 Se(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const lC={tokenize:aC},Em={tokenize:cC};function aC(e){const t=this,r=[];let n=0,i,s,o;return l;function l(x){if(n<r.length){const N=r[n];return t.containerState=N[1],e.attempt(N[0].continuation,a,c)(x)}return c(x)}function a(x){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const N=t.events.length;let T=N,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){C=t.events[T][1].end;break}_(n);let A=N;for(;A<t.events.length;)t.events[A][1].end={...C},A++;return hr(t.events,T+1,0,t.events.slice(N)),t.events.length=A,c(x)}return l(x)}function c(x){if(n===r.length){if(!i)return f(x);if(i.currentConstruct&&i.currentConstruct.concrete)return m(x);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Em,d,u)(x)}function d(x){return i&&y(),_(n),f(x)}function u(x){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,m(x)}function f(x){return t.containerState={},e.attempt(Em,p,m)(x)}function p(x){return n++,r.push([t.currentConstruct,t.containerState]),f(x)}function m(x){if(x===null){i&&y(),_(0),e.consume(x);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(x)}function g(x){if(x===null){S(e.exit("chunkFlow"),!0),_(0),e.consume(x);return}return Se(x)?(e.consume(x),S(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(x),g)}function S(x,N){const T=t.sliceStream(x);if(N&&T.push(null),x.previous=s,s&&(s.next=x),s=x,i.defineSkip(x.start),i.write(T),t.parser.lazy[x.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;const A=t.events.length;let F=A,W,E;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(W){E=t.events[F][1].end;break}W=!0}for(_(n),C=A;C<t.events.length;)t.events[C][1].end={...E},C++;hr(t.events,F+1,0,t.events.slice(A)),t.events.length=C}}function _(x){let N=r.length;for(;N-- >x;){const T=r[N];t.containerState=T[1],T[0].exit.call(t,e)}r.length=x}function y(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function cC(e,t,r){return Ie(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function us(e){if(e===null||Be(e)||ki(e))return 1;if(Ka(e))return 2}function qa(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 fh={name:"attention",resolveAll:uC,tokenize:hC};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};Nm(u,-a),Nm(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=Cr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=Cr(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=Cr(c,qa(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=Cr(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=Cr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):d=0,hr(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 hC(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=us(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=us(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 Nm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const dC={name:"autolink",tokenize:fC};function fC(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 Ft(p)?(e.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||At(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||At(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||_a(p)?r(p):(e.consume(p),a)}function c(p){return p===64?(e.consume(p),d):rC(p)?(e.consume(p),c):r(p)}function d(p){return At(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||At(p))&&n++<63){const m=p===45?f:u;return e.consume(p),m}return r(p)}}const Ho={partial:!0,tokenize:pC};function pC(e,t,r){return n;function n(s){return Pe(s)?Ie(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Se(s)?t(s):r(s)}}const dy={continuation:{tokenize:gC},exit:_C,name:"blockQuote",tokenize:mC};function mC(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 Pe(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 Pe(o)?Ie(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(dy,t,r)(o)}}function _C(e){e.exit("blockQuote")}const fy={name:"characterEscape",tokenize:vC};function vC(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 iC(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const py={name:"characterReference",tokenize:yC};function yC(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=At,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=nC,d):(e.enter("characterReferenceValue"),s=7,o=dh,d(u))}function d(u){if(u===59&&i){const f=e.exit("characterReferenceValue");return o===At&&!uf(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 Tm={partial:!0,tokenize:wC},Lm={concrete:!0,name:"codeFenced",tokenize:xC};function xC(e,t,r){const n=this,i={partial:!0,tokenize:T};let s=0,o=0,l;return a;function a(C){return c(C)}function c(C){const A=n.events[n.events.length-1];return s=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===l?(o++,e.consume(C),d):o<3?r(C):(e.exit("codeFencedFenceSequence"),Pe(C)?Ie(e,u,"whitespace")(C):u(C))}function u(C){return C===null||Se(C)?(e.exit("codeFencedFence"),n.interrupt?t(C):e.check(Tm,g,N)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||Se(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(C)):Pe(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ie(e,p,"whitespace")(C)):C===96&&C===l?r(C):(e.consume(C),f)}function p(C){return C===null||Se(C)?u(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||Se(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(C)):C===96&&C===l?r(C):(e.consume(C),m)}function g(C){return e.attempt(i,N,S)(C)}function S(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),_}function _(C){return s>0&&Pe(C)?Ie(e,y,"linePrefix",s+1)(C):y(C)}function y(C){return C===null||Se(C)?e.check(Tm,g,N)(C):(e.enter("codeFlowValue"),x(C))}function x(C){return C===null||Se(C)?(e.exit("codeFlowValue"),y(C)):(e.consume(C),x)}function N(C){return e.exit("codeFenced"),t(C)}function T(C,A,F){let W=0;return E;function E(I){return C.enter("lineEnding"),C.consume(I),C.exit("lineEnding"),U}function U(I){return C.enter("codeFencedFence"),Pe(I)?Ie(C,O,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):O(I)}function O(I){return I===l?(C.enter("codeFencedFenceSequence"),D(I)):F(I)}function D(I){return I===l?(W++,C.consume(I),D):W>=o?(C.exit("codeFencedFenceSequence"),Pe(I)?Ie(C,V,"whitespace")(I):V(I)):F(I)}function V(I){return I===null||Se(I)?(C.exit("codeFencedFence"),A(I)):F(I)}}}function wC(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 Mc={name:"codeIndented",tokenize:bC},SC={partial:!0,tokenize:kC};function bC(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Ie(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):Se(c)?e.attempt(SC,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||Se(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function kC(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Se(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ie(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):Se(o)?i(o):r(o)}}const CC={name:"codeText",previous:NC,resolve:EC,tokenize:TC};function EC(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 NC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TC(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)):Se(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||Se(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 LC{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&&Ps(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),Ps(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ps(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);Ps(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ps(this.left,r.reverse())}}}function Ps(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 my(e){const t={};let r=-1,n,i,s,o,l,a,c;const d=new LC(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,PC(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 hr(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function PC(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,g=0;const S=[g];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&&(g=f+1,S.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):S.pop(),f=S.length;f--;){const _=l.slice(S[f],S[f+1]),y=s.pop();a.push([y,y+_.length-1]),e.splice(y,2,_)}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 DC={resolve:RC,tokenize:MC},IC={partial:!0,tokenize:AC};function RC(e){return my(e),e}function MC(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):Se(l)?e.check(IC,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 AC(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ie(e,s,"linePrefix")}function s(o){if(o===null||Se(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 gy(e,t,r,n,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let d=0;return u;function u(_){return _===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(_),e.exit(s),f):_===null||_===32||_===41||_a(_)?r(_):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(_))}function f(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===62?(e.exit("chunkString"),e.exit(l),f(_)):_===null||_===60||Se(_)?r(_):(e.consume(_),_===92?m:p)}function m(_){return _===60||_===62||_===92?(e.consume(_),p):p(_)}function g(_){return!d&&(_===null||_===41||Be(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(_)):d<c&&_===40?(e.consume(_),d++,g):_===41?(e.consume(_),d--,g):_===null||_===32||_===40||_a(_)?r(_):(e.consume(_),_===92?S:g)}function S(_){return _===40||_===41||_===92?(e.consume(_),g):g(_)}}function _y(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):Se(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||Se(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),a||(a=!Pe(p)),p===92?f:u)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,u):u(p)}}function vy(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):Se(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ie(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||Se(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 io(e,t){let r;return n;function n(i){return Se(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Pe(i)?Ie(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const jC={name:"definition",tokenize:OC},BC={partial:!0,tokenize:zC};function OC(e,t,r){const n=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return _y.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=$r(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 Be(p)?io(e,c)(p):c(p)}function c(p){return gy(e,d,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(BC,u,u)(p)}function u(p){return Pe(p)?Ie(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Se(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function zC(e,t,r){return n;function n(l){return Be(l)?io(e,i)(l):r(l)}function i(l){return vy(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Pe(l)?Ie(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Se(l)?t(l):r(l)}}const FC={name:"hardBreakEscape",tokenize:$C};function $C(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Se(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const WC={name:"headingAtx",resolve:HC,tokenize:UC};function HC(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"},hr(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function UC(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||Be(d)?(e.exit("atxHeadingSequence"),l(d)):r(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),a(d)):d===null||Se(d)?(e.exit("atxHeading"),t(d)):Pe(d)?Ie(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||Be(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const VC=["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"],Pm=["pre","script","style","textarea"],KC={concrete:!0,name:"htmlFlow",resolveTo:XC,tokenize:GC},qC={partial:!0,tokenize:ZC},YC={partial:!0,tokenize:QC};function XC(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 GC(e,t,r){const n=this;let i,s,o,l,a;return c;function c(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),u}function u(k){return k===33?(e.consume(k),f):k===47?(e.consume(k),s=!0,g):k===63?(e.consume(k),i=3,n.interrupt?t:b):Ft(k)?(e.consume(k),o=String.fromCharCode(k),S):r(k)}function f(k){return k===45?(e.consume(k),i=2,p):k===91?(e.consume(k),i=5,l=0,m):Ft(k)?(e.consume(k),i=4,n.interrupt?t:b):r(k)}function p(k){return k===45?(e.consume(k),n.interrupt?t:b):r(k)}function m(k){const ye="CDATA[";return k===ye.charCodeAt(l++)?(e.consume(k),l===ye.length?n.interrupt?t:O:m):r(k)}function g(k){return Ft(k)?(e.consume(k),o=String.fromCharCode(k),S):r(k)}function S(k){if(k===null||k===47||k===62||Be(k)){const ye=k===47,G=o.toLowerCase();return!ye&&!s&&Pm.includes(G)?(i=1,n.interrupt?t(k):O(k)):VC.includes(o.toLowerCase())?(i=6,ye?(e.consume(k),_):n.interrupt?t(k):O(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(k):s?y(k):x(k))}return k===45||At(k)?(e.consume(k),o+=String.fromCharCode(k),S):r(k)}function _(k){return k===62?(e.consume(k),n.interrupt?t:O):r(k)}function y(k){return Pe(k)?(e.consume(k),y):E(k)}function x(k){return k===47?(e.consume(k),E):k===58||k===95||Ft(k)?(e.consume(k),N):Pe(k)?(e.consume(k),x):E(k)}function N(k){return k===45||k===46||k===58||k===95||At(k)?(e.consume(k),N):T(k)}function T(k){return k===61?(e.consume(k),C):Pe(k)?(e.consume(k),T):x(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),a=k,A):Pe(k)?(e.consume(k),C):F(k)}function A(k){return k===a?(e.consume(k),a=null,W):k===null||Se(k)?r(k):(e.consume(k),A)}function F(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Be(k)?T(k):(e.consume(k),F)}function W(k){return k===47||k===62||Pe(k)?x(k):r(k)}function E(k){return k===62?(e.consume(k),U):r(k)}function U(k){return k===null||Se(k)?O(k):Pe(k)?(e.consume(k),U):r(k)}function O(k){return k===45&&i===2?(e.consume(k),B):k===60&&i===1?(e.consume(k),K):k===62&&i===4?(e.consume(k),te):k===63&&i===3?(e.consume(k),b):k===93&&i===5?(e.consume(k),$):Se(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(qC,ae,D)(k)):k===null||Se(k)?(e.exit("htmlFlowData"),D(k)):(e.consume(k),O)}function D(k){return e.check(YC,V,ae)(k)}function V(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),I}function I(k){return k===null||Se(k)?D(k):(e.enter("htmlFlowData"),O(k))}function B(k){return k===45?(e.consume(k),b):O(k)}function K(k){return k===47?(e.consume(k),o="",R):O(k)}function R(k){if(k===62){const ye=o.toLowerCase();return Pm.includes(ye)?(e.consume(k),te):O(k)}return Ft(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),R):O(k)}function $(k){return k===93?(e.consume(k),b):O(k)}function b(k){return k===62?(e.consume(k),te):k===45&&i===2?(e.consume(k),b):O(k)}function te(k){return k===null||Se(k)?(e.exit("htmlFlowData"),ae(k)):(e.consume(k),te)}function ae(k){return e.exit("htmlFlow"),t(k)}}function QC(e,t,r){const n=this;return i;function i(o){return Se(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 ZC(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ho,t,r)}}const JC={name:"htmlText",tokenize:e2};function e2(e,t,r){const n=this;let i,s,o;return l;function l(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),a}function a(b){return b===33?(e.consume(b),c):b===47?(e.consume(b),T):b===63?(e.consume(b),x):Ft(b)?(e.consume(b),F):r(b)}function c(b){return b===45?(e.consume(b),d):b===91?(e.consume(b),s=0,m):Ft(b)?(e.consume(b),y):r(b)}function d(b){return b===45?(e.consume(b),p):r(b)}function u(b){return b===null?r(b):b===45?(e.consume(b),f):Se(b)?(o=u,K(b)):(e.consume(b),u)}function f(b){return b===45?(e.consume(b),p):u(b)}function p(b){return b===62?B(b):b===45?f(b):u(b)}function m(b){const te="CDATA[";return b===te.charCodeAt(s++)?(e.consume(b),s===te.length?g:m):r(b)}function g(b){return b===null?r(b):b===93?(e.consume(b),S):Se(b)?(o=g,K(b)):(e.consume(b),g)}function S(b){return b===93?(e.consume(b),_):g(b)}function _(b){return b===62?B(b):b===93?(e.consume(b),_):g(b)}function y(b){return b===null||b===62?B(b):Se(b)?(o=y,K(b)):(e.consume(b),y)}function x(b){return b===null?r(b):b===63?(e.consume(b),N):Se(b)?(o=x,K(b)):(e.consume(b),x)}function N(b){return b===62?B(b):x(b)}function T(b){return Ft(b)?(e.consume(b),C):r(b)}function C(b){return b===45||At(b)?(e.consume(b),C):A(b)}function A(b){return Se(b)?(o=A,K(b)):Pe(b)?(e.consume(b),A):B(b)}function F(b){return b===45||At(b)?(e.consume(b),F):b===47||b===62||Be(b)?W(b):r(b)}function W(b){return b===47?(e.consume(b),B):b===58||b===95||Ft(b)?(e.consume(b),E):Se(b)?(o=W,K(b)):Pe(b)?(e.consume(b),W):B(b)}function E(b){return b===45||b===46||b===58||b===95||At(b)?(e.consume(b),E):U(b)}function U(b){return b===61?(e.consume(b),O):Se(b)?(o=U,K(b)):Pe(b)?(e.consume(b),U):W(b)}function O(b){return b===null||b===60||b===61||b===62||b===96?r(b):b===34||b===39?(e.consume(b),i=b,D):Se(b)?(o=O,K(b)):Pe(b)?(e.consume(b),O):(e.consume(b),V)}function D(b){return b===i?(e.consume(b),i=void 0,I):b===null?r(b):Se(b)?(o=D,K(b)):(e.consume(b),D)}function V(b){return b===null||b===34||b===39||b===60||b===61||b===96?r(b):b===47||b===62||Be(b)?W(b):(e.consume(b),V)}function I(b){return b===47||b===62||Be(b)?W(b):r(b)}function B(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):r(b)}function K(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),R}function R(b){return Pe(b)?Ie(e,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):$(b)}function $(b){return e.enter("htmlTextData"),o(b)}}const hf={name:"labelEnd",resolveAll:i2,resolveTo:s2,tokenize:o2},t2={tokenize:l2},r2={tokenize:a2},n2={tokenize:c2};function i2(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&&hr(e,0,e.length,r),e}function s2(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=Cr(l,e.slice(s+1,s+n+3)),l=Cr(l,[["enter",d,t]]),l=Cr(l,qa(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=Cr(l,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),l=Cr(l,e.slice(o+1)),l=Cr(l,[["exit",a,t]]),hr(e,s,e.length,l),e}function o2(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($r(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(t2,d,o?d:u)(f):f===91?e.attempt(r2,d,o?c:u)(f):o?d(f):u(f)}function c(f){return e.attempt(n2,d,u)(f)}function d(f){return t(f)}function u(f){return s._balanced=!0,r(f)}}function l2(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 Be(u)?io(e,s)(u):s(u)}function s(u){return u===41?d(u):gy(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return Be(u)?io(e,a)(u):d(u)}function l(u){return r(u)}function a(u){return u===34||u===39||u===40?vy(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):d(u)}function c(u){return Be(u)?io(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 a2(e,t,r){const n=this;return i;function i(l){return _y.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes($r(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function c2(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:hf.resolveAll,tokenize:h2};function h2(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 d2={name:"labelStartLink",resolveAll:hf.resolveAll,tokenize:f2};function f2(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 Ac={name:"lineEnding",tokenize:p2};function p2(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ie(e,t,"linePrefix")}}const jl={name:"thematicBreak",tokenize:m2};function m2(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||Se(c))?(e.exit("thematicBreak"),t(c)):r(c)}function a(c){return c===i?(e.consume(c),n++,a):(e.exit("thematicBreakSequence"),Pe(c)?Ie(e,l,"whitespace")(c):l(c))}}const Yt={continuation:{tokenize:y2},exit:w2,name:"list",tokenize:v2},g2={partial:!0,tokenize:S2},_2={partial:!0,tokenize:x2};function v2(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:dh(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(jl,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 dh(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(Ho,n.interrupt?r:d,e.attempt(g2,f,u))}function d(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function u(p){return Pe(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 y2(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(Ho,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ie(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!Pe(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(_2,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ie(e,e.attempt(Yt,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function x2(e,t,r){const n=this;return Ie(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 w2(e){e.exit(this.containerState.type)}function S2(e,t,r){const n=this;return Ie(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!Pe(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const Dm={name:"setextUnderline",resolveTo:b2,tokenize:k2};function b2(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 k2(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"),Pe(c)?Ie(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||Se(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const C2={tokenize:E2};function E2(e){const t=this,r=e.attempt(Ho,n,e.attempt(this.parser.constructs.flowInitial,i,Ie(e,e.attempt(this.parser.constructs.flow,i,e.attempt(DC,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 N2={resolveAll:xy()},T2=yy("string"),L2=yy("text");function yy(e){return{resolveAll:xy(e==="text"?P2: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 xy(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 P2(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 D2={42:Yt,43:Yt,45:Yt,48:Yt,49:Yt,50:Yt,51:Yt,52:Yt,53:Yt,54:Yt,55:Yt,56:Yt,57:Yt,62:dy},I2={91:jC},R2={[-2]:Mc,[-1]:Mc,32:Mc},M2={35:WC,42:jl,45:[Dm,jl],60:KC,61:Dm,95:jl,96:Lm,126:Lm},A2={38:py,92:fy},j2={[-5]:Ac,[-4]:Ac,[-3]:Ac,33:u2,38:py,42:fh,60:[dC,JC],91:d2,92:[FC,fy],93:hf,95:fh,96:CC},B2={null:[fh,N2]},O2={null:[42,95]},z2={null:[]},F2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:O2,contentInitial:I2,disable:z2,document:D2,flow:M2,flowInitial:R2,insideSpan:B2,string:A2,text:j2},Symbol.toStringTag,{value:"Module"}));function $2(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:A(T),check:A(C),consume:y,enter:x,exit:N,interrupt:A(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,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(U){return o=Cr(o,U),S(),o[o.length-1]!==null?[]:(F(t,0),c.events=qa(s,c.events,c),c.events)}function f(U,O){return H2(p(U),O)}function p(U){return W2(o,U)}function m(){const{_bufferIndex:U,_index:O,line:D,column:V,offset:I}=n;return{_bufferIndex:U,_index:O,line:D,column:V,offset:I}}function g(U){i[U.line]=U.column,E()}function S(){let U;for(;n._index<o.length;){const O=o[n._index];if(typeof O=="string")for(U=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===U&&n._bufferIndex<O.length;)_(O.charCodeAt(n._bufferIndex));else _(O)}}function _(U){d=d(U)}function y(U){Se(U)?(n.line++,n.column=1,n.offset+=U===-3?2:1,E()):U!==-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=U}function x(U,O){const D=O||{};return D.type=U,D.start=m(),c.events.push(["enter",D,c]),l.push(D),D}function N(U){const O=l.pop();return O.end=m(),c.events.push(["exit",O,c]),O}function T(U,O){F(U,O.from)}function C(U,O){O.restore()}function A(U,O){return D;function D(V,I,B){let K,R,$,b;return Array.isArray(V)?ae(V):"tokenize"in V?ae([V]):te(V);function te(Z){return X;function X(ce){const me=ce!==null&&Z[ce],fe=ce!==null&&Z.null,xe=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return ae(xe)(ce)}}function ae(Z){return K=Z,R=0,Z.length===0?B:k(Z[R])}function k(Z){return X;function X(ce){return b=W(),$=Z,Z.partial||(c.currentConstruct=Z),Z.name&&c.parser.constructs.disable.null.includes(Z.name)?G():Z.tokenize.call(O?Object.assign(Object.create(c),O):c,a,ye,G)(ce)}}function ye(Z){return U($,b),I}function G(Z){return b.restore(),++R<K.length?k(K[R]):B}}}function F(U,O){U.resolveAll&&!s.includes(U)&&s.push(U),U.resolve&&hr(c.events,O,c.events.length-O,U.resolve(c.events.slice(O),c)),U.resolveTo&&(c.events=U.resolveTo(c.events,c))}function W(){const U=m(),O=c.previous,D=c.currentConstruct,V=c.events.length,I=Array.from(l);return{from:V,restore:B};function B(){n=U,c.previous=O,c.currentConstruct=D,c.events.length=V,l=I,E()}}function E(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function W2(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 H2(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
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 U2(e){const n={constructs:uy([F2,...(e||{}).extensions||[]]),content:i(sC),defined:[],document:i(lC),flow:i(C2),lazy:{},string:i(T2),text:i(L2)};return n;function i(s){return o;function o(l){return $2(n,s,l)}}}function V2(e){for(;!my(e););return e}const Im=/[\0\t\n\r]/g;function K2(){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(Im.lastIndex=u,c=Im.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 q2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Y2(e){return e.replace(q2,X2)}function X2(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return hy(r.slice(s?2:1),s?16:10)}return uf(r)||e}const wy={}.hasOwnProperty;function G2(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),Q2(r)(V2(U2(r).document().write(K2()(e,t,!0))))}function Q2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(_r),autolinkProtocol:$,autolinkEmail:$,atxHeading:s(pt),blockQuote:s(fe),characterEscape:$,characterReference:$,codeFenced:s(xe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(xe,o),codeText:s(B,o),codeTextData:$,data:$,codeFlowValue:$,definition:s(Ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Qe),hardBreakEscape:s(mr),hardBreakTrailing:s(mr),htmlFlow:s(gr,o),htmlFlowData:$,htmlText:s(gr,o),htmlTextData:$,image:s(Dr),label:o,link:s(_r),listItem:s(rr),listItemValue:f,listOrdered:s(nn,u),listUnordered:s(nn),paragraph:s(kt),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(pt),strong:s(mt),thematicBreak:s(ge)},exit:{atxHeading:a(),atxHeadingSequence:T,autolink:a(),autolinkEmail:me,autolinkProtocol:ce,blockQuote:a(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:G,characterReferenceMarkerNumeric:G,characterReferenceValue:Z,characterReference:X,codeFenced:a(S),codeFencedFence:g,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:a(_),codeText:a(D),codeTextData:E,data:E,definition:a(),definitionDestinationString:N,definitionLabelString:y,definitionTitleString:x,emphasis:a(),hardBreakEscape:a(j),hardBreakTrailing:a(j),htmlFlow:a(A),htmlFlowData:E,htmlText:a(V),htmlTextData:E,image:a(K),label:H,labelText:I,lineEnding:U,link:a(O),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:ye,resourceDestinationString:b,resourceTitleString:te,resource:ae,setextHeading:a(F),setextHeadingLineSequence:M,setextHeadingText:C,strong:a(),thematicBreak:a()}};Sy(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(R){let q={type:"root",children:[]};const de={stack:[q],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:d,data:r},P=[];let L=-1;for(;++L<R.length;)if(R[L][1].type==="listOrdered"||R[L][1].type==="listUnordered")if(R[L][0]==="enter")P.push(L);else{const W=P.pop();L=i(R,W,L)}for(L=-1;++L<R.length;){const W=t[R[L][0]];wy.call(W,R[L][1].type)&&W[R[L][1].type].call(Object.assign({sliceSerialize:R[L][2].sliceSerialize},de),R[L][1])}if(de.tokenStack.length>0){const W=de.tokenStack[de.tokenStack.length-1];(W[1]||Rm).call(de,void 0,W[0])}for(q.position={start:bn(R.length>0?R[0][1].start:{line:1,column:1,offset:0}),end:bn(R.length>0?R[R.length-2][1].end:{line:1,column:1,offset:0})},L=-1;++L<t.transforms.length;)q=t.transforms[L](q)||q;return q}function i(R,q,de){let P=q-1,L=-1,W=!1,Q,J,le,ue;for(;++P<=de;){const ie=R[P];switch(ie[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ie[0]==="enter"?L++:L--,ue=void 0;break}case"lineEndingBlank":{ie[0]==="enter"&&(Q&&!ue&&!L&&!le&&(le=P),ue=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ue=void 0}if(!L&&ie[0]==="enter"&&ie[1].type==="listItemPrefix"||L===-1&&ie[0]==="exit"&&(ie[1].type==="listUnordered"||ie[1].type==="listOrdered")){if(Q){let _e=P;for(J=void 0;_e--;){const we=R[_e];if(we[1].type==="lineEnding"||we[1].type==="lineEndingBlank"){if(we[0]==="exit")continue;J&&(R[J][1].type="lineEndingBlank",W=!0),we[1].type="lineEnding",J=_e}else if(!(we[1].type==="linePrefix"||we[1].type==="blockQuotePrefix"||we[1].type==="blockQuotePrefixWhitespace"||we[1].type==="blockQuoteMarker"||we[1].type==="listItemIndent"))break}le&&(!J||le<J)&&(Q._spread=!0),Q.end=Object.assign({},J?R[J][1].start:ie[1].end),R.splice(J||P,0,["exit",Q,ie[2]]),P++,de++}if(ie[1].type==="listItemPrefix"){const _e={type:"listItem",_spread:!1,start:Object.assign({},ie[1].start),end:void 0};Q=_e,R.splice(P,0,["enter",_e,ie[2]]),P++,de++,le=void 0,ue=!0}}}return R[q][1]._spread=W,de}function s(R,q){return de;function de(P){l.call(this,R(P),P),q&&q.call(this,P)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(R,q,de){this.stack[this.stack.length-1].children.push(R),this.stack.push(R),this.tokenStack.push([q,de||void 0]),R.position={start:bn(q.start),end:void 0}}function a(R){return q;function q(de){R&&R.call(this,de),c.call(this,de)}}function c(R,q){const de=this.stack.pop(),P=this.tokenStack.pop();if(P)P[0].type!==R.type&&(q?q.call(this,R,P[0]):(P[1]||Rm).call(this,R,P[0]));else throw new Error("Cannot close `"+R.type+"` ("+no({start:R.start,end:R.end})+"): it’s not open");de.position.end=bn(R.end)}function d(){return cf(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function f(R){if(this.data.expectingFirstListItemValue){const q=this.stack[this.stack.length-2];q.start=Number.parseInt(this.sliceSerialize(R),10),this.data.expectingFirstListItemValue=void 0}}function p(){const R=this.resume(),q=this.stack[this.stack.length-1];q.lang=R}function m(){const R=this.resume(),q=this.stack[this.stack.length-1];q.meta=R}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const R=this.resume(),q=this.stack[this.stack.length-1];q.value=R.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const R=this.resume(),q=this.stack[this.stack.length-1];q.value=R.replace(/(\r?\n|\r)$/g,"")}function y(R){const q=this.resume(),de=this.stack[this.stack.length-1];de.label=q,de.identifier=$r(this.sliceSerialize(R)).toLowerCase()}function x(){const R=this.resume(),q=this.stack[this.stack.length-1];q.title=R}function N(){const R=this.resume(),q=this.stack[this.stack.length-1];q.url=R}function T(R){const q=this.stack[this.stack.length-1];if(!q.depth){const de=this.sliceSerialize(R).length;q.depth=de}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(R){const q=this.stack[this.stack.length-1];q.depth=this.sliceSerialize(R).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function $(R){const de=this.stack[this.stack.length-1].children;let P=de[de.length-1];(!P||P.type!=="text")&&(P=ee(),P.position={start:bn(R.start),end:void 0},de.push(P)),this.stack.push(P)}function E(R){const q=this.stack.pop();q.value+=this.sliceSerialize(R),q.position.end=bn(R.end)}function U(R){const q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const de=q.children[q.children.length-1];de.position.end=bn(R.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(q.type)&&($.call(this,R),E.call(this,R))}function j(){this.data.atHardBreak=!0}function A(){const R=this.resume(),q=this.stack[this.stack.length-1];q.value=R}function V(){const R=this.resume(),q=this.stack[this.stack.length-1];q.value=R}function D(){const R=this.resume(),q=this.stack[this.stack.length-1];q.value=R}function O(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=q,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function K(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=q,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function I(R){const q=this.sliceSerialize(R),de=this.stack[this.stack.length-2];de.label=Y2(q),de.identifier=$r(q).toLowerCase()}function H(){const R=this.stack[this.stack.length-1],q=this.resume(),de=this.stack[this.stack.length-1];if(this.data.inReference=!0,de.type==="link"){const P=R.children;de.children=P}else de.alt=q}function b(){const R=this.resume(),q=this.stack[this.stack.length-1];q.url=R}function te(){const R=this.resume(),q=this.stack[this.stack.length-1];q.title=R}function ae(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function ye(R){const q=this.resume(),de=this.stack[this.stack.length-1];de.label=q,de.identifier=$r(this.sliceSerialize(R)).toLowerCase(),this.data.referenceType="full"}function G(R){this.data.characterReferenceType=R.type}function Z(R){const q=this.sliceSerialize(R),de=this.data.characterReferenceType;let P;de?(P=hy(q,de==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):P=uf(q);const L=this.stack[this.stack.length-1];L.value+=P}function X(R){const q=this.stack.pop();q.position.end=bn(R.end)}function ce(R){E.call(this,R);const q=this.stack[this.stack.length-1];q.url=this.sliceSerialize(R)}function me(R){E.call(this,R);const q=this.stack[this.stack.length-1];q.url="mailto:"+this.sliceSerialize(R)}function fe(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function B(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Qe(){return{type:"emphasis",children:[]}}function pt(){return{type:"heading",depth:0,children:[]}}function mr(){return{type:"break"}}function gr(){return{type:"html",value:""}}function Dr(){return{type:"image",title:null,url:"",alt:null}}function _r(){return{type:"link",title:null,url:"",children:[]}}function nn(R){return{type:"list",ordered:R.type==="listOrdered",start:null,spread:R._spread,children:[]}}function rr(R){return{type:"listItem",spread:R._spread,checked:null,children:[]}}function kt(){return{type:"paragraph",children:[]}}function mt(){return{type:"strong",children:[]}}function ee(){return{type:"text",value:""}}function ge(){return{type:"thematicBreak"}}}function bn(e){return{line:e.line,column:e.column,offset:e.offset}}function Sy(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?Sy(e,n):Z2(e,n)}}function Z2(e,t){let r;for(r in t)if(wy.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 Rm(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+no({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+no({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+no({start:t.start,end:t.end})+") is still open")}function J2(e){const t=this;t.parser=r;function r(n){return G2(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function eE(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 tE(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
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 U2(e){const n={constructs:uy([F2,...(e||{}).extensions||[]]),content:i(sC),defined:[],document:i(lC),flow:i(C2),lazy:{},string:i(T2),text:i(L2)};return n;function i(s){return o;function o(l){return $2(n,s,l)}}}function V2(e){for(;!my(e););return e}const Im=/[\0\t\n\r]/g;function K2(){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(Im.lastIndex=u,c=Im.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 q2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Y2(e){return e.replace(q2,X2)}function X2(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return hy(r.slice(s?2:1),s?16:10)}return uf(r)||e}const wy={}.hasOwnProperty;function G2(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),Q2(r)(V2(U2(r).document().write(K2()(e,t,!0))))}function Q2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(_r),autolinkProtocol:W,autolinkEmail:W,atxHeading:s(pt),blockQuote:s(fe),characterEscape:W,characterReference:W,codeFenced:s(xe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(xe,o),codeText:s(j,o),codeTextData:W,data:W,codeFlowValue:W,definition:s(Ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Qe),hardBreakEscape:s(mr),hardBreakTrailing:s(mr),htmlFlow:s(gr,o),htmlFlowData:W,htmlText:s(gr,o),htmlTextData:W,image:s(Dr),label:o,link:s(_r),listItem:s(rr),listItemValue:f,listOrdered:s(nn,u),listUnordered:s(nn),paragraph:s(kt),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(pt),strong:s(mt),thematicBreak:s(ge)},exit:{atxHeading:a(),atxHeadingSequence:T,autolink:a(),autolinkEmail:me,autolinkProtocol:ce,blockQuote:a(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:G,characterReferenceMarkerNumeric:G,characterReferenceValue:Z,characterReference:X,codeFenced:a(S),codeFencedFence:g,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:a(_),codeText:a(I),codeTextData:E,data:E,definition:a(),definitionDestinationString:N,definitionLabelString:y,definitionTitleString:x,emphasis:a(),hardBreakEscape:a(O),hardBreakTrailing:a(O),htmlFlow:a(D),htmlFlowData:E,htmlText:a(V),htmlTextData:E,image:a(K),label:$,labelText:R,lineEnding:U,link:a(B),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:ye,resourceDestinationString:b,resourceTitleString:te,resource:ae,setextHeading:a(F),setextHeadingLineSequence:A,setextHeadingText:C,strong:a(),thematicBreak:a()}};Sy(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(M){let q={type:"root",children:[]};const de={stack:[q],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:d,data:r},P=[];let L=-1;for(;++L<M.length;)if(M[L][1].type==="listOrdered"||M[L][1].type==="listUnordered")if(M[L][0]==="enter")P.push(L);else{const H=P.pop();L=i(M,H,L)}for(L=-1;++L<M.length;){const H=t[M[L][0]];wy.call(H,M[L][1].type)&&H[M[L][1].type].call(Object.assign({sliceSerialize:M[L][2].sliceSerialize},de),M[L][1])}if(de.tokenStack.length>0){const H=de.tokenStack[de.tokenStack.length-1];(H[1]||Rm).call(de,void 0,H[0])}for(q.position={start:bn(M.length>0?M[0][1].start:{line:1,column:1,offset:0}),end:bn(M.length>0?M[M.length-2][1].end:{line:1,column:1,offset:0})},L=-1;++L<t.transforms.length;)q=t.transforms[L](q)||q;return q}function i(M,q,de){let P=q-1,L=-1,H=!1,Q,J,le,ue;for(;++P<=de;){const ie=M[P];switch(ie[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ie[0]==="enter"?L++:L--,ue=void 0;break}case"lineEndingBlank":{ie[0]==="enter"&&(Q&&!ue&&!L&&!le&&(le=P),ue=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ue=void 0}if(!L&&ie[0]==="enter"&&ie[1].type==="listItemPrefix"||L===-1&&ie[0]==="exit"&&(ie[1].type==="listUnordered"||ie[1].type==="listOrdered")){if(Q){let _e=P;for(J=void 0;_e--;){const we=M[_e];if(we[1].type==="lineEnding"||we[1].type==="lineEndingBlank"){if(we[0]==="exit")continue;J&&(M[J][1].type="lineEndingBlank",H=!0),we[1].type="lineEnding",J=_e}else if(!(we[1].type==="linePrefix"||we[1].type==="blockQuotePrefix"||we[1].type==="blockQuotePrefixWhitespace"||we[1].type==="blockQuoteMarker"||we[1].type==="listItemIndent"))break}le&&(!J||le<J)&&(Q._spread=!0),Q.end=Object.assign({},J?M[J][1].start:ie[1].end),M.splice(J||P,0,["exit",Q,ie[2]]),P++,de++}if(ie[1].type==="listItemPrefix"){const _e={type:"listItem",_spread:!1,start:Object.assign({},ie[1].start),end:void 0};Q=_e,M.splice(P,0,["enter",_e,ie[2]]),P++,de++,le=void 0,ue=!0}}}return M[q][1]._spread=H,de}function s(M,q){return de;function de(P){l.call(this,M(P),P),q&&q.call(this,P)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(M,q,de){this.stack[this.stack.length-1].children.push(M),this.stack.push(M),this.tokenStack.push([q,de||void 0]),M.position={start:bn(q.start),end:void 0}}function a(M){return q;function q(de){M&&M.call(this,de),c.call(this,de)}}function c(M,q){const de=this.stack.pop(),P=this.tokenStack.pop();if(P)P[0].type!==M.type&&(q?q.call(this,M,P[0]):(P[1]||Rm).call(this,M,P[0]));else throw new Error("Cannot close `"+M.type+"` ("+no({start:M.start,end:M.end})+"): it’s not open");de.position.end=bn(M.end)}function d(){return cf(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function f(M){if(this.data.expectingFirstListItemValue){const q=this.stack[this.stack.length-2];q.start=Number.parseInt(this.sliceSerialize(M),10),this.data.expectingFirstListItemValue=void 0}}function p(){const M=this.resume(),q=this.stack[this.stack.length-1];q.lang=M}function m(){const M=this.resume(),q=this.stack[this.stack.length-1];q.meta=M}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const M=this.resume(),q=this.stack[this.stack.length-1];q.value=M.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const M=this.resume(),q=this.stack[this.stack.length-1];q.value=M.replace(/(\r?\n|\r)$/g,"")}function y(M){const q=this.resume(),de=this.stack[this.stack.length-1];de.label=q,de.identifier=$r(this.sliceSerialize(M)).toLowerCase()}function x(){const M=this.resume(),q=this.stack[this.stack.length-1];q.title=M}function N(){const M=this.resume(),q=this.stack[this.stack.length-1];q.url=M}function T(M){const q=this.stack[this.stack.length-1];if(!q.depth){const de=this.sliceSerialize(M).length;q.depth=de}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function A(M){const q=this.stack[this.stack.length-1];q.depth=this.sliceSerialize(M).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function W(M){const de=this.stack[this.stack.length-1].children;let P=de[de.length-1];(!P||P.type!=="text")&&(P=ee(),P.position={start:bn(M.start),end:void 0},de.push(P)),this.stack.push(P)}function E(M){const q=this.stack.pop();q.value+=this.sliceSerialize(M),q.position.end=bn(M.end)}function U(M){const q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const de=q.children[q.children.length-1];de.position.end=bn(M.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(q.type)&&(W.call(this,M),E.call(this,M))}function O(){this.data.atHardBreak=!0}function D(){const M=this.resume(),q=this.stack[this.stack.length-1];q.value=M}function V(){const M=this.resume(),q=this.stack[this.stack.length-1];q.value=M}function I(){const M=this.resume(),q=this.stack[this.stack.length-1];q.value=M}function B(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=q,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function K(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=q,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function R(M){const q=this.sliceSerialize(M),de=this.stack[this.stack.length-2];de.label=Y2(q),de.identifier=$r(q).toLowerCase()}function $(){const M=this.stack[this.stack.length-1],q=this.resume(),de=this.stack[this.stack.length-1];if(this.data.inReference=!0,de.type==="link"){const P=M.children;de.children=P}else de.alt=q}function b(){const M=this.resume(),q=this.stack[this.stack.length-1];q.url=M}function te(){const M=this.resume(),q=this.stack[this.stack.length-1];q.title=M}function ae(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function ye(M){const q=this.resume(),de=this.stack[this.stack.length-1];de.label=q,de.identifier=$r(this.sliceSerialize(M)).toLowerCase(),this.data.referenceType="full"}function G(M){this.data.characterReferenceType=M.type}function Z(M){const q=this.sliceSerialize(M),de=this.data.characterReferenceType;let P;de?(P=hy(q,de==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):P=uf(q);const L=this.stack[this.stack.length-1];L.value+=P}function X(M){const q=this.stack.pop();q.position.end=bn(M.end)}function ce(M){E.call(this,M);const q=this.stack[this.stack.length-1];q.url=this.sliceSerialize(M)}function me(M){E.call(this,M);const q=this.stack[this.stack.length-1];q.url="mailto:"+this.sliceSerialize(M)}function fe(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function j(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Qe(){return{type:"emphasis",children:[]}}function pt(){return{type:"heading",depth:0,children:[]}}function mr(){return{type:"break"}}function gr(){return{type:"html",value:""}}function Dr(){return{type:"image",title:null,url:"",alt:null}}function _r(){return{type:"link",title:null,url:"",children:[]}}function nn(M){return{type:"list",ordered:M.type==="listOrdered",start:null,spread:M._spread,children:[]}}function rr(M){return{type:"listItem",spread:M._spread,checked:null,children:[]}}function kt(){return{type:"paragraph",children:[]}}function mt(){return{type:"strong",children:[]}}function ee(){return{type:"text",value:""}}function ge(){return{type:"thematicBreak"}}}function bn(e){return{line:e.line,column:e.column,offset:e.offset}}function Sy(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?Sy(e,n):Z2(e,n)}}function Z2(e,t){let r;for(r in t)if(wy.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 Rm(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+no({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+no({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+no({start:t.start,end:t.end})+") is still open")}function J2(e){const t=this;t.parser=r;function r(n){return G2(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function eE(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 tE(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
71
71
  `}]}function rE(e,t){const r=t.value?t.value+`
72
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 nE(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function iE(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function sE(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=vs(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 oE(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 lE(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function by(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 aE(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return by(e,t);const i={src:vs(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 cE(e,t){const r={src:vs(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 hE(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return by(e,t);const i={href:vs(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 dE(e,t){const r={href:vs(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 fE(e,t,r){const n=e.all(t),i=r?pE(r):ky(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
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:`
@@ -92,7 +92,7 @@ Error generating stack: `+s.message+`
92
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
93
  `,...s.current()});return/^[\t ]/.test(c)&&(c=Po(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),a(),l(),c}Oy.peek=_N;function Oy(e){return e.value||""}function _N(){return"<"}zy.peek=vN;function zy(e,t,r,n){const i=_f(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 vN(){return"!"}Fy.peek=yN;function Fy(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 yN(){return"!"}$y.peek=xN;function $y(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 xN(){return"`"}function Wy(e,t){const r=cf(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))}Hy.peek=wN;function Hy(e,t,r,n){const i=_f(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let l,a;if(Wy(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 wN(e,t,r){return Wy(e,r)?"<":"["}Uy.peek=SN;function Uy(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 SN(){return"["}function vf(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 bN(e){const t=vf(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 kN(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 Vy(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 CN(e,t,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=e.ordered?kN(r):vf(r);const l=e.ordered?o==="."?")":".":bN(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),Vy(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 EN(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 NN(e,t,r,n){const i=EN(r);let s=r.bulletCurrent||vf(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 TN(e,t,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(e,n);return s(),i(),o}const LN=Xa(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function PN(e,t,r,n){return(e.children.some(function(o){return LN(o)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function DN(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ky.peek=IN;function Ky(e,t,r,n){const i=DN(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=xa(n.before.charCodeAt(n.before.length-1),c,i);d.inside&&(a=Po(c)+a.slice(1));const u=a.charCodeAt(a.length-1),f=xa(n.after.charCodeAt(0),u,i);f.inside&&(a=a.slice(0,-1)+Po(u));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},l+a+p}function IN(e,t,r){return r.options.strong||"*"}function RN(e,t,r,n){return r.safe(e.value,n)}function MN(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 AN(e,t,r){const n=(Vy(r)+(r.options.ruleSpaces?" ":"")).repeat(MN(r));return r.options.ruleSpaces?n.slice(0,-1):n}const qy={blockquote:iN,break:ig,code:uN,definition:dN,emphasis:By,hardBreak:ig,heading:gN,html:Oy,image:zy,imageReference:Fy,inlineCode:$y,link:Hy,linkReference:Uy,list:CN,listItem:NN,paragraph:TN,root:PN,strong:Ky,text:RN,thematicBreak:AN};function jN(){return{enter:{table:BN,tableData:sg,tableHeader:sg,tableRow:zN},exit:{codeText:FN,table:ON,tableData:Kc,tableHeader:Kc,tableRow:Kc}}}function BN(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 ON(e){this.exit(e),this.data.inTable=void 0}function zN(e){this.enter({type:"tableRow",children:[]},e)}function Kc(e){this.exit(e)}function sg(e){this.enter({type:"tableCell",children:[]},e)}function FN(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,$N));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function $N(e,t){return t==="|"?t:e}function WN(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
94
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,g,S){return c(d(p,g,S),p.align)}function l(p,m,g,S){const _=u(p,g,S),y=c([_]);return y.slice(0,y.indexOf(`
95
- `))}function a(p,m,g,S){const _=g.enter("tableCell"),y=g.enter("phrasing"),x=g.containerPhrasing(p,{...S,before:s,after:s});return y(),_(),x}function c(p,m){return rN(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function d(p,m,g){const S=p.children;let _=-1;const y=[],x=m.enter("table");for(;++_<S.length;)y[_]=u(S[_],m,g);return x(),y}function u(p,m,g){const S=p.children;let _=-1;const y=[],x=m.enter("tableRow");for(;++_<S.length;)y[_]=a(S[_],p,m,g);return x(),y}function f(p,m,g){let S=qy.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function HN(){return{exit:{taskListCheckValueChecked:og,taskListCheckValueUnchecked:og,paragraph:VN}}}function UN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:KN}}}function og(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function VN(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 KN(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=qy.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 qN(){return[C5(),K5(),G5(),jN(),HN()]}function YN(e){return{extensions:[E5(),q5(e),Q5(),WN(e),UN()]}}const XN={tokenize:tT,partial:!0},Yy={tokenize:rT,partial:!0},Xy={tokenize:nT,partial:!0},Gy={tokenize:iT,partial:!0},GN={tokenize:sT,partial:!0},Qy={name:"wwwAutolink",tokenize:JN,previous:Jy},Zy={name:"protocolAutolink",tokenize:eT,previous:ex},yn={name:"emailAutolink",tokenize:ZN,previous:tx},rn={};function QN(){return{text:rn}}let ti=48;for(;ti<123;)rn[ti]=yn,ti++,ti===58?ti=65:ti===91&&(ti=97);rn[43]=yn;rn[45]=yn;rn[46]=yn;rn[95]=yn;rn[72]=[yn,Zy];rn[104]=[yn,Zy];rn[87]=[yn,Qy];rn[119]=[yn,Qy];function ZN(e,t,r){const n=this;let i,s;return o;function o(u){return!vh(u)||!tx.call(n,n.previous)||yf(n.events)?r(u):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(u))}function l(u){return vh(u)?(e.consume(u),l):u===64?(e.consume(u),a):r(u)}function a(u){return u===46?e.check(GN,d,c)(u):u===45||u===95||At(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&&Ft(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):r(u)}}function JN(e,t,r){const n=this;return i;function i(o){return o!==87&&o!==119||!Jy.call(n,n.previous)||yf(n.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(XN,e.attempt(Yy,e.attempt(Xy,s),r),r)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function eT(e,t,r){const n=this;let i="",s=!1;return o;function o(u){return(u===72||u===104)&&ex.call(n,n.previous)&&!yf(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(u),e.consume(u),l):r(u)}function l(u){if(Ft(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||_a(u)||Be(u)||ki(u)||Ka(u)?r(u):e.attempt(Yy,e.attempt(Xy,d),r)(u)}function d(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function tT(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 rT(e,t,r){let n,i,s;return o;function o(c){return c===46||c===95?e.check(Gy,a,l)(c):c===null||Be(c)||ki(c)||c!==45&&Ka(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 nT(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(Gy,t,s)(o):o===null||Be(o)||ki(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&n++,e.consume(o),i}}function iT(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||Be(l)||ki(l)?t(l):r(l)}function i(l){return l===null||l===40||l===91||Be(l)||ki(l)?t(l):n(l)}function s(l){return Ft(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),n):Ft(l)?(e.consume(l),o):r(l)}}function sT(e,t,r){return n;function n(s){return e.consume(s),i}function i(s){return At(s)?r(s):t(s)}}function Jy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Be(e)}function ex(e){return!Ft(e)}function tx(e){return!(e===47||vh(e))}function vh(e){return e===43||e===45||e===46||e===95||At(e)}function yf(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 oT={tokenize:pT,partial:!0};function lT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hT,continuation:{tokenize:dT},exit:fT}},text:{91:{name:"gfmFootnoteCall",tokenize:uT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:aT,resolveTo:cT}}}}function aT(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=$r(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 cT(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||Be(u))return r(u);if(u===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes($r(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(u)}return Be(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 hT(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||Be(m))return r(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=$r(n.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Be(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),Ie(e,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return t(m)}}function dT(e,t,r){return e.check(Ho,t,e.attempt(oT,t,r))}function fT(e){e.exit("gfmFootnoteDefinition")}function pT(e,t,r){const n=this;return Ie(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 mT(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&&hr(f,f.length,0,qa(p,o.slice(c+1,a),l)),hr(f,f.length,0,[["exit",u,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",d,l]]),hr(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 g=us(c);if(m===126)return u>1?a(m):(o.consume(m),u++,p);if(u<2&&!r)return a(m);const S=o.exit("strikethroughSequenceTemporary"),_=us(m);return S._open=!_||_===2&&!!g,S._close=!g||g===2&&!!_,l(m)}}}class gT{constructor(){this.map=[]}add(t,r,n){_T(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 _T(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 vT(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 yT(){return{flow:{null:{name:"table",tokenize:xT,resolveAll:wT}}}}function xT(e,t,r){const n=this;let i=0,s=0,o;return l;function l(E){let U=n.events.length-1;for(;U>-1;){const V=n.events[U][1].type;if(V==="lineEnding"||V==="linePrefix")U--;else break}const j=U>-1?n.events[U][1].type:null,A=j==="tableHead"||j==="tableRow"?C:a;return A===C&&n.parser.lazy[n.now().line]?r(E):A(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):Se(E)?s>1?(s=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):r(E):Pe(E)?Ie(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||Be(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,Pe(E)?Ie(e,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):m(E))}function m(E){return E===45||E===58?S(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),g):T(E)}function g(E){return Pe(E)?Ie(e,S,"whitespace")(E):S(E)}function S(E){return E===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),_):E===45?(s+=1,_(E)):E===null||Se(E)?N(E):T(E)}function _(E){return E===45?(e.enter("tableDelimiterFiller"),y(E)):T(E)}function y(E){return E===45?(e.consume(E),y):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(E))}function x(E){return Pe(E)?Ie(e,N,"whitespace")(E):N(E)}function N(E){return E===124?m(E):E===null||Se(E)?!o||i!==s?T(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):T(E)}function T(E){return r(E)}function C(E){return e.enter("tableRow"),M(E)}function M(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),M):E===null||Se(E)?(e.exit("tableRow"),t(E)):Pe(E)?Ie(e,M,"whitespace")(E):(e.enter("data"),F(E))}function F(E){return E===null||E===124||Be(E)?(e.exit("data"),M(E)):(e.consume(E),E===92?$:F)}function $(E){return E===92||E===124?(e.consume(E),F):F(E)}}function wT(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&&(lg(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=gl(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=gl(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=gl(f,t,s,i,r,u)):o[1]!==0&&(u=gl(f,t,o,i,r,u)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(a!==0&&lg(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=vT(t.events,r))}return e}function gl(e,t,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(s.end=Object.assign({},ji(t.events,r[0])),e.add(r[0],0,[["exit",s,t]]));const a=ji(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=ji(t.events,r[2]),d=ji(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,g=r[3]-r[2]-1;e.add(m,g,[])}}e.add(r[3]+1,0,[["exit",u,t]])}return i!==void 0&&(s.end=Object.assign({},ji(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function lg(e,t,r,n,i){const s=[],o=ji(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 ji(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const ST={name:"tasklistCheck",tokenize:kT};function bT(){return{text:{91:ST}}}function kT(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 Be(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 Se(a)?t(a):Pe(a)?e.check({tokenize:CT},t,r)(a):r(a)}}function CT(e,t,r){return Ie(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function ET(e){return uy([QN(),lT(),mT(e),yT(),bT()])}const NT={};function ag(e){const t=this,r=e||NT,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(ET(r)),s.push(qN()),o.push(YN(r))}const TT=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,LT=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,PT=({legacyTitle:e=!1,tagName:t="div"}={})=>r=>{Qa(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?LT:TT,m=f.match(p);if(m&&(a=!1,o=m[1].toLocaleLowerCase(),l=e&&m[2]||o.toLocaleUpperCase(),f.includes(`
95
+ `))}function a(p,m,g,S){const _=g.enter("tableCell"),y=g.enter("phrasing"),x=g.containerPhrasing(p,{...S,before:s,after:s});return y(),_(),x}function c(p,m){return rN(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function d(p,m,g){const S=p.children;let _=-1;const y=[],x=m.enter("table");for(;++_<S.length;)y[_]=u(S[_],m,g);return x(),y}function u(p,m,g){const S=p.children;let _=-1;const y=[],x=m.enter("tableRow");for(;++_<S.length;)y[_]=a(S[_],p,m,g);return x(),y}function f(p,m,g){let S=qy.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function HN(){return{exit:{taskListCheckValueChecked:og,taskListCheckValueUnchecked:og,paragraph:VN}}}function UN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:KN}}}function og(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function VN(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 KN(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=qy.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 qN(){return[C5(),K5(),G5(),jN(),HN()]}function YN(e){return{extensions:[E5(),q5(e),Q5(),WN(e),UN()]}}const XN={tokenize:tT,partial:!0},Yy={tokenize:rT,partial:!0},Xy={tokenize:nT,partial:!0},Gy={tokenize:iT,partial:!0},GN={tokenize:sT,partial:!0},Qy={name:"wwwAutolink",tokenize:JN,previous:Jy},Zy={name:"protocolAutolink",tokenize:eT,previous:ex},yn={name:"emailAutolink",tokenize:ZN,previous:tx},rn={};function QN(){return{text:rn}}let ti=48;for(;ti<123;)rn[ti]=yn,ti++,ti===58?ti=65:ti===91&&(ti=97);rn[43]=yn;rn[45]=yn;rn[46]=yn;rn[95]=yn;rn[72]=[yn,Zy];rn[104]=[yn,Zy];rn[87]=[yn,Qy];rn[119]=[yn,Qy];function ZN(e,t,r){const n=this;let i,s;return o;function o(u){return!vh(u)||!tx.call(n,n.previous)||yf(n.events)?r(u):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(u))}function l(u){return vh(u)?(e.consume(u),l):u===64?(e.consume(u),a):r(u)}function a(u){return u===46?e.check(GN,d,c)(u):u===45||u===95||At(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&&Ft(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):r(u)}}function JN(e,t,r){const n=this;return i;function i(o){return o!==87&&o!==119||!Jy.call(n,n.previous)||yf(n.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(XN,e.attempt(Yy,e.attempt(Xy,s),r),r)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function eT(e,t,r){const n=this;let i="",s=!1;return o;function o(u){return(u===72||u===104)&&ex.call(n,n.previous)&&!yf(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(u),e.consume(u),l):r(u)}function l(u){if(Ft(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||_a(u)||Be(u)||ki(u)||Ka(u)?r(u):e.attempt(Yy,e.attempt(Xy,d),r)(u)}function d(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function tT(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 rT(e,t,r){let n,i,s;return o;function o(c){return c===46||c===95?e.check(Gy,a,l)(c):c===null||Be(c)||ki(c)||c!==45&&Ka(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 nT(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(Gy,t,s)(o):o===null||Be(o)||ki(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&n++,e.consume(o),i}}function iT(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||Be(l)||ki(l)?t(l):r(l)}function i(l){return l===null||l===40||l===91||Be(l)||ki(l)?t(l):n(l)}function s(l){return Ft(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),n):Ft(l)?(e.consume(l),o):r(l)}}function sT(e,t,r){return n;function n(s){return e.consume(s),i}function i(s){return At(s)?r(s):t(s)}}function Jy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Be(e)}function ex(e){return!Ft(e)}function tx(e){return!(e===47||vh(e))}function vh(e){return e===43||e===45||e===46||e===95||At(e)}function yf(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 oT={tokenize:pT,partial:!0};function lT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hT,continuation:{tokenize:dT},exit:fT}},text:{91:{name:"gfmFootnoteCall",tokenize:uT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:aT,resolveTo:cT}}}}function aT(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=$r(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 cT(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||Be(u))return r(u);if(u===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes($r(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(u)}return Be(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 hT(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||Be(m))return r(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=$r(n.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Be(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),Ie(e,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return t(m)}}function dT(e,t,r){return e.check(Ho,t,e.attempt(oT,t,r))}function fT(e){e.exit("gfmFootnoteDefinition")}function pT(e,t,r){const n=this;return Ie(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 mT(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&&hr(f,f.length,0,qa(p,o.slice(c+1,a),l)),hr(f,f.length,0,[["exit",u,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",d,l]]),hr(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 g=us(c);if(m===126)return u>1?a(m):(o.consume(m),u++,p);if(u<2&&!r)return a(m);const S=o.exit("strikethroughSequenceTemporary"),_=us(m);return S._open=!_||_===2&&!!g,S._close=!g||g===2&&!!_,l(m)}}}class gT{constructor(){this.map=[]}add(t,r,n){_T(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 _T(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 vT(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 yT(){return{flow:{null:{name:"table",tokenize:xT,resolveAll:wT}}}}function xT(e,t,r){const n=this;let i=0,s=0,o;return l;function l(E){let U=n.events.length-1;for(;U>-1;){const V=n.events[U][1].type;if(V==="lineEnding"||V==="linePrefix")U--;else break}const O=U>-1?n.events[U][1].type:null,D=O==="tableHead"||O==="tableRow"?C:a;return D===C&&n.parser.lazy[n.now().line]?r(E):D(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):Se(E)?s>1?(s=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):r(E):Pe(E)?Ie(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||Be(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,Pe(E)?Ie(e,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):m(E))}function m(E){return E===45||E===58?S(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),g):T(E)}function g(E){return Pe(E)?Ie(e,S,"whitespace")(E):S(E)}function S(E){return E===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),_):E===45?(s+=1,_(E)):E===null||Se(E)?N(E):T(E)}function _(E){return E===45?(e.enter("tableDelimiterFiller"),y(E)):T(E)}function y(E){return E===45?(e.consume(E),y):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(E))}function x(E){return Pe(E)?Ie(e,N,"whitespace")(E):N(E)}function N(E){return E===124?m(E):E===null||Se(E)?!o||i!==s?T(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):T(E)}function T(E){return r(E)}function C(E){return e.enter("tableRow"),A(E)}function A(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),A):E===null||Se(E)?(e.exit("tableRow"),t(E)):Pe(E)?Ie(e,A,"whitespace")(E):(e.enter("data"),F(E))}function F(E){return E===null||E===124||Be(E)?(e.exit("data"),A(E)):(e.consume(E),E===92?W:F)}function W(E){return E===92||E===124?(e.consume(E),F):F(E)}}function wT(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&&(lg(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=gl(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=gl(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=gl(f,t,s,i,r,u)):o[1]!==0&&(u=gl(f,t,o,i,r,u)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(a!==0&&lg(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=vT(t.events,r))}return e}function gl(e,t,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(s.end=Object.assign({},ji(t.events,r[0])),e.add(r[0],0,[["exit",s,t]]));const a=ji(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=ji(t.events,r[2]),d=ji(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,g=r[3]-r[2]-1;e.add(m,g,[])}}e.add(r[3]+1,0,[["exit",u,t]])}return i!==void 0&&(s.end=Object.assign({},ji(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function lg(e,t,r,n,i){const s=[],o=ji(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 ji(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const ST={name:"tasklistCheck",tokenize:kT};function bT(){return{text:{91:ST}}}function kT(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 Be(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 Se(a)?t(a):Pe(a)?e.check({tokenize:CT},t,r)(a):r(a)}}function CT(e,t,r){return Ie(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function ET(e){return uy([QN(),lT(),mT(e),yT(),bT()])}const NT={};function ag(e){const t=this,r=e||NT,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(ET(r)),s.push(qN()),o.push(YN(r))}const TT=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,LT=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,PT=({legacyTitle:e=!1,tagName:t="div"}={})=>r=>{Qa(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?LT:TT,m=f.match(p);if(m&&(a=!1,o=m[1].toLocaleLowerCase(),l=e&&m[2]||o.toLocaleUpperCase(),f.includes(`
96
96
  `)&&(d.children[0]={type:"text",value:f.replace(p,"").replace(/^\n+/,"")}),!f.includes(`
97
97
  `))){const g=[];d.children.forEach((S,_)=>{_!=0&&(_==1&&S.type==="break"||g.push(S))}),d.children=[...g]}}return d});o&&(n.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[DT(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),n.children=[...c]})};function DT(e){let t=IT[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 IT={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 RT(e){Iy(e,[/\r?\n|\r/g,MT])}function MT(){return{type:"break"}}function AT(){return function(e){RT(e)}}const Ve={size:18};function jT({size:e=Ve.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 BT({size:e=Ve.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 OT({size:e=Ve.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 zT({size:e=Ve.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 FT({size:e=Ve.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 xf({size:e=Ve.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 oo({size:e=Ve.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 $T({size:e=Ve.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 WT({size:e=Ve.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 lo({size:e=Ve.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 HT({size:e=Ve.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 rx({size:e=Ve.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 nx({size:e=Ve.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 UT({size:e=Ve.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 cg({size:e=Ve.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 VT({size:e=Ve.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 KT({size:e=Ve.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 qT({size:e=Ve.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 YT({size:e=Ve.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 XT({size:e=Ve.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 GT({size:e=Ve.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 QT({size:e=Ve.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 ZT({size:e=Ve.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 JT({size:e=Ve.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 e3(e){const r=e.split(`
98
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(`
@@ -100,8 +100,8 @@ Error generating stack: `+s.message+`
100
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
101
  `).replace(/\n{3,}/g,`
102
102
 
103
- `).trim();return{toolCounts:n,textContent:o,hasTools:Object.keys(n).length>0}}function qc(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const ix=w.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",isCliMode:i=!1,isWorking:s=!1,contextKey:o="",receivedAtMap:l={},emptyState:a,onLoadMore:c,isLoadingMore:d,hasMoreHistory:u},f){var V;const p=w.useRef(null),m=w.useRef(null),g=w.useRef(0),S=w.useRef(""),_=w.useRef(!1),[y,x]=w.useState(new Set),[N,T]=w.useState(new Set),C=w.useRef(!1),M=()=>{const D=p.current;return D?D.scrollHeight-D.scrollTop-D.clientHeight<200:!0},F=t.length>0?`${t.length}:${(((V=t[t.length-1])==null?void 0:V.content)||"").length}`:"0:0";w.useEffect(()=>{var I,H;const D=!_.current,O=S.current!==o;if(S.current=o,D||O){_.current=!0,C.current=!1;const b=()=>{var te;(te=m.current)==null||te.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(b)),setTimeout(b,100),setTimeout(b,300),g.current=t.length;return}t.length>g.current?C.current||(I=m.current)==null||I.scrollIntoView({behavior:"instant"}):M()&&!C.current&&((H=m.current)==null||H.scrollIntoView({behavior:"instant"})),g.current=t.length},[F,o,s]),w.useImperativeHandle(f,()=>({scrollToBottom:(D="smooth")=>{var O;(O=m.current)==null||O.scrollIntoView({behavior:D})}})),w.useEffect(()=>{const D=p.current;if(!D)return;let O;const K=()=>{clearTimeout(O),O=setTimeout(()=>{C.current=!M()},50)};return D.addEventListener("scroll",K,{passive:!0}),()=>{D.removeEventListener("scroll",K),clearTimeout(O)}},[]);const $=w.useRef(!1),E=w.useRef(0),U=w.useRef(!1);w.useEffect(()=>{const D=p.current;if(!D||!U.current||E.current===0)return;const K=D.scrollHeight-E.current;K>0&&(D.scrollTop=K),E.current=0,U.current=!1},[t.length]),w.useEffect(()=>{const D=p.current;if(!D||!c)return;const O=()=>{D.scrollTop<60&&u&&!d&&!$.current&&($.current=!0,E.current=D.scrollHeight,c(),setTimeout(()=>{$.current=!1},1500))};return D.addEventListener("scroll",O,{passive:!0}),()=>D.removeEventListener("scroll",O)},[c,u,d]);const j=(()=>{const D=t.map((H,b)=>({type:"message",data:H,index:b,ts:H.receivedAt||l[H.id??`i-${b}`]||0}));if(!r||r.length===0)return D;const O=[...r].sort((H,b)=>H.timestamp-b.timestamp).map((H,b)=>({type:"action",data:H,index:b,ts:H.timestamp})),K=[];let I=0;for(const H of D){for(;I<O.length&&H.ts>0&&O[I].ts<H.ts;)K.push(O[I++]);K.push(H)}for(;I<O.length;)K.push(O[I++]);return K})(),A=700;return h.jsxs("div",{ref:p,"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:[d&&h.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60",children:"⏳ Loading older messages..."}),u&&!d&&h.jsx("div",{className:"text-center py-2",children:h.jsx("button",{onClick:c,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"})}),j.length===0&&!u&&(a||h.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),j.map(D=>{var fe;if(D.type==="action"){const xe=D.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(eg,{remarkPlugins:[ag],children:xe.text}),h.jsx("span",{className:"text-[10px] opacity-50 ml-2",children:qc(xe.timestamp)})]},`action-${D.index}`)}const O=D.data,K=D.index,I=(O.role||"").toLowerCase(),H=I==="user"||I==="human",b=O.kind||(I==="tool"?"tool":"standard"),te=O.receivedAt||l[O.id??`i-${K}`],ae=`${o}-${K}`,k=y.has(ae),ye=N.has(ae);if(b==="thought"){const xe=((fe=O.meta)==null?void 0:fe.label)||"Thought";return h.jsxs("div",{className:"self-start max-w-[88%] 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(XT,{size:13})}),h.jsx("span",{className:"text-[11px] text-indigo-400 font-medium",children:xe})]}),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:O.content||""})]},`msg-${K}`)}if(b==="tool")return h.jsxs("div",{className:"self-start 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",children:[h.jsx("span",{className:"text-emerald-500 text-[10px]",children:"⏺"}),h.jsx("span",{className:"text-emerald-500 opacity-80",children:(O.content||"").split(`
104
- `)[0].slice(0,80)})]},`msg-${K}`);if(b==="terminal"){const xe=O.meta||{},B=xe.isRunning?"⏳":"✅",Ce=xe.label||"Ran command";return h.jsxs("div",{className:"self-start max-w-[88%] 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:B}),h.jsx("span",{className:"text-[11px] text-emerald-500 font-medium",children:Ce})]}),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:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"transparent"},children:O.content||""})]},`msg-${K}`)}if(b==="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:(O.content||"").slice(0,100)},`msg-${K}`);const G=!H&&i?e3(O.content||""):null,Z=G?G.textContent:O.content||"",X=G?Object.entries(G.toolCounts):[],ce=i&&!H&&!k&&Z.length>A,me=k?O.content||"":ce&&!ye?Z.slice(0,A):Z;return h.jsxs("div",{className:`max-w-[88%] flex flex-col gap-1 ${H?"self-end":"self-start"}`,children:[X.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1 items-center mb-0.5",children:[X.map(([xe,B])=>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:["⏺ ",xe,B>1?` ×${B}`:""]},xe)),(G==null?void 0:G.hasTools)&&h.jsx("button",{onClick:()=>x(xe=>{const B=new Set(xe);return k?B.delete(ae):B.add(ae),B}),className:"text-[10px] text-text-muted bg-transparent border-none cursor-pointer px-1 py-px opacity-50",children:k?"Collapse":"Original"}),!Z&&te!=null&&h.jsx("span",{className:"text-[10px] opacity-35 ml-0.5",children:qc(te)})]}),(Z||H)&&h.jsxs("div",{className:H?"chat-bubble-user":"",style:{background:H?"linear-gradient(135deg, var(--accent-primary), #4f46e5)":"var(--bg-secondary)",color:H?"#fff":"var(--text-primary)",padding:"12px 16px",borderRadius:H?"16px 16px 4px 16px":"16px 16px 16px 4px",fontSize:13,lineHeight:1.65,border:H?"none":"1px solid var(--border-subtle)"},children:[h.jsxs("div",{className:`flex justify-between items-baseline gap-2 ${Z?"mb-1.5":"mb-0"}`,children:[h.jsx("span",{className:"text-[10px] font-bold opacity-60 tracking-wide uppercase",children:H?"You":n}),te!=null&&h.jsx("span",{className:"text-[10px] opacity-45",children:qc(te)})]}),Z&&h.jsx("div",{className:"chat-markdown",children:h.jsx(eg,{remarkPlugins:[ag,PT,AT],children:me})}),ce&&h.jsx("button",{onClick:()=>T(xe=>{const B=new Set(xe);return ye?B.delete(ae):B.add(ae),B}),className:"mt-1.5 text-[11px] font-semibold text-[var(--accent-primary)] bg-transparent border-none cursor-pointer p-0 opacity-80",children:ye?"Collapse ↑":`Show more (${Math.round(Z.length/100)*100} chars) ↓`})]})]},`msg-${K}`)}),s&&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:m})]})}),Is={idle:{bg:"rgba(100,116,139,0.15)",text:"#94a3b8",dot:"#64748b",label:"Idle"},streaming:{bg:"rgba(59,130,246,0.15)",text:"#60a5fa",dot:"#3b82f6",label:"Streaming"},waiting_approval:{bg:"rgba(245,158,11,0.15)",text:"#fbbf24",dot:"#f59e0b",label:"Waiting Approval"},error:{bg:"rgba(239,68,68,0.15)",text:"#f87171",dot:"#ef4444",label:"Error"},disconnected:{bg:"rgba(75,85,99,0.15)",text:"#6b7280",dot:"#4b5563",label:"Disconnected"}},Yc={cline:"#22d3ee","roo-code":"#a78bfa",continue:"#34d399",copilot:"#60a5fa"};function t3({agentStreams:e,sendCommand:t}){var f,p,m;const[r,n]=w.useState(null),[i,s]=w.useState(""),[o,l]=w.useState(!1);w.useEffect(()=>{!r&&e.length>0&&n(e[0].agentType)},[e,r]);const a=e.find(g=>g.agentType===r),c=w.useCallback(async()=>{if(!(!i.trim()||!r||o)){l(!0);try{await t("agent_stream_send",{agentType:r,text:i.trim()}),s("")}catch(g){console.error("Failed to send agent message",g)}finally{l(!1)}}},[i,r,o,t]),d=w.useCallback(async g=>{if(r)try{await t("agent_stream_resolve",{agentType:r,action:g})}catch(S){console.error("Failed to resolve agent action",S)}},[r,t]),u=w.useCallback(async()=>{if(r)try{await t("agent_stream_new_session",{agentType:r})}catch(g){console.error("Failed to start new session",g)}},[r,t]);return e.length===0?null:h.jsxs("div",{className:"flex flex-col h-full bg-[#0c0e14] rounded-xl overflow-hidden border border-border-subtle",children:[h.jsxs("div",{className:"flex items-center gap-0.5 px-3 pt-2 border-b border-border-subtle bg-white/[0.02] overflow-x-auto",children:[e.map(g=>{const S=g.agentType===r,_=Yc[g.agentType]||"#94a3b8",y=Is[g.status]||Is.idle;return h.jsxs("button",{onClick:()=>n(g.agentType),className:`flex items-center gap-2 px-4 py-2 border-none rounded-t-lg text-[13px] whitespace-nowrap cursor-pointer transition-all duration-150 ${S?"bg-white/[0.05] text-text-primary font-semibold":"bg-transparent text-text-muted font-normal"}`,style:{borderBottom:S?`2px solid ${_}`:"2px solid transparent"},children:[h.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:y.dot,boxShadow:g.status==="streaming"?`0 0 6px ${y.dot}`:"none",animation:g.status==="streaming"?"pulse 1.5s infinite":"none"}}),g.agentName,g.status==="waiting_approval"&&h.jsx("span",{className:"text-[10px] px-1.5 py-px rounded bg-yellow-500/20 text-yellow-300 font-semibold",children:"APPROVE"})]},g.agentType)}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:u,title:"New Chat Session",className:"px-2 py-1 mb-1 border-none bg-white/[0.06] text-text-secondary rounded-md cursor-pointer text-[13px]",children:"+ New"})]}),a?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-1.5 text-[11px] text-text-muted border-b border-border-subtle",children:[h.jsx("span",{className:"px-2 py-0.5 rounded font-semibold text-[10px] tracking-wide uppercase",style:{background:(f=Is[a.status])==null?void 0:f.bg,color:(p=Is[a.status])==null?void 0:p.text},children:((m=Is[a.status])==null?void 0:m.label)||a.status}),a.model&&h.jsxs("span",{className:"text-text-muted",children:["Model: ",h.jsx("span",{className:"text-text-secondary",children:a.model})]}),h.jsx("span",{className:"text-text-muted",children:"|"}),h.jsxs("span",{children:[a.messages.length," messages"]})]}),a.activeModal&&h.jsxs("div",{className:"px-3.5 py-2.5 bg-gradient-to-br from-yellow-500/10 to-orange-600/[0.08] border-b border-yellow-500/20 flex items-center gap-2.5",children:[h.jsx("span",{className:"text-base",children:"⚠️"}),h.jsx("span",{className:"flex-1 text-[13px] text-yellow-300 leading-snug",children:a.activeModal.message||"Action requires approval"}),h.jsx("button",{onClick:()=>d("approve"),className:"px-3.5 py-1 border-none rounded-md bg-green-500 text-white text-xs font-semibold cursor-pointer",children:"Approve"}),h.jsx("button",{onClick:()=>d("reject"),className:"px-3.5 py-1 border-none rounded-md bg-red-500/20 text-red-400 text-xs font-semibold cursor-pointer",children:"Reject"})]}),h.jsx(ix,{messages:a.messages.map((g,S)=>({role:g.role,content:g.content,kind:g.kind,id:`${a.agentType}-${S}`,receivedAt:g.timestamp})),agentName:a.agentName,isWorking:a.status==="streaming",contextKey:`agent-${a.agentType}`,emptyState:h.jsxs("div",{className:"flex items-center justify-center h-full text-text-muted text-[13px]",children:["No messages yet. Start a conversation with ",a.agentName,"."]})}),h.jsxs("div",{className:"px-3.5 py-2.5 border-t border-border-subtle flex gap-2",children:[h.jsx("input",{type:"text",value:i,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),c())},placeholder:`Message ${a.agentName}...`,disabled:o,className:"flex-1 bg-bg-glass border border-border-default rounded-lg px-3.5 py-2 text-text-primary text-[13px] outline-none"}),h.jsx("button",{onClick:c,disabled:o||!i.trim(),className:"px-4.5 py-2 border-none rounded-lg text-[13px] font-semibold transition-all duration-150",style:{background:i.trim()?`linear-gradient(135deg, ${Yc[a.agentType]||"#3b82f6"}, ${Yc[a.agentType]||"#3b82f6"}cc)`:"rgba(255,255,255,0.04)",color:i.trim()?"#fff":"#475569",cursor:i.trim()?"pointer":"default"},children:o?"…":"Send"})]})]}):h.jsx("div",{className:"flex-1 flex items-center justify-center text-text-muted text-[13px]",children:"Select an agent tab to view its chat stream."}),h.jsx("style",{children:`
103
+ `).trim();return{toolCounts:n,textContent:o,hasTools:Object.keys(n).length>0}}function qc(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const ix=w.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",isCliMode:i=!1,isWorking:s=!1,contextKey:o="",receivedAtMap:l={},emptyState:a,onLoadMore:c,isLoadingMore:d,hasMoreHistory:u},f){var V;const p=w.useRef(null),m=w.useRef(null),g=w.useRef(0),S=w.useRef(""),_=w.useRef(!1),[y,x]=w.useState(new Set),[N,T]=w.useState(new Set),C=w.useRef(!1),A=()=>{const I=p.current;return I?I.scrollHeight-I.scrollTop-I.clientHeight<200:!0},F=t.length>0?`${t.length}:${(((V=t[t.length-1])==null?void 0:V.content)||"").length}`:"0:0";w.useEffect(()=>{var R,$;const I=!_.current,B=S.current!==o;if(S.current=o,I||B){_.current=!0,C.current=!1;const b=()=>{var te;(te=m.current)==null||te.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(b)),setTimeout(b,100),setTimeout(b,300),g.current=t.length;return}t.length>g.current?C.current||(R=m.current)==null||R.scrollIntoView({behavior:"instant"}):A()&&!C.current&&(($=m.current)==null||$.scrollIntoView({behavior:"instant"})),g.current=t.length},[F,o,s]),w.useImperativeHandle(f,()=>({scrollToBottom:(I="smooth")=>{var B;(B=m.current)==null||B.scrollIntoView({behavior:I})}})),w.useEffect(()=>{const I=p.current;if(!I)return;let B;const K=()=>{clearTimeout(B),B=setTimeout(()=>{C.current=!A()},50)};return I.addEventListener("scroll",K,{passive:!0}),()=>{I.removeEventListener("scroll",K),clearTimeout(B)}},[]);const W=w.useRef(!1),E=w.useRef(0),U=w.useRef(!1);w.useEffect(()=>{const I=p.current;if(!I||!U.current||E.current===0)return;const K=I.scrollHeight-E.current;K>0&&(I.scrollTop=K),E.current=0,U.current=!1},[t.length]),w.useEffect(()=>{const I=p.current;if(!I||!c)return;const B=()=>{I.scrollTop<60&&u&&!d&&!W.current&&(W.current=!0,E.current=I.scrollHeight,c(),setTimeout(()=>{W.current=!1},1500))};return I.addEventListener("scroll",B,{passive:!0}),()=>I.removeEventListener("scroll",B)},[c,u,d]);const O=(()=>{const I=t.map(($,b)=>({type:"message",data:$,index:b,ts:$.receivedAt||l[$.id??`i-${b}`]||0}));if(!r||r.length===0)return I;const B=[...r].sort(($,b)=>$.timestamp-b.timestamp).map(($,b)=>({type:"action",data:$,index:b,ts:$.timestamp})),K=[];let R=0;for(const $ of I){for(;R<B.length&&$.ts>0&&B[R].ts<$.ts;)K.push(B[R++]);K.push($)}for(;R<B.length;)K.push(B[R++]);return K})(),D=700;return h.jsxs("div",{ref:p,"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:[d&&h.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60",children:"⏳ Loading older messages..."}),u&&!d&&h.jsx("div",{className:"text-center py-2",children:h.jsx("button",{onClick:c,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"})}),O.length===0&&!u&&(a||h.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),O.map(I=>{var fe;if(I.type==="action"){const xe=I.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(eg,{remarkPlugins:[ag],children:xe.text}),h.jsx("span",{className:"text-[10px] opacity-50 ml-2",children:qc(xe.timestamp)})]},`action-${I.index}`)}const B=I.data,K=I.index,R=(B.role||"").toLowerCase(),$=R==="user"||R==="human",b=B.kind||(R==="tool"?"tool":"standard"),te=B.receivedAt||l[B.id??`i-${K}`],ae=`${o}-${K}`,k=y.has(ae),ye=N.has(ae);if(b==="thought"){const xe=((fe=B.meta)==null?void 0:fe.label)||"Thought";return h.jsxs("div",{className:"self-start max-w-[88%] 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(XT,{size:13})}),h.jsx("span",{className:"text-[11px] text-indigo-400 font-medium",children:xe})]}),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:B.content||""})]},`msg-${K}`)}if(b==="tool")return h.jsxs("div",{className:"self-start 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",children:[h.jsx("span",{className:"text-emerald-500 text-[10px]",children:"⏺"}),h.jsx("span",{className:"text-emerald-500 opacity-80",children:(B.content||"").split(`
104
+ `)[0].slice(0,80)})]},`msg-${K}`);if(b==="terminal"){const xe=B.meta||{},j=xe.isRunning?"⏳":"✅",Ce=xe.label||"Ran command";return h.jsxs("div",{className:"self-start max-w-[88%] 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:j}),h.jsx("span",{className:"text-[11px] text-emerald-500 font-medium",children:Ce})]}),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:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"transparent"},children:B.content||""})]},`msg-${K}`)}if(b==="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:(B.content||"").slice(0,100)},`msg-${K}`);const G=!$&&i?e3(B.content||""):null,Z=G?G.textContent:B.content||"",X=G?Object.entries(G.toolCounts):[],ce=i&&!$&&!k&&Z.length>D,me=k?B.content||"":ce&&!ye?Z.slice(0,D):Z;return h.jsxs("div",{className:`max-w-[88%] flex flex-col gap-1 ${$?"self-end":"self-start"}`,children:[X.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1 items-center mb-0.5",children:[X.map(([xe,j])=>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:["⏺ ",xe,j>1?` ×${j}`:""]},xe)),(G==null?void 0:G.hasTools)&&h.jsx("button",{onClick:()=>x(xe=>{const j=new Set(xe);return k?j.delete(ae):j.add(ae),j}),className:"text-[10px] text-text-muted bg-transparent border-none cursor-pointer px-1 py-px opacity-50",children:k?"Collapse":"Original"}),!Z&&te!=null&&h.jsx("span",{className:"text-[10px] opacity-35 ml-0.5",children:qc(te)})]}),(Z||$)&&h.jsxs("div",{className:$?"chat-bubble-user":"",style:{background:$?"linear-gradient(135deg, var(--accent-primary), #4f46e5)":"var(--bg-secondary)",color:$?"#fff":"var(--text-primary)",padding:"12px 16px",borderRadius:$?"16px 16px 4px 16px":"16px 16px 16px 4px",fontSize:13,lineHeight:1.65,border:$?"none":"1px solid var(--border-subtle)"},children:[h.jsxs("div",{className:`flex justify-between items-baseline gap-2 ${Z?"mb-1.5":"mb-0"}`,children:[h.jsx("span",{className:"text-[10px] font-bold opacity-60 tracking-wide uppercase",children:$?"You":n}),te!=null&&h.jsx("span",{className:"text-[10px] opacity-45",children:qc(te)})]}),Z&&h.jsx("div",{className:"chat-markdown",children:h.jsx(eg,{remarkPlugins:[ag,PT,AT],children:me})}),ce&&h.jsx("button",{onClick:()=>T(xe=>{const j=new Set(xe);return ye?j.delete(ae):j.add(ae),j}),className:"mt-1.5 text-[11px] font-semibold text-[var(--accent-primary)] bg-transparent border-none cursor-pointer p-0 opacity-80",children:ye?"Collapse ↑":`Show more (${Math.round(Z.length/100)*100} chars) ↓`})]})]},`msg-${K}`)}),s&&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:m})]})}),Is={idle:{bg:"rgba(100,116,139,0.15)",text:"#94a3b8",dot:"#64748b",label:"Idle"},streaming:{bg:"rgba(59,130,246,0.15)",text:"#60a5fa",dot:"#3b82f6",label:"Streaming"},waiting_approval:{bg:"rgba(245,158,11,0.15)",text:"#fbbf24",dot:"#f59e0b",label:"Waiting Approval"},error:{bg:"rgba(239,68,68,0.15)",text:"#f87171",dot:"#ef4444",label:"Error"},disconnected:{bg:"rgba(75,85,99,0.15)",text:"#6b7280",dot:"#4b5563",label:"Disconnected"}},Yc={cline:"#22d3ee","roo-code":"#a78bfa",continue:"#34d399",copilot:"#60a5fa"};function t3({agentStreams:e,sendCommand:t}){var f,p,m;const[r,n]=w.useState(null),[i,s]=w.useState(""),[o,l]=w.useState(!1);w.useEffect(()=>{!r&&e.length>0&&n(e[0].agentType)},[e,r]);const a=e.find(g=>g.agentType===r),c=w.useCallback(async()=>{if(!(!i.trim()||!r||o)){l(!0);try{await t("agent_stream_send",{agentType:r,text:i.trim()}),s("")}catch(g){console.error("Failed to send agent message",g)}finally{l(!1)}}},[i,r,o,t]),d=w.useCallback(async g=>{if(r)try{await t("agent_stream_resolve",{agentType:r,action:g})}catch(S){console.error("Failed to resolve agent action",S)}},[r,t]),u=w.useCallback(async()=>{if(r)try{await t("agent_stream_new_session",{agentType:r})}catch(g){console.error("Failed to start new session",g)}},[r,t]);return e.length===0?null:h.jsxs("div",{className:"flex flex-col h-full bg-[#0c0e14] rounded-xl overflow-hidden border border-border-subtle",children:[h.jsxs("div",{className:"flex items-center gap-0.5 px-3 pt-2 border-b border-border-subtle bg-white/[0.02] overflow-x-auto",children:[e.map(g=>{const S=g.agentType===r,_=Yc[g.agentType]||"#94a3b8",y=Is[g.status]||Is.idle;return h.jsxs("button",{onClick:()=>n(g.agentType),className:`flex items-center gap-2 px-4 py-2 border-none rounded-t-lg text-[13px] whitespace-nowrap cursor-pointer transition-all duration-150 ${S?"bg-white/[0.05] text-text-primary font-semibold":"bg-transparent text-text-muted font-normal"}`,style:{borderBottom:S?`2px solid ${_}`:"2px solid transparent"},children:[h.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:y.dot,boxShadow:g.status==="streaming"?`0 0 6px ${y.dot}`:"none",animation:g.status==="streaming"?"pulse 1.5s infinite":"none"}}),g.agentName,g.status==="waiting_approval"&&h.jsx("span",{className:"text-[10px] px-1.5 py-px rounded bg-yellow-500/20 text-yellow-300 font-semibold",children:"APPROVE"})]},g.agentType)}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:u,title:"New Chat Session",className:"px-2 py-1 mb-1 border-none bg-white/[0.06] text-text-secondary rounded-md cursor-pointer text-[13px]",children:"+ New"})]}),a?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-1.5 text-[11px] text-text-muted border-b border-border-subtle",children:[h.jsx("span",{className:"px-2 py-0.5 rounded font-semibold text-[10px] tracking-wide uppercase",style:{background:(f=Is[a.status])==null?void 0:f.bg,color:(p=Is[a.status])==null?void 0:p.text},children:((m=Is[a.status])==null?void 0:m.label)||a.status}),a.model&&h.jsxs("span",{className:"text-text-muted",children:["Model: ",h.jsx("span",{className:"text-text-secondary",children:a.model})]}),h.jsx("span",{className:"text-text-muted",children:"|"}),h.jsxs("span",{children:[a.messages.length," messages"]})]}),a.activeModal&&h.jsxs("div",{className:"px-3.5 py-2.5 bg-gradient-to-br from-yellow-500/10 to-orange-600/[0.08] border-b border-yellow-500/20 flex items-center gap-2.5",children:[h.jsx("span",{className:"text-base",children:"⚠️"}),h.jsx("span",{className:"flex-1 text-[13px] text-yellow-300 leading-snug",children:a.activeModal.message||"Action requires approval"}),h.jsx("button",{onClick:()=>d("approve"),className:"px-3.5 py-1 border-none rounded-md bg-green-500 text-white text-xs font-semibold cursor-pointer",children:"Approve"}),h.jsx("button",{onClick:()=>d("reject"),className:"px-3.5 py-1 border-none rounded-md bg-red-500/20 text-red-400 text-xs font-semibold cursor-pointer",children:"Reject"})]}),h.jsx(ix,{messages:a.messages.map((g,S)=>({role:g.role,content:g.content,kind:g.kind,id:`${a.agentType}-${S}`,receivedAt:g.timestamp})),agentName:a.agentName,isWorking:a.status==="streaming",contextKey:`agent-${a.agentType}`,emptyState:h.jsxs("div",{className:"flex items-center justify-center h-full text-text-muted text-[13px]",children:["No messages yet. Start a conversation with ",a.agentName,"."]})}),h.jsxs("div",{className:"px-3.5 py-2.5 border-t border-border-subtle flex gap-2",children:[h.jsx("input",{type:"text",value:i,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),c())},placeholder:`Message ${a.agentName}...`,disabled:o,className:"flex-1 bg-bg-glass border border-border-default rounded-lg px-3.5 py-2 text-text-primary text-[13px] outline-none"}),h.jsx("button",{onClick:c,disabled:o||!i.trim(),className:"px-4.5 py-2 border-none rounded-lg text-[13px] font-semibold transition-all duration-150",style:{background:i.trim()?`linear-gradient(135deg, ${Yc[a.agentType]||"#3b82f6"}, ${Yc[a.agentType]||"#3b82f6"}cc)`:"rgba(255,255,255,0.04)",color:i.trim()?"#fff":"#475569",cursor:i.trim()?"pointer":"default"},children:o?"…":"Send"})]})]}):h.jsx("div",{className:"flex-1 flex items-center justify-center text-text-muted text-[13px]",children:"Select an agent tab to view its chat stream."}),h.jsx("style",{children:`
105
105
  @keyframes pulse {
106
106
  0%, 100% { opacity: 1; }
107
107
  50% { opacity: 0.4; }
@@ -123,11 +123,11 @@ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){t
123
123
 
124
124
  `+e.stack):new Error(e.message+`
125
125
 
126
- `+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)}},_3=new g3;function Ol(e){v3(e)||_3.onUnexpectedError(e)}var bh="Canceled";function v3(e){return e instanceof y3?!0:e instanceof Error&&e.name===bh&&e.message===bh}var y3=class extends Error{constructor(){super(bh),this.name=this.message}};function x3(e){return new Error(`Illegal argument: ${e}`)}var pg=class kh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof kh)return t;let r=new kh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Ch=class _x extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,_x.prototype)}};function ir(e,t=0){return e[e.length-(1+t)]}var w3;(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})(w3||(w3={}));function S3(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var vx;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*i(N){yield N}e.single=i;function s(N){return t(N)?N:i(N)}e.wrap=s;function o(N){return N||r}e.from=o;function*l(N){for(let T=N.length-1;T>=0;T--)yield N[T]}e.reverse=l;function a(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(N){return N[Symbol.iterator]().next().value}e.first=c;function d(N,T){let C=0;for(let M of N)if(T(M,C++))return!0;return!1}e.some=d;function u(N,T){for(let C of N)if(T(C))return C}e.find=u;function*f(N,T){for(let C of N)T(C)&&(yield C)}e.filter=f;function*p(N,T){let C=0;for(let M of N)yield T(M,C++)}e.map=p;function*m(N,T){let C=0;for(let M of N)yield*T(M,C++)}e.flatMap=m;function*g(...N){for(let T of N)yield*T}e.concat=g;function S(N,T,C){let M=C;for(let F of N)M=T(M,F);return M}e.reduce=S;function*_(N,T,C=N.length){for(T<0&&(T+=N.length),C<0?C+=N.length:C>N.length&&(C=N.length);T<C;T++)yield N[T]}e.slice=_;function y(N,T=Number.POSITIVE_INFINITY){let C=[];if(T===0)return[C,N];let M=N[Symbol.iterator]();for(let F=0;F<T;F++){let $=M.next();if($.done)return[C,e.empty()];C.push($.value)}return[C,{[Symbol.iterator](){return M}}]}e.consume=y;async function x(N){let T=[];for await(let C of N)T.push(C);return Promise.resolve(T)}e.asyncToArray=x})(vx||(vx={}));function Ci(e){if(vx.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 b3(...e){return Ue(()=>Ci(e))}function Ue(e){return{dispose:S3(()=>{e()})}}var yx=class xx{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{Ci(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?xx.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)}};yx.DISABLE_DISPOSED_WARNING=!1;var Vn=yx,Te=class{constructor(){this._store=new Vn,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)}};Te.None=Object.freeze({dispose(){}});var hs=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}},dn=typeof window=="object"?window:globalThis,Eh=class Nh{constructor(t){this.element=t,this.next=Nh.Undefined,this.prev=Nh.Undefined}};Eh.Undefined=new Eh(void 0);var Ke=Eh,mg=class{constructor(){this._first=Ke.Undefined,this._last=Ke.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ke.Undefined}clear(){let e=this._first;for(;e!==Ke.Undefined;){let t=e.next;e.prev=Ke.Undefined,e.next=Ke.Undefined,e=t}this._first=Ke.Undefined,this._last=Ke.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Ke(e);if(this._first===Ke.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!==Ke.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ke.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ke.Undefined&&e.next!==Ke.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ke.Undefined&&e.next===Ke.Undefined?(this._first=Ke.Undefined,this._last=Ke.Undefined):e.next===Ke.Undefined?(this._last=this._last.prev,this._last.next=Ke.Undefined):e.prev===Ke.Undefined&&(this._first=this._first.next,this._first.prev=Ke.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ke.Undefined;)yield e.element,e=e.next}},k3=globalThis.performance&&typeof globalThis.performance.now=="function",C3=class wx{static create(t){return new wx(t)}constructor(t){this._now=k3&&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}},Nt;(e=>{e.None=()=>Te.None;function t(j,A){return u(j,()=>{},0,void 0,!0,void 0,A)}e.defer=t;function r(j){return(A,V=null,D)=>{let O=!1,K;return K=j(I=>{if(!O)return K?K.dispose():O=!0,A.call(V,I)},null,D),O&&K.dispose(),K}}e.once=r;function n(j,A,V){return c((D,O=null,K)=>j(I=>D.call(O,A(I)),null,K),V)}e.map=n;function i(j,A,V){return c((D,O=null,K)=>j(I=>{A(I),D.call(O,I)},null,K),V)}e.forEach=i;function s(j,A,V){return c((D,O=null,K)=>j(I=>A(I)&&D.call(O,I),null,K),V)}e.filter=s;function o(j){return j}e.signal=o;function l(...j){return(A,V=null,D)=>{let O=b3(...j.map(K=>K(I=>A.call(V,I))));return d(O,D)}}e.any=l;function a(j,A,V,D){let O=V;return n(j,K=>(O=A(O,K),O),D)}e.reduce=a;function c(j,A){let V,D={onWillAddFirstListener(){V=j(O.fire,O)},onDidRemoveLastListener(){V==null||V.dispose()}},O=new se(D);return A==null||A.add(O),O.event}function d(j,A){return A instanceof Array?A.push(j):A&&A.add(j),j}function u(j,A,V=100,D=!1,O=!1,K,I){let H,b,te,ae=0,k,ye={leakWarningThreshold:K,onWillAddFirstListener(){H=j(Z=>{ae++,b=A(b,Z),D&&!te&&(G.fire(b),b=void 0),k=()=>{let X=b;b=void 0,te=void 0,(!D||ae>1)&&G.fire(X),ae=0},typeof V=="number"?(clearTimeout(te),te=setTimeout(k,V)):te===void 0&&(te=0,queueMicrotask(k))})},onWillRemoveListener(){O&&ae>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,H.dispose()}},G=new se(ye);return I==null||I.add(G),G.event}e.debounce=u;function f(j,A=0,V){return e.debounce(j,(D,O)=>D?(D.push(O),D):[O],A,void 0,!0,void 0,V)}e.accumulate=f;function p(j,A=(D,O)=>D===O,V){let D=!0,O;return s(j,K=>{let I=D||!A(K,O);return D=!1,O=K,I},V)}e.latch=p;function m(j,A,V){return[e.filter(j,A,V),e.filter(j,D=>!A(D),V)]}e.split=m;function g(j,A=!1,V=[],D){let O=V.slice(),K=j(b=>{O?O.push(b):H.fire(b)});D&&D.add(K);let I=()=>{O==null||O.forEach(b=>H.fire(b)),O=null},H=new se({onWillAddFirstListener(){K||(K=j(b=>H.fire(b)),D&&D.add(K))},onDidAddFirstListener(){O&&(A?setTimeout(I):I())},onDidRemoveLastListener(){K&&K.dispose(),K=null}});return D&&D.add(H),H.event}e.buffer=g;function S(j,A){return(V,D,O)=>{let K=A(new y);return j(function(I){let H=K.evaluate(I);H!==_&&V.call(D,H)},void 0,O)}}e.chain=S;let _=Symbol("HaltChainable");class y{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push(V=>(A(V),V)),this}filter(A){return this.steps.push(V=>A(V)?V:_),this}reduce(A,V){let D=V;return this.steps.push(O=>(D=A(D,O),D)),this}latch(A=(V,D)=>V===D){let V=!0,D;return this.steps.push(O=>{let K=V||!A(O,D);return V=!1,D=O,K?O:_}),this}evaluate(A){for(let V of this.steps)if(A=V(A),A===_)break;return A}}function x(j,A,V=D=>D){let D=(...H)=>I.fire(V(...H)),O=()=>j.on(A,D),K=()=>j.removeListener(A,D),I=new se({onWillAddFirstListener:O,onDidRemoveLastListener:K});return I.event}e.fromNodeEventEmitter=x;function N(j,A,V=D=>D){let D=(...H)=>I.fire(V(...H)),O=()=>j.addEventListener(A,D),K=()=>j.removeEventListener(A,D),I=new se({onWillAddFirstListener:O,onDidRemoveLastListener:K});return I.event}e.fromDOMEventEmitter=N;function T(j){return new Promise(A=>r(j)(A))}e.toPromise=T;function C(j){let A=new se;return j.then(V=>{A.fire(V)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=C;function M(j,A){return j(V=>A.fire(V))}e.forward=M;function F(j,A,V){return A(V),j(D=>A(D))}e.runAndSubscribe=F;class ${constructor(A,V){this._observable=A,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new se(D),V&&V.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,V){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(j,A){return new $(j,A).emitter.event}e.fromObservable=E;function U(j){return(A,V,D)=>{let O=0,K=!1,I={beginUpdate(){O++},endUpdate(){O--,O===0&&(j.reportChanges(),K&&(K=!1,A.call(V)))},handlePossibleChange(){},handleChange(){K=!0}};j.addObserver(I),j.reportChanges();let H={dispose(){j.removeObserver(I)}};return D instanceof Vn?D.add(H):Array.isArray(D)&&D.push(H),H}}e.fromObservableLight=U})(Nt||(Nt={}));var Th=class Lh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Lh._idPool++}`,Lh.all.add(this)}start(t){this._stopWatch=new C3,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}}};Th.all=new Set,Th._idPool=0;var E3=Th,N3=-1,Sx=class bx{constructor(t,r,n=(bx._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 P3(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}};Sx._idPool=1;var T3=Sx,L3=class kx{constructor(t){this.value=t}static create(){let t=new Error;return new kx(t.stack??"")}print(){console.warn(this.value.split(`
126
+ `+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)}},_3=new g3;function Ol(e){v3(e)||_3.onUnexpectedError(e)}var bh="Canceled";function v3(e){return e instanceof y3?!0:e instanceof Error&&e.name===bh&&e.message===bh}var y3=class extends Error{constructor(){super(bh),this.name=this.message}};function x3(e){return new Error(`Illegal argument: ${e}`)}var pg=class kh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof kh)return t;let r=new kh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Ch=class _x extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,_x.prototype)}};function ir(e,t=0){return e[e.length-(1+t)]}var w3;(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})(w3||(w3={}));function S3(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var vx;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*i(N){yield N}e.single=i;function s(N){return t(N)?N:i(N)}e.wrap=s;function o(N){return N||r}e.from=o;function*l(N){for(let T=N.length-1;T>=0;T--)yield N[T]}e.reverse=l;function a(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(N){return N[Symbol.iterator]().next().value}e.first=c;function d(N,T){let C=0;for(let A of N)if(T(A,C++))return!0;return!1}e.some=d;function u(N,T){for(let C of N)if(T(C))return C}e.find=u;function*f(N,T){for(let C of N)T(C)&&(yield C)}e.filter=f;function*p(N,T){let C=0;for(let A of N)yield T(A,C++)}e.map=p;function*m(N,T){let C=0;for(let A of N)yield*T(A,C++)}e.flatMap=m;function*g(...N){for(let T of N)yield*T}e.concat=g;function S(N,T,C){let A=C;for(let F of N)A=T(A,F);return A}e.reduce=S;function*_(N,T,C=N.length){for(T<0&&(T+=N.length),C<0?C+=N.length:C>N.length&&(C=N.length);T<C;T++)yield N[T]}e.slice=_;function y(N,T=Number.POSITIVE_INFINITY){let C=[];if(T===0)return[C,N];let A=N[Symbol.iterator]();for(let F=0;F<T;F++){let W=A.next();if(W.done)return[C,e.empty()];C.push(W.value)}return[C,{[Symbol.iterator](){return A}}]}e.consume=y;async function x(N){let T=[];for await(let C of N)T.push(C);return Promise.resolve(T)}e.asyncToArray=x})(vx||(vx={}));function Ci(e){if(vx.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 b3(...e){return Ue(()=>Ci(e))}function Ue(e){return{dispose:S3(()=>{e()})}}var yx=class xx{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{Ci(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?xx.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)}};yx.DISABLE_DISPOSED_WARNING=!1;var Vn=yx,Te=class{constructor(){this._store=new Vn,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)}};Te.None=Object.freeze({dispose(){}});var hs=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}},dn=typeof window=="object"?window:globalThis,Eh=class Nh{constructor(t){this.element=t,this.next=Nh.Undefined,this.prev=Nh.Undefined}};Eh.Undefined=new Eh(void 0);var Ke=Eh,mg=class{constructor(){this._first=Ke.Undefined,this._last=Ke.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ke.Undefined}clear(){let e=this._first;for(;e!==Ke.Undefined;){let t=e.next;e.prev=Ke.Undefined,e.next=Ke.Undefined,e=t}this._first=Ke.Undefined,this._last=Ke.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Ke(e);if(this._first===Ke.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!==Ke.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ke.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ke.Undefined&&e.next!==Ke.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ke.Undefined&&e.next===Ke.Undefined?(this._first=Ke.Undefined,this._last=Ke.Undefined):e.next===Ke.Undefined?(this._last=this._last.prev,this._last.next=Ke.Undefined):e.prev===Ke.Undefined&&(this._first=this._first.next,this._first.prev=Ke.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ke.Undefined;)yield e.element,e=e.next}},k3=globalThis.performance&&typeof globalThis.performance.now=="function",C3=class wx{static create(t){return new wx(t)}constructor(t){this._now=k3&&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}},Nt;(e=>{e.None=()=>Te.None;function t(O,D){return u(O,()=>{},0,void 0,!0,void 0,D)}e.defer=t;function r(O){return(D,V=null,I)=>{let B=!1,K;return K=O(R=>{if(!B)return K?K.dispose():B=!0,D.call(V,R)},null,I),B&&K.dispose(),K}}e.once=r;function n(O,D,V){return c((I,B=null,K)=>O(R=>I.call(B,D(R)),null,K),V)}e.map=n;function i(O,D,V){return c((I,B=null,K)=>O(R=>{D(R),I.call(B,R)},null,K),V)}e.forEach=i;function s(O,D,V){return c((I,B=null,K)=>O(R=>D(R)&&I.call(B,R),null,K),V)}e.filter=s;function o(O){return O}e.signal=o;function l(...O){return(D,V=null,I)=>{let B=b3(...O.map(K=>K(R=>D.call(V,R))));return d(B,I)}}e.any=l;function a(O,D,V,I){let B=V;return n(O,K=>(B=D(B,K),B),I)}e.reduce=a;function c(O,D){let V,I={onWillAddFirstListener(){V=O(B.fire,B)},onDidRemoveLastListener(){V==null||V.dispose()}},B=new se(I);return D==null||D.add(B),B.event}function d(O,D){return D instanceof Array?D.push(O):D&&D.add(O),O}function u(O,D,V=100,I=!1,B=!1,K,R){let $,b,te,ae=0,k,ye={leakWarningThreshold:K,onWillAddFirstListener(){$=O(Z=>{ae++,b=D(b,Z),I&&!te&&(G.fire(b),b=void 0),k=()=>{let X=b;b=void 0,te=void 0,(!I||ae>1)&&G.fire(X),ae=0},typeof V=="number"?(clearTimeout(te),te=setTimeout(k,V)):te===void 0&&(te=0,queueMicrotask(k))})},onWillRemoveListener(){B&&ae>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,$.dispose()}},G=new se(ye);return R==null||R.add(G),G.event}e.debounce=u;function f(O,D=0,V){return e.debounce(O,(I,B)=>I?(I.push(B),I):[B],D,void 0,!0,void 0,V)}e.accumulate=f;function p(O,D=(I,B)=>I===B,V){let I=!0,B;return s(O,K=>{let R=I||!D(K,B);return I=!1,B=K,R},V)}e.latch=p;function m(O,D,V){return[e.filter(O,D,V),e.filter(O,I=>!D(I),V)]}e.split=m;function g(O,D=!1,V=[],I){let B=V.slice(),K=O(b=>{B?B.push(b):$.fire(b)});I&&I.add(K);let R=()=>{B==null||B.forEach(b=>$.fire(b)),B=null},$=new se({onWillAddFirstListener(){K||(K=O(b=>$.fire(b)),I&&I.add(K))},onDidAddFirstListener(){B&&(D?setTimeout(R):R())},onDidRemoveLastListener(){K&&K.dispose(),K=null}});return I&&I.add($),$.event}e.buffer=g;function S(O,D){return(V,I,B)=>{let K=D(new y);return O(function(R){let $=K.evaluate(R);$!==_&&V.call(I,$)},void 0,B)}}e.chain=S;let _=Symbol("HaltChainable");class y{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(V=>(D(V),V)),this}filter(D){return this.steps.push(V=>D(V)?V:_),this}reduce(D,V){let I=V;return this.steps.push(B=>(I=D(I,B),I)),this}latch(D=(V,I)=>V===I){let V=!0,I;return this.steps.push(B=>{let K=V||!D(B,I);return V=!1,I=B,K?B:_}),this}evaluate(D){for(let V of this.steps)if(D=V(D),D===_)break;return D}}function x(O,D,V=I=>I){let I=(...$)=>R.fire(V(...$)),B=()=>O.on(D,I),K=()=>O.removeListener(D,I),R=new se({onWillAddFirstListener:B,onDidRemoveLastListener:K});return R.event}e.fromNodeEventEmitter=x;function N(O,D,V=I=>I){let I=(...$)=>R.fire(V(...$)),B=()=>O.addEventListener(D,I),K=()=>O.removeEventListener(D,I),R=new se({onWillAddFirstListener:B,onDidRemoveLastListener:K});return R.event}e.fromDOMEventEmitter=N;function T(O){return new Promise(D=>r(O)(D))}e.toPromise=T;function C(O){let D=new se;return O.then(V=>{D.fire(V)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=C;function A(O,D){return O(V=>D.fire(V))}e.forward=A;function F(O,D,V){return D(V),O(I=>D(I))}e.runAndSubscribe=F;class W{constructor(D,V){this._observable=D,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};this.emitter=new se(I),V&&V.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,V){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(O,D){return new W(O,D).emitter.event}e.fromObservable=E;function U(O){return(D,V,I)=>{let B=0,K=!1,R={beginUpdate(){B++},endUpdate(){B--,B===0&&(O.reportChanges(),K&&(K=!1,D.call(V)))},handlePossibleChange(){},handleChange(){K=!0}};O.addObserver(R),O.reportChanges();let $={dispose(){O.removeObserver(R)}};return I instanceof Vn?I.add($):Array.isArray(I)&&I.push($),$}}e.fromObservableLight=U})(Nt||(Nt={}));var Th=class Lh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Lh._idPool++}`,Lh.all.add(this)}start(t){this._stopWatch=new C3,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}}};Th.all=new Set,Th._idPool=0;var E3=Th,N3=-1,Sx=class bx{constructor(t,r,n=(bx._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 P3(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}};Sx._idPool=1;var T3=Sx,L3=class kx{constructor(t){this.value=t}static create(){let t=new Error;return new kx(t.stack??"")}print(){console.warn(this.value.split(`
127
127
  `).slice(2).join(`
128
128
  `))}},P3=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},D3=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},I3=0,Gc=class{constructor(e){this.value=e,this.id=I3++}},R3=2,M3,se=class{constructor(t){var r,n,i,s;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new T3((t==null?void 0:t.onListenerError)??Ol,((n=this._options)==null?void 0:n.leakWarningThreshold)??N3):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new E3(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 D3(`${f}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Ol)(m),Te.None}if(this._disposed)return Te.None;r&&(t=t.bind(r));let i=new Gc(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=L3.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Gc?(this._deliveryQueue??(this._deliveryQueue=new A3),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=Ue(()=>{s==null||s(),this._removeListener(i)});return n instanceof Vn?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*R3<=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)||Ol;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 Gc)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}},A3=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}},Ph=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new se,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}};Ph.INSTANCE=new Ph;var bf=Ph;function j3(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}bf.INSTANCE.onDidChangeZoomLevel;function B3(e){return bf.INSTANCE.getZoomFactor(e)}bf.INSTANCE.onDidChangeFullscreen;var xs=typeof navigator=="object"?navigator.userAgent:"",Dh=xs.indexOf("Firefox")>=0,O3=xs.indexOf("AppleWebKit")>=0,kf=xs.indexOf("Chrome")>=0,z3=!kf&&xs.indexOf("Safari")>=0;xs.indexOf("Electron/")>=0;xs.indexOf("Android")>=0;var Qc=!1;if(typeof dn.matchMedia=="function"){let e=dn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=dn.matchMedia("(display-mode: fullscreen)");Qc=e.matches,j3(dn,e,({matches:r})=>{Qc&&t.matches||(Qc=r)})}var Xi="en",Ih=!1,Rh=!1,zl=!1,Cx=!1,_l,Fl=Xi,gg=Xi,F3,Mr,vi=globalThis,Et,__;typeof vi.vscode<"u"&&typeof vi.vscode.process<"u"?Et=vi.vscode.process:typeof process<"u"&&typeof((__=process==null?void 0:process.versions)==null?void 0:__.node)=="string"&&(Et=process);var v_,$3=typeof((v_=Et==null?void 0:Et.versions)==null?void 0:v_.electron)=="string",W3=$3&&(Et==null?void 0:Et.type)==="renderer",y_;if(typeof Et=="object"){Ih=Et.platform==="win32",Rh=Et.platform==="darwin",zl=Et.platform==="linux",zl&&Et.env.SNAP&&Et.env.SNAP_REVISION,Et.env.CI||Et.env.BUILD_ARTIFACTSTAGINGDIRECTORY,_l=Xi,Fl=Xi;let e=Et.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);_l=t.userLocale,gg=t.osLocale,Fl=t.resolvedLanguage||Xi,F3=(y_=t.languagePack)==null?void 0:y_.translationsConfigFile}catch{}Cx=!0}else typeof navigator=="object"&&!W3?(Mr=navigator.userAgent,Ih=Mr.indexOf("Windows")>=0,Rh=Mr.indexOf("Macintosh")>=0,(Mr.indexOf("Macintosh")>=0||Mr.indexOf("iPad")>=0||Mr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,zl=Mr.indexOf("Linux")>=0,(Mr==null?void 0:Mr.indexOf("Mobi"))>=0,Fl=globalThis._VSCODE_NLS_LANGUAGE||Xi,_l=navigator.language.toLowerCase(),gg=_l):console.error("Unable to resolve platform.");var Ex=Ih,en=Rh,H3=zl,_g=Cx,tn=Mr,kn=Fl,U3;(e=>{function t(){return kn}e.value=t;function r(){return kn.length===2?kn==="en":kn.length>=3?kn[0]==="e"&&kn[1]==="n"&&kn[2]==="-":!1}e.isDefaultVariant=r;function n(){return kn==="en"}e.isDefault=n})(U3||(U3={}));var V3=typeof vi.postMessage=="function"&&!vi.importScripts;(()=>{if(V3){let e=[];vi.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}),vi.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var K3=!!(tn&&tn.indexOf("Chrome")>=0);tn&&tn.indexOf("Firefox")>=0;!K3&&tn&&tn.indexOf("Safari")>=0;tn&&tn.indexOf("Edg/")>=0;tn&&tn.indexOf("Android")>=0;var Mi=typeof navigator=="object"?navigator:{};_g||document.queryCommandSupported&&document.queryCommandSupported("copy")||Mi&&Mi.clipboard&&Mi.clipboard.writeText,_g||Mi&&Mi.clipboard&&Mi.clipboard.readText;var Cf=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}},Zc=new Cf,vg=new Cf,yg=new Cf,q3=new Array(230),Nx;(e=>{function t(l){return Zc.keyCodeToStr(l)}e.toString=t;function r(l){return Zc.strToKeyCode(l)}e.fromString=r;function n(l){return vg.keyCodeToStr(l)}e.toUserSettingsUS=n;function i(l){return yg.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return vg.strToKeyCode(l)||yg.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 Zc.keyCodeToStr(l)}e.toElectronAccelerator=o})(Nx||(Nx={}));var Y3=class Tx{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 Tx&&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 X3([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},X3=class{constructor(e){if(e.length===0)throw x3("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 G3(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return Nx.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Dh)switch(t){case 59:return 85;case 60:if(H3)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(en)return 57;break}else if(O3&&(en&&t===93||!en&&t===92))return 57;return q3[t]||0}var Q3=en?256:2048,Z3=512,J3=1024,eL=en?2048:256,xg=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=G3(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|=Q3),this.altKey&&(t|=Z3),this.shiftKey&&(t|=J3),this.metaKey&&(t|=eL),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Y3(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},wg=new WeakMap;function tL(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 rL=class{static getSameOriginWindowChain(e){let t=wg.get(e);if(!t){t=[],wg.set(e,t);let r=e,n;do n=tL(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}}},vl=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=rL.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Sg=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(kf){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?Dh&&!en?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")z3&&Ex?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?Dh&&!en?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()}},Lx=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),nL;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof iL?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Nt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Lx})})(nL||(nL={}));var iL=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?Lx:(this._emitter||(this._emitter=new se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ef=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 Ch("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Ch("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},sL=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 Ch("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=Ue(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},oL;(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})(oL||(oL={}));var bg=class wr{static fromArray(t){return new wr(r=>{r.emitMany(t)})}static fromPromise(t){return new wr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new wr(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new wr(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 se,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 Nt.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 wr(async n=>{for await(let i of t)n.emitOne(r(i))})}map(t){return wr.map(this,t)}static filter(t,r){return new wr(async n=>{for await(let i of t)r(i)&&n.emitOne(i)})}filter(t){return wr.filter(this,t)}static coalesce(t){return wr.filter(t,r=>!!r)}coalesce(){return wr.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return wr.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())}};bg.EMPTY=bg.fromArray([]);var{getWindow:Qr,getWindowId:lL,onDidRegisterWindow:aL}=function(){let e=new Map,t={window:dn,disposables:new Vn};e.set(dn.vscodeWindowId,t);let r=new se,n=new se,i=new se;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 Te.None;let l=new Vn,a={window:o,disposables:l.add(new Vn)};return e.set(o.vscodeWindowId,a),l.add(Ue(()=>{e.delete(o.vscodeWindowId),n.fire(o)})),l.add(ke(o,_t.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:dn},getDocument(o){return Qr(o).document}}}(),cL=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 ke(e,t,r,n){return new cL(e,t,r,n)}var kg=function(e,t,r,n){return ke(e,t,r,n)},Nf,uL=class extends sL{constructor(e){super(),this.defaultTarget=e&&Qr(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},Cg=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){Ol(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(Cg.sort),o.shift().execute();n.set(s,!1)};Nf=(s,o,l=0)=>{let a=lL(s),c=new Cg(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 hL(e){let t=e.getBoundingClientRect(),r=Qr(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var _t={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"},dL=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=qt(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=qt(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=qt(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=qt(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=qt(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=qt(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=qt(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=qt(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=qt(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=qt(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=qt(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=qt(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=qt(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=qt(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 qt(e){return typeof e=="number"?`${e}px`:e}function ao(e){return new dL(e)}var Px=class{constructor(){this._hooks=new Vn,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(Ue(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=Qr(e)}this._hooks.add(ke(s,_t.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(ke(s,_t.POINTER_UP,o=>this.stopMonitoring(!0)))}};function fL(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 Kr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Kr||(Kr={}));var Hs=class Rt extends Te{constructor(){super(),this.dispatched=!1,this.targets=new mg,this.ignoreTargets=new mg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Nt.runAndSubscribe(aL,({window:t,disposables:r})=>{r.add(ke(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(ke(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(ke(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:dn,disposables:this._store}))}static addTarget(t){if(!Rt.isTouchDevice())return Te.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let r=Rt.INSTANCE.targets.push(t);return Ue(r)}static ignoreTarget(t){if(!Rt.isTouchDevice())return Te.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let r=Rt.INSTANCE.ignoreTargets.push(t);return Ue(r)}static isTouchDevice(){return"ontouchstart"in dn||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(Kr.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<Rt.HOLD_DELAY&&Math.abs(a.initialPageX-ir(a.rollingPageX))<30&&Math.abs(a.initialPageY-ir(a.rollingPageY))<30){let d=this.newGestureEvent(Kr.Tap,a.initialTarget);d.pageX=ir(a.rollingPageX),d.pageY=ir(a.rollingPageY),this.dispatchEvent(d)}else if(c>=Rt.HOLD_DELAY&&Math.abs(a.initialPageX-ir(a.rollingPageX))<30&&Math.abs(a.initialPageY-ir(a.rollingPageY))<30){let d=this.newGestureEvent(Kr.Contextmenu,a.initialTarget);d.pageX=ir(a.rollingPageX),d.pageY=ir(a.rollingPageY),this.dispatchEvent(d)}else if(i===1){let d=ir(a.rollingPageX),u=ir(a.rollingPageY),f=ir(a.rollingTimestamps)-a.rollingTimestamps[0],p=d-a.rollingPageX[0],m=u-a.rollingPageY[0],g=[...this.targets].filter(S=>a.initialTarget instanceof Node&&S.contains(a.initialTarget));this.inertia(t,g,n,Math.abs(p)/f,p>0?1:-1,d,Math.abs(m)/f,m>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Kr.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===Kr.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Rt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===Kr.Change||t.type===Kr.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=Nf(t,()=>{let d=Date.now(),u=d-n,f=0,p=0,m=!0;i+=Rt.SCROLL_FRICTION*u,l+=Rt.SCROLL_FRICTION*u,i>0&&(m=!1,f=s*i*u),l>0&&(m=!1,p=a*l*u);let g=this.newGestureEvent(Kr.Change);g.translationX=f,g.translationY=p,r.forEach(S=>S.dispatchEvent(g)),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(Kr.Change,o.initialTarget);l.translationX=s.pageX-ir(o.rollingPageX),l.translationY=s.pageY-ir(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)}};Hs.SCROLL_FRICTION=-.005,Hs.HOLD_DELAY=700,Hs.CLEAR_TAP_COUNT_TIME=400,et([fL],Hs,"isTouchDevice",1);var pL=Hs,Tf=class extends Te{onclick(e,t){this._register(ke(e,_t.CLICK,r=>t(new vl(Qr(e),r))))}onmousedown(e,t){this._register(ke(e,_t.MOUSE_DOWN,r=>t(new vl(Qr(e),r))))}onmouseover(e,t){this._register(ke(e,_t.MOUSE_OVER,r=>t(new vl(Qr(e),r))))}onmouseleave(e,t){this._register(ke(e,_t.MOUSE_LEAVE,r=>t(new vl(Qr(e),r))))}onkeydown(e,t){this._register(ke(e,_t.KEY_DOWN,r=>t(new xg(r))))}onkeyup(e,t){this._register(ke(e,_t.KEY_UP,r=>t(new xg(r))))}oninput(e,t){this._register(ke(e,_t.INPUT,t))}onblur(e,t){this._register(ke(e,_t.BLUR,t))}onfocus(e,t){this._register(ke(e,_t.FOCUS,t))}onchange(e,t){this._register(ke(e,_t.CHANGE,t))}ignoreGesture(e){return pL.ignoreTarget(e)}},Eg=11,mL=class extends Tf{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=Eg+"px",this.domNode.style.height=Eg+"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 Px),this._register(kg(this.bgDomNode,_t.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(kg(this.domNode,_t.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new uL),this._pointerdownScheduleRepeatTimer=this._register(new Ef)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Qr(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()}},gL=class Mh{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 Mh(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 Mh(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}}},_L=class extends Te{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new gL(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 Tg(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=Tg.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)))}},Ng=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function Jc(e,t){let r=t-e;return function(n){return e+r*xL(n)}}function vL(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var Tg=class Ah{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),vL(Jc(t,i),Jc(s,r),.33)}return Jc(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 Ng(n,i,!1)}return new Ng(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return Ah.start(t,r,n)}static start(t,r,n){n=n+10;let i=Date.now()-10;return new Ah(t,r,i,n)}};function yL(e){return Math.pow(e,3)}function xL(e){return 1-yL(1-e)}var wL=class extends Te{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 Ef)}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":"")))}},SL=140,Dx=class extends Tf{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 wL(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Px),this._shouldRender=!0,this.domNode=ao(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(ke(this.domNode.domNode,_t.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new mL(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=ao(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(ke(this.slider.domNode,_t.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=hL(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(Ex&&o>SL){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()}},Ix=class jh{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 jh(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=jh._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)}},bL=class extends Dx{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Ix(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}},kL=class extends Dx{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Ix(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}},CL=500,Lg=50,EL=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Bh=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(kf){let r=Qr(t.browserEvent),n=B3(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 EL(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}};Bh.INSTANCE=new Bh;var NL=Bh,TL=class extends Tf{constructor(e,t,r){super(),this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new se),this.onWillScroll=this._onWillScroll.event,this._options=PL(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 kL(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new bL(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=ao(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ao(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ao(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 Ef),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ci(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,en&&(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 Sg(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ci(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Sg(r))};this._mouseWheelToDispose.push(ke(this._listenOnDomNode,_t.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=NL.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=!en&&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=Lg*s,u=a.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(c,u)}if(o){let d=Lg*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(),CL)}},LL=class extends TL{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 PL(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,en&&(t.className+=" mac"),t}var Oh=class extends Te{constructor(e,t,r,n,i,s,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new _L({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Nf(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new LL(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(Nt.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ue(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ue(()=>this._styleElement.remove())),this._register(Nt.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(`
129
129
  `)})),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}};Oh=et([he(2,Ut),he(3,xn),he(4,dx),he(5,ys),he(6,Vt),he(7,wn)],Oh);var zh=class extends Te{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(Ue(()=>{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()}};zh=et([he(1,Ut),he(2,xn),he(3,Ko),he(4,wn)],zh);var DL=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)}},Ur={full:0,left:0,center:0,right:0},Cn={full:0,left:0,center:0,right:0},Rs={full:0,left:0,center:0,right:0},Sa=class extends Te{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 DL,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(Ue(()=>{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);Cn.full=this._canvas.width,Cn.left=e,Cn.center=t,Cn.right=e,this._refreshDrawHeightConstants(),Rs.full=1,Rs.left=1,Rs.center=1+Cn.left,Rs.right=1+Cn.left+Cn.center}_refreshDrawHeightConstants(){Ur.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);Ur.left=t,Ur.center=t,Ur.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ur.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ur.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ur.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ur.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(Rs[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ur[e.position||"full"]/2),Cn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ur[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}))}};Sa=et([he(2,Ut),he(3,Ko),he(4,wn),he(5,Vt),he(6,ys),he(7,xn)],Sa);var Y;(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=`
130
- `,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=""))(Y||(Y={}));var $l;(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="Ÿ"))($l||($l={}));var Rx;(e=>e.ST=`${Y.ESC}\\`)(Rx||(Rx={}));var Fh=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(`${Y.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)}}};Fh=et([he(2,Ut),he(3,Vt),he(4,Di),he(5,wn)],Fh);var yt=0,xt=0,wt=0,Ze=0,Pg={css:"#00000000",rgba:0},ot;(e=>{function t(i,s,o,l){return l!==void 0?`#${ri(i)}${ri(s)}${ri(o)}${ri(l)}`:`#${ri(i)}${ri(s)}${ri(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})(ot||(ot={}));var $e;(e=>{function t(a,c){if(Ze=(c.rgba&255)/255,Ze===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,g=a.rgba>>8&255;yt=p+Math.round((d-p)*Ze),xt=m+Math.round((u-m)*Ze),wt=g+Math.round((f-g)*Ze);let S=ot.toCss(yt,xt,wt),_=ot.toRgba(yt,xt,wt);return{css:S,rgba:_}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function n(a,c,d){let u=Wl.ensureContrastRatio(a.rgba,c.rgba,d);if(u)return ot.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=n;function i(a){let c=(a.rgba|255)>>>0;return[yt,xt,wt]=Wl.toChannels(c),{css:ot.toCss(yt,xt,wt),rgba:c}}e.opaque=i;function s(a,c){return Ze=Math.round(c*255),[yt,xt,wt]=Wl.toChannels(a.rgba),{css:ot.toCss(yt,xt,wt,Ze),rgba:ot.toRgba(yt,xt,wt,Ze)}}e.opacity=s;function o(a,c){return Ze=a.rgba&255,s(a,Ze*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})($e||($e={}));var qe;(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 yt=parseInt(i.slice(1,2).repeat(2),16),xt=parseInt(i.slice(2,3).repeat(2),16),wt=parseInt(i.slice(3,4).repeat(2),16),ot.toColor(yt,xt,wt);case 5:return yt=parseInt(i.slice(1,2).repeat(2),16),xt=parseInt(i.slice(2,3).repeat(2),16),wt=parseInt(i.slice(3,4).repeat(2),16),Ze=parseInt(i.slice(4,5).repeat(2),16),ot.toColor(yt,xt,wt,Ze);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 yt=parseInt(s[1]),xt=parseInt(s[2]),wt=parseInt(s[3]),Ze=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),ot.toColor(yt,xt,wt,Ze);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),[yt,xt,wt,Ze]=t.getImageData(0,0,1,1).data,Ze!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ot.toRgba(yt,xt,wt,Ze),css:i}}e.toColor=n})(qe||(qe={}));var Ot;(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})(Ot||(Ot={}));var Wl;(e=>{function t(o,l){if(Ze=(l&255)/255,Ze===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 yt=u+Math.round((a-u)*Ze),xt=f+Math.round((c-f)*Ze),wt=p+Math.round((d-p)*Ze),ot.toRgba(yt,xt,wt)}e.blend=t;function r(o,l,a){let c=Ot.relativeLuminance(o>>8),d=Ot.relativeLuminance(l>>8);if(on(c,d)<a){if(d<c){let p=n(o,l,a),m=on(c,Ot.relativeLuminance(p>>8));if(m<a){let g=i(o,l,a),S=on(c,Ot.relativeLuminance(g>>8));return m>S?p:g}return p}let u=i(o,l,a),f=on(c,Ot.relativeLuminance(u>>8));if(f<a){let p=n(o,l,a),m=on(c,Ot.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,g=on(Ot.relativeLuminance2(f,p,m),Ot.relativeLuminance2(c,d,u));for(;g<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)),g=on(Ot.relativeLuminance2(f,p,m),Ot.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,g=on(Ot.relativeLuminance2(f,p,m),Ot.relativeLuminance2(c,d,u));for(;g<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)),g=on(Ot.relativeLuminance2(f,p,m),Ot.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})(Wl||(Wl={}));function ri(e){let t=e.toString(16);return t.length<2?"0"+t:t}function on(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var IL=class extends Vo{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()]}},ba=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Tr}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||jn.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++)ba._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||jn.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}};ba=et([he(0,Ut)],ba);function RL(e){return 57508<=e&&e<=57558}function ML(e){return 9472<=e&&e<=9631}function AL(e){return RL(e)||ML(e)}function jL(){return{css:{canvas:yl(),cell:yl()},device:{canvas:yl(),cell:yl(),char:{width:0,height:0,left:0,top:0}}}}function yl(){return{width:0,height:0}}var $h=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 Tr,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 g,S=0,_="",y=0,x=0,N=0,T=0,C=!1,M=0,F=!1,$=0,E=0,U=[],j=c!==-1&&d!==-1;for(let A=0;A<m;A++){e.loadCell(A,this._workCell);let V=this._workCell.getWidth();if(V===0)continue;let D=!1,O=A>=E,K=A,I=this._workCell;if(f.length>0&&A===f[0][0]&&O){let Ce=f.shift(),Qe=this._isCellInSelection(Ce[0],t);for(y=Ce[0]+1;y<Ce[1];y++)O&&(O=Qe===this._isCellInSelection(y,t));O&&(O=!r||s<Ce[0]||s>=Ce[1]),O?(D=!0,I=new IL(this._workCell,e.translateToString(!0,Ce[0],Ce[1]),Ce[1]-Ce[0]),K=Ce[1]-1,V=I.getWidth()):E=Ce[1]}let H=this._isCellInSelection(A,t),b=r&&A===s,te=j&&A>=c&&A<=d,ae=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,Ce=>{ae=!0});let k=I.getChars()||jn;if(k===" "&&(I.isUnderline()||I.isOverline())&&(k=" "),$=V*l-a.get(k,I.isBold(),I.isItalic()),!g)g=this._document.createElement("span");else if(S&&(H&&F||!H&&!F&&I.bg===x)&&(H&&F&&p.selectionForeground||I.fg===N)&&I.extended.ext===T&&te===C&&$===M&&!b&&!D&&!ae&&O){I.isInvisible()?_+=jn:_+=k,S++;continue}else S&&(g.textContent=_),g=this._document.createElement("span"),S=0,_="";if(x=I.bg,N=I.fg,T=I.extended.ext,C=te,M=$,F=H,D&&s>=A&&s<=K&&(s=A),!this._coreService.isCursorHidden&&b&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&U.push("xterm-cursor-blink"),U.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline");break}}if(I.isBold()&&U.push("xterm-bold"),I.isItalic()&&U.push("xterm-italic"),I.isDim()&&U.push("xterm-dim"),I.isInvisible()?_=jn:_=I.getChars()||jn,I.isUnderline()&&(U.push(`xterm-underline-${I.extended.underlineStyle}`),_===" "&&(_=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Vo.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let Ce=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&Ce<8&&(Ce+=8),g.style.textDecorationColor=p.ansi[Ce].css}I.isOverline()&&(U.push("xterm-overline"),_===" "&&(_=" ")),I.isStrikethrough()&&U.push("xterm-strikethrough"),te&&(g.style.textDecoration="underline");let ye=I.getFgColor(),G=I.getFgColorMode(),Z=I.getBgColor(),X=I.getBgColorMode(),ce=!!I.isInverse();if(ce){let Ce=ye;ye=Z,Z=Ce;let Qe=G;G=X,X=Qe}let me,fe,xe=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,Ce=>{Ce.options.layer!=="top"&&xe||(Ce.backgroundColorRGB&&(X=50331648,Z=Ce.backgroundColorRGB.rgba>>8&16777215,me=Ce.backgroundColorRGB),Ce.foregroundColorRGB&&(G=50331648,ye=Ce.foregroundColorRGB.rgba>>8&16777215,fe=Ce.foregroundColorRGB),xe=Ce.options.layer==="top")}),!xe&&H&&(me=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Z=me.rgba>>8&16777215,X=50331648,xe=!0,p.selectionForeground&&(G=50331648,ye=p.selectionForeground.rgba>>8&16777215,fe=p.selectionForeground)),xe&&U.push("xterm-decoration-top");let B;switch(X){case 16777216:case 33554432:B=p.ansi[Z],U.push(`xterm-bg-${Z}`);break;case 50331648:B=ot.toColor(Z>>16,Z>>8&255,Z&255),this._addStyle(g,`background-color:#${Dg((Z>>>0).toString(16),"0",6)}`);break;case 0:default:ce?(B=p.foreground,U.push("xterm-bg-257")):B=p.background}switch(me||I.isDim()&&(me=$e.multiplyOpacity(B,.5)),G){case 16777216:case 33554432:I.isBold()&&ye<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ye+=8),this._applyMinimumContrast(g,B,p.ansi[ye],I,me,void 0)||U.push(`xterm-fg-${ye}`);break;case 50331648:let Ce=ot.toColor(ye>>16&255,ye>>8&255,ye&255);this._applyMinimumContrast(g,B,Ce,I,me,fe)||this._addStyle(g,`color:#${Dg(ye.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,B,p.foreground,I,me,fe)||ce&&U.push("xterm-fg-257")}U.length&&(g.className=U.join(" "),U.length=0),!b&&!D&&!ae&&O?S++:g.textContent=_,$!==this.defaultSpacing&&(g.style.letterSpacing=`${$}px`),u.push(g),A=K}return g&&S&&(g.textContent=_),u}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||AL(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=$e.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]}};$h=et([he(1,mx),he(2,Vt),he(3,xn),he(4,Di),he(5,Ko),he(6,ys)],$h);function Dg(e,t,r){for(;e.length<r;)e=t+e;return e}var BL=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}},OL=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 zL(){return new OL}var eu="xterm-dom-renderer-owner-",yr="xterm-rows",xl="xterm-fg-",Ig="xterm-bg-",Ms="xterm-focus",wl="xterm-selection",FL=1,Wh=class extends Te{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=FL++,this._rowElements=[],this._selectionRenderModel=zL(),this.onRequestRedraw=this._register(new se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(yr),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(wl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=jL(),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($h,document),this._element.classList.add(eu+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(Ue(()=>{this._element.classList.remove(eu+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new BL(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} .${yr} 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} .${yr} { 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} .${yr} .xterm-dim { color: ${$e.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} .${yr}.${Ms} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${yr}.${Ms} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${yr}.${Ms} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${wl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${wl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${wl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${xl}${s} { color: ${o.css}; }${this._terminalSelector} .${xl}${s}.xterm-dim { color: ${$e.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Ig}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${xl}257 { color: ${$e.opaque(e.background).css}; }${this._terminalSelector} .${xl}257.xterm-dim { color: ${$e.multiplyOpacity($e.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ig}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(Ms),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ms),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`.${eu}${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,g=this._rowElements[p],S=l.lines.get(m);if(!g||!S)break;g.replaceChildren(...this._rowFactory.createRow(S,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))}}};Wh=et([he(7,wf),he(8,Ja),he(9,Vt),he(10,Ut),he(11,Di),he(12,xn),he(13,ys)],Wh);var Hh=class extends Te{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new WL(this._optionsService))}catch{this._measureStrategy=this._register(new $L(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())}};Hh=et([he(2,Vt)],Hh);var Mx=class extends Te{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)}},$L=class extends Mx{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}},WL=class extends Mx{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}},HL=class extends Te{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 UL(this._window)),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Nt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ke(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ke(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}},UL=class extends Te{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new hs),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ue(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ke(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)}},VL=class extends Te{constructor(){super(),this.linkProviders=[],this._register(Ue(()=>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 Lf(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 KL(e,t,r,n,i,s,o,l,a){if(!s)return;let c=Lf(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 Uh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return KL(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=Lf(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])}}};Uh=et([he(0,wn),he(1,Ja)],Uh);var qL=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=[]}},Ax={};n3(Ax,{getSafariVersion:()=>XL,isChromeOS:()=>zx,isFirefox:()=>jx,isIpad:()=>GL,isIphone:()=>QL,isLegacyEdge:()=>YL,isLinux:()=>Pf,isMac:()=>ka,isNode:()=>ec,isSafari:()=>Bx,isWindows:()=>Ox});var ec=typeof process<"u"&&"title"in process,qo=ec?"node":navigator.userAgent,Yo=ec?"node":navigator.platform,jx=qo.includes("Firefox"),YL=qo.includes("Edge"),Bx=/^((?!chrome|android).)*safari/i.test(qo);function XL(){if(!Bx)return 0;let e=qo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ka=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Yo),GL=Yo==="iPad",QL=Yo==="iPhone",Ox=["Windows","Win16","Win32","WinCE"].includes(Yo),Pf=Yo.indexOf("Linux")>=0,zx=/\bCrOS\b/.test(qo),Fx=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()}},ZL=class extends Fx{_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())}}},JL=class extends Fx{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ca=!ec&&"requestIdleCallback"in window?JL:ZL,eP=class{constructor(){this._queue=new Ca}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Vh=class extends Te{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 hs),this._pausedResizeTask=new eP,this._observerDisposable=this._register(new hs),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 se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new qL((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new tP(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ue(()=>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=Ue(()=>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()}};Vh=et([he(2,Vt),he(3,Ja),he(4,Di),he(5,Ko),he(6,Ut),he(7,xn),he(8,ys)],Vh);var tP=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 rP(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return sP(i,s,e,t,r,n)+tc(s,t,r,n)+oP(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",Io(Math.abs(i-e),Do(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),a=iP(s>t?e:i,r)+(l-1)*r.cols+1+nP(s>t?i:e);return Io(a,Do(o,n))}function nP(e,t){return e-1}function iP(e,t){return t.cols-e}function sP(e,t,r,n,i,s){return tc(t,n,i,s).length===0?"":Io(Wx(e,t,e,t-Ei(t,i),!1,i).length,Do("D",s))}function tc(e,t,r,n){let i=e-Ei(e,r),s=t-Ei(t,r),o=Math.abs(i-s)-lP(e,t,r);return Io(o,Do($x(e,t),n))}function oP(e,t,r,n,i,s){let o;tc(t,n,i,s).length>0?o=n-Ei(n,i):o=t;let l=n,a=aP(e,t,r,n,i,s);return Io(Wx(e,o,r,l,a==="C",i).length,Do(a,s))}function lP(e,t,r){var o;let n=0,i=e-Ei(e,r),s=t-Ei(t,r);for(let l=0;l<Math.abs(i-s);l++){let a=$x(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&n++}return n}function Ei(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 aP(e,t,r,n,i,s){let o;return tc(r,n,i,s).length>0?o=n-Ei(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function $x(e,t){return e>t?"A":"B"}function Wx(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 Do(e,t){let r=t?"O":"[";return Y.ESC+r+e}function Io(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var cP=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 Rg(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 tu=50,uP=15,hP=50,dP=500,fP=" ",pP=new RegExp(fP,"g"),Kh=class extends Te{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 Tr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new se),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 cP(this._bufferService),this._activeSelectionMode=0,this._register(Ue(()=>{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(pP," ")).join(Ox?`\r
130
+ `,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=""))(Y||(Y={}));var $l;(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="Ÿ"))($l||($l={}));var Rx;(e=>e.ST=`${Y.ESC}\\`)(Rx||(Rx={}));var Fh=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(`${Y.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)}}};Fh=et([he(2,Ut),he(3,Vt),he(4,Di),he(5,wn)],Fh);var yt=0,xt=0,wt=0,Ze=0,Pg={css:"#00000000",rgba:0},ot;(e=>{function t(i,s,o,l){return l!==void 0?`#${ri(i)}${ri(s)}${ri(o)}${ri(l)}`:`#${ri(i)}${ri(s)}${ri(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})(ot||(ot={}));var $e;(e=>{function t(a,c){if(Ze=(c.rgba&255)/255,Ze===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,g=a.rgba>>8&255;yt=p+Math.round((d-p)*Ze),xt=m+Math.round((u-m)*Ze),wt=g+Math.round((f-g)*Ze);let S=ot.toCss(yt,xt,wt),_=ot.toRgba(yt,xt,wt);return{css:S,rgba:_}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function n(a,c,d){let u=Wl.ensureContrastRatio(a.rgba,c.rgba,d);if(u)return ot.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=n;function i(a){let c=(a.rgba|255)>>>0;return[yt,xt,wt]=Wl.toChannels(c),{css:ot.toCss(yt,xt,wt),rgba:c}}e.opaque=i;function s(a,c){return Ze=Math.round(c*255),[yt,xt,wt]=Wl.toChannels(a.rgba),{css:ot.toCss(yt,xt,wt,Ze),rgba:ot.toRgba(yt,xt,wt,Ze)}}e.opacity=s;function o(a,c){return Ze=a.rgba&255,s(a,Ze*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})($e||($e={}));var qe;(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 yt=parseInt(i.slice(1,2).repeat(2),16),xt=parseInt(i.slice(2,3).repeat(2),16),wt=parseInt(i.slice(3,4).repeat(2),16),ot.toColor(yt,xt,wt);case 5:return yt=parseInt(i.slice(1,2).repeat(2),16),xt=parseInt(i.slice(2,3).repeat(2),16),wt=parseInt(i.slice(3,4).repeat(2),16),Ze=parseInt(i.slice(4,5).repeat(2),16),ot.toColor(yt,xt,wt,Ze);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 yt=parseInt(s[1]),xt=parseInt(s[2]),wt=parseInt(s[3]),Ze=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),ot.toColor(yt,xt,wt,Ze);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),[yt,xt,wt,Ze]=t.getImageData(0,0,1,1).data,Ze!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ot.toRgba(yt,xt,wt,Ze),css:i}}e.toColor=n})(qe||(qe={}));var Ot;(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})(Ot||(Ot={}));var Wl;(e=>{function t(o,l){if(Ze=(l&255)/255,Ze===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 yt=u+Math.round((a-u)*Ze),xt=f+Math.round((c-f)*Ze),wt=p+Math.round((d-p)*Ze),ot.toRgba(yt,xt,wt)}e.blend=t;function r(o,l,a){let c=Ot.relativeLuminance(o>>8),d=Ot.relativeLuminance(l>>8);if(on(c,d)<a){if(d<c){let p=n(o,l,a),m=on(c,Ot.relativeLuminance(p>>8));if(m<a){let g=i(o,l,a),S=on(c,Ot.relativeLuminance(g>>8));return m>S?p:g}return p}let u=i(o,l,a),f=on(c,Ot.relativeLuminance(u>>8));if(f<a){let p=n(o,l,a),m=on(c,Ot.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,g=on(Ot.relativeLuminance2(f,p,m),Ot.relativeLuminance2(c,d,u));for(;g<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)),g=on(Ot.relativeLuminance2(f,p,m),Ot.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,g=on(Ot.relativeLuminance2(f,p,m),Ot.relativeLuminance2(c,d,u));for(;g<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)),g=on(Ot.relativeLuminance2(f,p,m),Ot.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})(Wl||(Wl={}));function ri(e){let t=e.toString(16);return t.length<2?"0"+t:t}function on(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var IL=class extends Vo{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()]}},ba=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Tr}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||jn.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++)ba._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||jn.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}};ba=et([he(0,Ut)],ba);function RL(e){return 57508<=e&&e<=57558}function ML(e){return 9472<=e&&e<=9631}function AL(e){return RL(e)||ML(e)}function jL(){return{css:{canvas:yl(),cell:yl()},device:{canvas:yl(),cell:yl(),char:{width:0,height:0,left:0,top:0}}}}function yl(){return{width:0,height:0}}var $h=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 Tr,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 g,S=0,_="",y=0,x=0,N=0,T=0,C=!1,A=0,F=!1,W=0,E=0,U=[],O=c!==-1&&d!==-1;for(let D=0;D<m;D++){e.loadCell(D,this._workCell);let V=this._workCell.getWidth();if(V===0)continue;let I=!1,B=D>=E,K=D,R=this._workCell;if(f.length>0&&D===f[0][0]&&B){let Ce=f.shift(),Qe=this._isCellInSelection(Ce[0],t);for(y=Ce[0]+1;y<Ce[1];y++)B&&(B=Qe===this._isCellInSelection(y,t));B&&(B=!r||s<Ce[0]||s>=Ce[1]),B?(I=!0,R=new IL(this._workCell,e.translateToString(!0,Ce[0],Ce[1]),Ce[1]-Ce[0]),K=Ce[1]-1,V=R.getWidth()):E=Ce[1]}let $=this._isCellInSelection(D,t),b=r&&D===s,te=O&&D>=c&&D<=d,ae=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,Ce=>{ae=!0});let k=R.getChars()||jn;if(k===" "&&(R.isUnderline()||R.isOverline())&&(k=" "),W=V*l-a.get(k,R.isBold(),R.isItalic()),!g)g=this._document.createElement("span");else if(S&&($&&F||!$&&!F&&R.bg===x)&&($&&F&&p.selectionForeground||R.fg===N)&&R.extended.ext===T&&te===C&&W===A&&!b&&!I&&!ae&&B){R.isInvisible()?_+=jn:_+=k,S++;continue}else S&&(g.textContent=_),g=this._document.createElement("span"),S=0,_="";if(x=R.bg,N=R.fg,T=R.extended.ext,C=te,A=W,F=$,I&&s>=D&&s<=K&&(s=D),!this._coreService.isCursorHidden&&b&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&U.push("xterm-cursor-blink"),U.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline");break}}if(R.isBold()&&U.push("xterm-bold"),R.isItalic()&&U.push("xterm-italic"),R.isDim()&&U.push("xterm-dim"),R.isInvisible()?_=jn:_=R.getChars()||jn,R.isUnderline()&&(U.push(`xterm-underline-${R.extended.underlineStyle}`),_===" "&&(_=" "),!R.isUnderlineColorDefault()))if(R.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Vo.toColorRGB(R.getUnderlineColor()).join(",")})`;else{let Ce=R.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&R.isBold()&&Ce<8&&(Ce+=8),g.style.textDecorationColor=p.ansi[Ce].css}R.isOverline()&&(U.push("xterm-overline"),_===" "&&(_=" ")),R.isStrikethrough()&&U.push("xterm-strikethrough"),te&&(g.style.textDecoration="underline");let ye=R.getFgColor(),G=R.getFgColorMode(),Z=R.getBgColor(),X=R.getBgColorMode(),ce=!!R.isInverse();if(ce){let Ce=ye;ye=Z,Z=Ce;let Qe=G;G=X,X=Qe}let me,fe,xe=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,Ce=>{Ce.options.layer!=="top"&&xe||(Ce.backgroundColorRGB&&(X=50331648,Z=Ce.backgroundColorRGB.rgba>>8&16777215,me=Ce.backgroundColorRGB),Ce.foregroundColorRGB&&(G=50331648,ye=Ce.foregroundColorRGB.rgba>>8&16777215,fe=Ce.foregroundColorRGB),xe=Ce.options.layer==="top")}),!xe&&$&&(me=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Z=me.rgba>>8&16777215,X=50331648,xe=!0,p.selectionForeground&&(G=50331648,ye=p.selectionForeground.rgba>>8&16777215,fe=p.selectionForeground)),xe&&U.push("xterm-decoration-top");let j;switch(X){case 16777216:case 33554432:j=p.ansi[Z],U.push(`xterm-bg-${Z}`);break;case 50331648:j=ot.toColor(Z>>16,Z>>8&255,Z&255),this._addStyle(g,`background-color:#${Dg((Z>>>0).toString(16),"0",6)}`);break;case 0:default:ce?(j=p.foreground,U.push("xterm-bg-257")):j=p.background}switch(me||R.isDim()&&(me=$e.multiplyOpacity(j,.5)),G){case 16777216:case 33554432:R.isBold()&&ye<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ye+=8),this._applyMinimumContrast(g,j,p.ansi[ye],R,me,void 0)||U.push(`xterm-fg-${ye}`);break;case 50331648:let Ce=ot.toColor(ye>>16&255,ye>>8&255,ye&255);this._applyMinimumContrast(g,j,Ce,R,me,fe)||this._addStyle(g,`color:#${Dg(ye.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,j,p.foreground,R,me,fe)||ce&&U.push("xterm-fg-257")}U.length&&(g.className=U.join(" "),U.length=0),!b&&!I&&!ae&&B?S++:g.textContent=_,W!==this.defaultSpacing&&(g.style.letterSpacing=`${W}px`),u.push(g),D=K}return g&&S&&(g.textContent=_),u}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||AL(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=$e.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]}};$h=et([he(1,mx),he(2,Vt),he(3,xn),he(4,Di),he(5,Ko),he(6,ys)],$h);function Dg(e,t,r){for(;e.length<r;)e=t+e;return e}var BL=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}},OL=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 zL(){return new OL}var eu="xterm-dom-renderer-owner-",yr="xterm-rows",xl="xterm-fg-",Ig="xterm-bg-",Ms="xterm-focus",wl="xterm-selection",FL=1,Wh=class extends Te{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=FL++,this._rowElements=[],this._selectionRenderModel=zL(),this.onRequestRedraw=this._register(new se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(yr),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(wl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=jL(),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($h,document),this._element.classList.add(eu+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(Ue(()=>{this._element.classList.remove(eu+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new BL(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} .${yr} 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} .${yr} { 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} .${yr} .xterm-dim { color: ${$e.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} .${yr}.${Ms} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${yr}.${Ms} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${yr}.${Ms} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${wl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${wl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${wl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${xl}${s} { color: ${o.css}; }${this._terminalSelector} .${xl}${s}.xterm-dim { color: ${$e.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Ig}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${xl}257 { color: ${$e.opaque(e.background).css}; }${this._terminalSelector} .${xl}257.xterm-dim { color: ${$e.multiplyOpacity($e.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ig}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(Ms),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ms),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`.${eu}${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,g=this._rowElements[p],S=l.lines.get(m);if(!g||!S)break;g.replaceChildren(...this._rowFactory.createRow(S,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))}}};Wh=et([he(7,wf),he(8,Ja),he(9,Vt),he(10,Ut),he(11,Di),he(12,xn),he(13,ys)],Wh);var Hh=class extends Te{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new WL(this._optionsService))}catch{this._measureStrategy=this._register(new $L(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())}};Hh=et([he(2,Vt)],Hh);var Mx=class extends Te{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)}},$L=class extends Mx{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}},WL=class extends Mx{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}},HL=class extends Te{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 UL(this._window)),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Nt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ke(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ke(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}},UL=class extends Te{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new hs),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ue(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ke(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)}},VL=class extends Te{constructor(){super(),this.linkProviders=[],this._register(Ue(()=>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 Lf(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 KL(e,t,r,n,i,s,o,l,a){if(!s)return;let c=Lf(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 Uh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return KL(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=Lf(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])}}};Uh=et([he(0,wn),he(1,Ja)],Uh);var qL=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=[]}},Ax={};n3(Ax,{getSafariVersion:()=>XL,isChromeOS:()=>zx,isFirefox:()=>jx,isIpad:()=>GL,isIphone:()=>QL,isLegacyEdge:()=>YL,isLinux:()=>Pf,isMac:()=>ka,isNode:()=>ec,isSafari:()=>Bx,isWindows:()=>Ox});var ec=typeof process<"u"&&"title"in process,qo=ec?"node":navigator.userAgent,Yo=ec?"node":navigator.platform,jx=qo.includes("Firefox"),YL=qo.includes("Edge"),Bx=/^((?!chrome|android).)*safari/i.test(qo);function XL(){if(!Bx)return 0;let e=qo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ka=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Yo),GL=Yo==="iPad",QL=Yo==="iPhone",Ox=["Windows","Win16","Win32","WinCE"].includes(Yo),Pf=Yo.indexOf("Linux")>=0,zx=/\bCrOS\b/.test(qo),Fx=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()}},ZL=class extends Fx{_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())}}},JL=class extends Fx{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ca=!ec&&"requestIdleCallback"in window?JL:ZL,eP=class{constructor(){this._queue=new Ca}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Vh=class extends Te{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 hs),this._pausedResizeTask=new eP,this._observerDisposable=this._register(new hs),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 se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new qL((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new tP(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ue(()=>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=Ue(()=>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()}};Vh=et([he(2,Vt),he(3,Ja),he(4,Di),he(5,Ko),he(6,Ut),he(7,xn),he(8,ys)],Vh);var tP=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 rP(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return sP(i,s,e,t,r,n)+tc(s,t,r,n)+oP(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",Io(Math.abs(i-e),Do(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),a=iP(s>t?e:i,r)+(l-1)*r.cols+1+nP(s>t?i:e);return Io(a,Do(o,n))}function nP(e,t){return e-1}function iP(e,t){return t.cols-e}function sP(e,t,r,n,i,s){return tc(t,n,i,s).length===0?"":Io(Wx(e,t,e,t-Ei(t,i),!1,i).length,Do("D",s))}function tc(e,t,r,n){let i=e-Ei(e,r),s=t-Ei(t,r),o=Math.abs(i-s)-lP(e,t,r);return Io(o,Do($x(e,t),n))}function oP(e,t,r,n,i,s){let o;tc(t,n,i,s).length>0?o=n-Ei(n,i):o=t;let l=n,a=aP(e,t,r,n,i,s);return Io(Wx(e,o,r,l,a==="C",i).length,Do(a,s))}function lP(e,t,r){var o;let n=0,i=e-Ei(e,r),s=t-Ei(t,r);for(let l=0;l<Math.abs(i-s);l++){let a=$x(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&n++}return n}function Ei(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 aP(e,t,r,n,i,s){let o;return tc(r,n,i,s).length>0?o=n-Ei(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function $x(e,t){return e>t?"A":"B"}function Wx(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 Do(e,t){let r=t?"O":"[";return Y.ESC+r+e}function Io(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var cP=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 Rg(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 tu=50,uP=15,hP=50,dP=500,fP=" ",pP=new RegExp(fP,"g"),Kh=class extends Te{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 Tr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new se),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 cP(this._bufferService),this._activeSelectionMode=0,this._register(Ue(()=>{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(pP," ")).join(Ox?`\r
131
131
  `:`
132
132
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Pf&&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=Rg(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=Lf(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,-tu),tu),t/=tu,t/Math.abs(t)+Math.round(t*(uP-1)))}shouldForceSelection(e){return ka?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(),hP)}_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&&!(ka&&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<dP&&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=rP(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 S=e[0],_=e[0];s.getWidth(S)===0&&(d++,S--),s.getWidth(_)===2&&(u++,_++);let y=s.getString(_).length;for(y>1&&(p+=y-1,a+=y-1);S>0&&l>0&&!this._isCharWordSeparator(s.loadCell(S-1,this._workCell));){s.loadCell(S-1,this._workCell);let x=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,S--):x>1&&(f+=x-1,l-=x-1),l--,S--}for(;_<s.length&&a+1<o.length&&!this._isCharWordSeparator(s.loadCell(_+1,this._workCell));){s.loadCell(_+1,this._workCell);let x=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,_++):x>1&&(p+=x-1,a+=x-1),a++,_++}}a++;let m=l+c-d+f,g=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 S=i.lines.get(e[1]-1);if(S&&s.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let _=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(_){let y=this._bufferService.cols-_.start;m-=y,g+=y}}}if(n&&m+g===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let S=i.lines.get(e[1]+1);if(S!=null&&S.isWrapped&&S.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(g+=_.length)}}return{start:m,length:g}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Rg(r,this._bufferService.cols)}};Kh=et([he(3,Ut),he(4,Di),he(5,Sf),he(6,Vt),he(7,wn),he(8,xn)],Kh);var Mg=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={}}},Ag=class{constructor(){this._color=new Mg,this._css=new Mg}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()}},ct=Object.freeze((()=>{let e=[qe.toColor("#2e3436"),qe.toColor("#cc0000"),qe.toColor("#4e9a06"),qe.toColor("#c4a000"),qe.toColor("#3465a4"),qe.toColor("#75507b"),qe.toColor("#06989a"),qe.toColor("#d3d7cf"),qe.toColor("#555753"),qe.toColor("#ef2929"),qe.toColor("#8ae234"),qe.toColor("#fce94f"),qe.toColor("#729fcf"),qe.toColor("#ad7fa8"),qe.toColor("#34e2e2"),qe.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:ot.toCss(n,i,s),rgba:ot.toRgba(n,i,s)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:ot.toCss(n,n,n),rgba:ot.toRgba(n,n,n)})}return e})()),ai=qe.toColor("#ffffff"),Us=qe.toColor("#000000"),jg=qe.toColor("#ffffff"),Bg=Us,As={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},mP=ai,qh=class extends Te{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ag,this._halfContrastCache=new Ag,this._onChangeColors=this._register(new se),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ai,background:Us,cursor:jg,cursorAccent:Bg,selectionForeground:void 0,selectionBackgroundTransparent:As,selectionBackgroundOpaque:$e.blend(Us,As),selectionInactiveBackgroundTransparent:As,selectionInactiveBackgroundOpaque:$e.blend(Us,As),scrollbarSliderBackground:$e.opacity(ai,.2),scrollbarSliderHoverBackground:$e.opacity(ai,.4),scrollbarSliderActiveBackground:$e.opacity(ai,.5),overviewRulerBorder:ai,ansi:ct.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Ae(e.foreground,ai),t.background=Ae(e.background,Us),t.cursor=$e.blend(t.background,Ae(e.cursor,jg)),t.cursorAccent=$e.blend(t.background,Ae(e.cursorAccent,Bg)),t.selectionBackgroundTransparent=Ae(e.selectionBackground,As),t.selectionBackgroundOpaque=$e.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ae(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=$e.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ae(e.selectionForeground,Pg):void 0,t.selectionForeground===Pg&&(t.selectionForeground=void 0),$e.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=$e.opacity(t.selectionBackgroundTransparent,.3)),$e.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=$e.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ae(e.scrollbarSliderBackground,$e.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ae(e.scrollbarSliderHoverBackground,$e.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ae(e.scrollbarSliderActiveBackground,$e.opacity(t.foreground,.5)),t.overviewRulerBorder=Ae(e.overviewRulerBorder,mP),t.ansi=ct.slice(),t.ansi[0]=Ae(e.black,ct[0]),t.ansi[1]=Ae(e.red,ct[1]),t.ansi[2]=Ae(e.green,ct[2]),t.ansi[3]=Ae(e.yellow,ct[3]),t.ansi[4]=Ae(e.blue,ct[4]),t.ansi[5]=Ae(e.magenta,ct[5]),t.ansi[6]=Ae(e.cyan,ct[6]),t.ansi[7]=Ae(e.white,ct[7]),t.ansi[8]=Ae(e.brightBlack,ct[8]),t.ansi[9]=Ae(e.brightRed,ct[9]),t.ansi[10]=Ae(e.brightGreen,ct[10]),t.ansi[11]=Ae(e.brightYellow,ct[11]),t.ansi[12]=Ae(e.brightBlue,ct[12]),t.ansi[13]=Ae(e.brightMagenta,ct[13]),t.ansi[14]=Ae(e.brightCyan,ct[14]),t.ansi[15]=Ae(e.brightWhite,ct[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]=Ae(e.extendedAnsi[n],ct[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()}}};qh=et([he(0,Vt)],qh);function Ae(e,t){if(e!==void 0)try{return qe.toColor(e)}catch{}return t}var gP=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)}},_P=class{constructor(){this._services=new gP,this._services.set(wf,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=u3(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)}},vP={trace:0,debug:1,info:2,warn:3,error:4,off:5},yP="xterm.js: ",Yh=class extends Te{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=vP[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?"":yP)+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)}};Yh=et([he(0,Vt)],Yh);var Og=class extends Te{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new se),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new se),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new se),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}},Ne=3,st=Object.freeze(new Vo),Sl=0,ru=2,Vs=class Hx{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ne);let i=r||Tr.fromCharData([0,ax,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let r=this._data[t*Ne+0],n=r&2097151;return[this._data[t*Ne+1],r&2097152?this._combined[t]:n?Pn(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*Ne+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Ne+0]=t|2097152|r[2]<<22):this._data[t*Ne+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Ne+0]>>22}hasWidth(t){return this._data[t*Ne+0]&12582912}getFg(t){return this._data[t*Ne+1]}getBg(t){return this._data[t*Ne+2]}hasContent(t){return this._data[t*Ne+0]&4194303}getCodePoint(t){let r=this._data[t*Ne+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Ne+0]&2097152}getString(t){let r=this._data[t*Ne+0];return r&2097152?this._combined[t]:r&2097151?Pn(r&2097151):""}isProtected(t){return this._data[t*Ne+2]&536870912}loadCell(t,r){return Sl=t*Ne,r.content=this._data[Sl+0],r.fg=this._data[Sl+1],r.bg=this._data[Sl+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*Ne+0]=r.content,this._data[t*Ne+1]=r.fg,this._data[t*Ne+2]=r.bg}setCellFromCodepoint(t,r,n,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Ne+0]=r|n<<22,this._data[t*Ne+1]=i.fg,this._data[t*Ne+2]=i.bg}addCodepointToCell(t,r,n){let i=this._data[t*Ne+0];i&2097152?this._combined[t]+=Pn(r):i&2097151?(this._combined[t]=Pn(i&2097151)+Pn(r),i&=-2097152,i|=2097152):i=r|1<<22,n&&(i&=-12582913,i|=n<<22),this._data[t*Ne+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 Tr;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 Tr;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*ru<this._data.buffer.byteLength;let n=t*Ne;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*ru<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*ru<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 Hx(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*Ne+0]&4194303)return t+(this._data[t*Ne+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ne+0]&4194303||this._data[t*Ne+2]&50331648)return t+(this._data[t*Ne+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<Ne;c++)this._data[(n+a)*Ne+c]=o[(r+a)*Ne+c];o[(r+a)*Ne+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}else for(let a=0;a<i;a++){for(let c=0;c<Ne;c++)this._data[(n+a)*Ne+c]=o[(r+a)*Ne+c];o[(r+a)*Ne+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*Ne+0],l=o&2097151,a=o&2097152?this._combined[r]:l?Pn(l):jn;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 xP(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=Ro(d,u,t),p=1,m=0;for(;p<d.length;){let S=Ro(d,p,t),_=S-m,y=r-f,x=Math.min(_,y);d[u].copyCellsFrom(d[p],m,f,x,!1),f+=x,f===r&&(u++,f=0),m+=x,m===S&&(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 g=0;for(let S=d.length-1;S>0&&(S>u||d[S].getTrimmedLength()===0);S--)g++;g>0&&(o.push(l+d.length-g),o.push(g)),l+=d.length-1}return o}function wP(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 SP(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 bP(e,t,r){let n=[],i=e.map((a,c)=>Ro(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=Ro(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 Ro(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 Ux=class Vx{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Vx._nextId++,this._onDispose=this.register(new se),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ci(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Ux._nextId=1;var kP=Ux,ft={},ci=ft.B;ft[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ft.A={"#":"£"};ft.B=void 0;ft[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ft.C=ft[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ft.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ft.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ft.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ft.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ft.E=ft[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ft.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ft.H=ft[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ft["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var zg=4294967295,Fg=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=st.clone(),this.savedCharset=ci,this.markers=[],this._nullCell=Tr.fromCharData([0,ax,1,0]),this._whitespaceCell=Tr.fromCharData([0,jn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ca,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Og(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 Vs(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>zg?zg:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=st);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 Og(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(st),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 Vs(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 Vs(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=xP(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(st),r);if(n.length>0){let i=wP(this.lines,n);SP(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(st),i=r;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Vs(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(st),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 x=this.ybase+this.y;if(x>=o&&x<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),d=bP(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 x=0;x<u;x++){let N=this.getBlankLine(st,!0);p.push(N)}p.length>0&&(i.push({start:o+a.length+s,newLines:p}),s+=p.length),a.push(...p);let m=d.length-1,g=d[m];g===0&&(m--,g=d[m]);let S=a.length-u-1,_=c;for(;S>=0;){let x=Math.min(_,g);if(a[m]===void 0)break;if(a[m].copyCellsFrom(a[S],_-x,g-x,x,!0),g-=x,g===0&&(m--,g=d[m]),_-=x,_===0){S--;let N=Math.max(S,0);_=Ro(a,N,this._cols)}}for(let x=0;x<a.length;x++)d[x]<e&&a[x].setCell(d[x],n);let y=u-f;for(;y-- >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 g=0;g<this.lines.length;g++)l.push(this.lines.get(g));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 g=Math.min(this.lines.maxLength-1,a+s-1);g>=0;g--)if(u&&u.start>c+f){for(let S=u.newLines.length-1;S>=0;S--)this.lines.set(g--,u.newLines[S]);g++,o.push({index:c+1,amount:u.newLines.length}),f+=u.newLines.length,u=i[++d]}else this.lines.set(g,l[c--]);let p=0;for(let g=o.length-1;g>=0;g--)o[g].index+=p,this.lines.onInsertEmitter.fire(o[g]),p+=o[g].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 kP(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)}},CP=class extends Te{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new se),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 Fg(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Fg(!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)}},Kx=2,qx=1,Xh=class extends Te{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Kx),this.rows=Math.max(e.rawOptions.rows||0,qx),this.buffers=this._register(new CP(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))}};Xh=et([he(0,Vt)],Xh);var Ai={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:ka,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},EP=["normal","bold","100","200","300","400","500","600","700","800","900"],NP=class extends Te{constructor(e){super(),this._onOptionChange=this._register(new se),this.onOptionChange=this._onOptionChange.event;let t={...Ai};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(Ue(()=>{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 Ai))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in Ai))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=Ai[e]),!TP(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ai[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=EP.includes(t)?t:Ai[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 TP(e){return e==="block"||e==="underline"||e==="bar"}function Ks(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]&&Ks(e[n],t-1);return r}var $g=Object.freeze({insertMode:!1}),Wg=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Gh=class extends Te{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 se),this.onData=this._onData.event,this._onUserInput=this._register(new se),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new se),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ks($g),this.decPrivateModes=Ks(Wg)}reset(){this.modes=Ks($g),this.decPrivateModes=Ks(Wg)}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))}};Gh=et([he(0,Ut),he(1,fx),he(2,Vt)],Gh);var Hg={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 nu(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 iu=String.fromCharCode,Ug={DEFAULT:e=>{let t=[nu(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${iu(t[0])}${iu(t[1])}${iu(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nu(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nu(e,!0)};${e.x};${e.y}${t}`}},Qh=class extends Te{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 se),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(Hg))this.addProtocol(n,Hg[n]);for(let n of Object.keys(Ug))this.addEncoding(n,Ug[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)}};Qh=et([he(0,Ut),he(1,Di),he(2,Vt)],Qh);var su=[[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]],LP=[[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]],ut;function PP(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 DP=class{constructor(){if(this.version="6",!ut){ut=new Uint8Array(65536),ut.fill(1),ut[0]=0,ut.fill(0,1,32),ut.fill(0,127,160),ut.fill(2,4352,4448),ut[9001]=2,ut[9002]=2,ut.fill(2,11904,42192),ut[12351]=1,ut.fill(2,44032,55204),ut.fill(2,63744,64256),ut.fill(2,65040,65050),ut.fill(2,65072,65136),ut.fill(2,65280,65377),ut.fill(2,65504,65511);for(let e=0;e<su.length;++e)ut.fill(0,su[e][0],su[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ut[e]:PP(e,LP)?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=pi.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return pi.createPropertyValue(0,r,n)}},pi=class Hl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new se,this.onChange=this._onChange.event;let t=new DP;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=Hl.extractWidth(l);Hl.extractShouldJoin(l)&&(a-=Hl.extractWidth(n)),r+=a,n=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},IP=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 Vg(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 js=2147483647,RP=256,Yx=class Zh{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>RP)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 Zh;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 Zh(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>js?js: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>js?js: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,js):t}},Bs=[],MP=class{constructor(){this._state=0,this._active=Bs,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=Bs}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=Bs,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Bs,!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",Za(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=Bs,this._id=-1,this._state=0}}},sr=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+=Za(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}},Os=[],AP=class{constructor(){this._handlers=Object.create(null),this._active=Os,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Os}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=Os,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Os,!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",Za(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=Os,this._ident=0}},qs=new Yx;qs.addParam(0);var Kg=class{constructor(e){this._handler=e,this._data="",this._params=qs,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():qs,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Za(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=qs,this._data="",this._hitLimit=!1,r));return this._params=qs,this._data="",this._hitLimit=!1,t}},jP=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}},Sr=160,BP=function(){let e=new jP(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(Sr,0,2,0),e.add(Sr,8,5,8),e.add(Sr,6,0,6),e.add(Sr,11,0,11),e.add(Sr,13,13,13),e}(),OP=class extends Te{constructor(e=BP){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 Yx,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(Ue(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new MP),this._dcsParser=this._register(new AP),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:Sr)],i>>4){case 2:for(let f=l+1;;++f){if(f>=t||(n=e[f])<32||n>126&&n<Sr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Sr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Sr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Sr){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<Sr){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<Sr){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}}},zP=/^([\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})$/,FP=/^[\da-f]+$/;function qg(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=zP.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),FP.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 ou(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 $P(e,t=16){let[r,n,i]=e;return`rgb:${ou(r,t)}/${ou(n,t)}/${ou(i,t)}`}var WP={"(":0,")":1,"*":2,"+":3,"-":1,".":2},En=131072,Yg=10;function Xg(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 Gg=5e3,Qg=0,HP=class extends Te{constructor(e,t,r,n,i,s,o,l,a=new OP){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 a3,this._utf8Decoder=new c3,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=st.clone(),this._eraseAttrDataInternal=st.clone(),this._onRequestBell=this._register(new se),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new se),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new se),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new se),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new se),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new se),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new se),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new se),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new se),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 Jh(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(Y.BEL,()=>this.bell()),this._parser.setExecuteHandler(Y.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Y.BS,()=>this.backspace()),this._parser.setExecuteHandler(Y.HT,()=>this.tab()),this._parser.setExecuteHandler(Y.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Y.SI,()=>this.shiftIn()),this._parser.setExecuteHandler($l.IND,()=>this.index()),this._parser.setExecuteHandler($l.NEL,()=>this.nextLine()),this._parser.setExecuteHandler($l.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new sr(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new sr(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new sr(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new sr(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new sr(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new sr(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new sr(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new sr(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new sr(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new sr(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new sr(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new sr(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 ft)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 Kg((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"),Gg))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Gg} 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>En&&(s=this._parseStack.position+En)}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<En&&(this._parseBuffer=new Uint32Array(Math.min(e.length,En))),o||this._dirtyRowTracker.clearRange(),e.length>En)for(let c=s;c<e.length;c+=En){let d=c+En<e.length?c+En: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 _=s[String.fromCharCode(n)];_&&(n=_.charCodeAt(0))}let m=this._unicodeService.charProperties(n,f);i=pi.extractWidth(m);let g=pi.extractShouldJoin(m),S=g?pi.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire(Pn(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-S>l){if(a){let _=u,y=this._activeBuffer.x-S;for(this._activeBuffer.x=S,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),S>0&&u instanceof Vs&&u.copyCellsFrom(_,y,0,S,!1);y<l;)_.setCellFromCodepoint(y++,0,1,d)}else if(this._activeBuffer.x=l-1,i===2)continue}if(g&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,n,i);for(let y=i-S;--y>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(u.insertCells(this._activeBuffer.x,i-S,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=>Xg(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Kg(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new sr(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(st));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=pi.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(Y.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Y.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Y.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Y.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Y.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,ci),this._charsetService.setgCharset(1,ci),this._charsetService.setgCharset(2,ci),this._charsetService.setgCharset(3,ci);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let 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=(g,S)=>(o.triggerDataEvent(`${Y.ESC}[${t?"":"?"}${g};${S}$y`),!0),p=g=>g?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|=Vo.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=st.fg,e.bg=st.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|=st.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=st.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|=st.fg&16777215,n.bg&=-67108864,n.bg|=st.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Y.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Y.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(`${Y.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=st.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(!Xg(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(`${Y.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Yg&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Yg&&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(Zg(s))if(i==="?")t.push({type:0,index:s});else{let o=qg(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=qg(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]);Zg(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,ci),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(WP[e[0]],ft[e[1]]||ci),!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=st.clone(),this._eraseAttrDataInternal=st.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 Tr;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(`${Y.ESC}${o}${Y.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)}},Jh=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&&(Qg=e,e=t,t=Qg),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Jh=et([he(0,Ut)],Jh);function Zg(e){return 0<=e&&e<256}var UP=5e7,Jg=12,VP=50,KP=class extends Te{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 se),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>UP)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>=Jg?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>=Jg)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>VP&&(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()}},ed=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)))}};ed=et([he(0,Ut)],ed);var e_=!1,qP=class extends Te{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new hs),this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onData=this._register(new se),this.onData=this._onData.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new se),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new se),this._instantiationService=new _P,this.optionsService=this._register(new NP(e)),this._instantiationService.setService(Vt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Xh)),this._instantiationService.setService(Ut,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Yh)),this._instantiationService.setService(fx,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Gh)),this._instantiationService.setService(Di,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Qh)),this._instantiationService.setService(dx,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(pi)),this._instantiationService.setService(f3,this.unicodeService),this._charsetService=this._instantiationService.createInstance(IP),this._instantiationService.setService(d3,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ed),this._instantiationService.setService(px,this._oscLinkService),this._inputHandler=this._register(new HP(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Nt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Nt.forward(this._bufferService.onResize,this._onResize)),this._register(Nt.forward(this.coreService.onData,this._onData)),this._register(Nt.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 KP((t,r)=>this._inputHandler.parse(t,r))),this._register(Nt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new se),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&&!e_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),e_=!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,Kx),t=Math.max(t,qx),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(Vg.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Vg(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ue(()=>{for(let t of e)t.dispose()})}}},YP={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 XP(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=Y.ESC+"OA":i.key=Y.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=Y.ESC+"OD":i.key=Y.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=Y.ESC+"OC":i.key=Y.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=Y.ESC+"OB":i.key=Y.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":Y.DEL,e.altKey&&(i.key=Y.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Y.ESC+"[Z";break}i.key=Y.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Y.ESC+Y.CR:Y.CR,i.cancel=!0;break;case 27:i.key=Y.ESC,e.altKey&&(i.key=Y.ESC+Y.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=Y.ESC+"[1;"+(s+1)+"D":t?i.key=Y.ESC+"OD":i.key=Y.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=Y.ESC+"[1;"+(s+1)+"C":t?i.key=Y.ESC+"OC":i.key=Y.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=Y.ESC+"[1;"+(s+1)+"A":t?i.key=Y.ESC+"OA":i.key=Y.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=Y.ESC+"[1;"+(s+1)+"B":t?i.key=Y.ESC+"OB":i.key=Y.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Y.ESC+"[2~");break;case 46:s?i.key=Y.ESC+"[3;"+(s+1)+"~":i.key=Y.ESC+"[3~";break;case 36:s?i.key=Y.ESC+"[1;"+(s+1)+"H":t?i.key=Y.ESC+"OH":i.key=Y.ESC+"[H";break;case 35:s?i.key=Y.ESC+"[1;"+(s+1)+"F":t?i.key=Y.ESC+"OF":i.key=Y.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Y.ESC+"[5;"+(s+1)+"~":i.key=Y.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Y.ESC+"[6;"+(s+1)+"~":i.key=Y.ESC+"[6~";break;case 112:s?i.key=Y.ESC+"[1;"+(s+1)+"P":i.key=Y.ESC+"OP";break;case 113:s?i.key=Y.ESC+"[1;"+(s+1)+"Q":i.key=Y.ESC+"OQ";break;case 114:s?i.key=Y.ESC+"[1;"+(s+1)+"R":i.key=Y.ESC+"OR";break;case 115:s?i.key=Y.ESC+"[1;"+(s+1)+"S":i.key=Y.ESC+"OS";break;case 116:s?i.key=Y.ESC+"[15;"+(s+1)+"~":i.key=Y.ESC+"[15~";break;case 117:s?i.key=Y.ESC+"[17;"+(s+1)+"~":i.key=Y.ESC+"[17~";break;case 118:s?i.key=Y.ESC+"[18;"+(s+1)+"~":i.key=Y.ESC+"[18~";break;case 119:s?i.key=Y.ESC+"[19;"+(s+1)+"~":i.key=Y.ESC+"[19~";break;case 120:s?i.key=Y.ESC+"[20;"+(s+1)+"~":i.key=Y.ESC+"[20~";break;case 121:s?i.key=Y.ESC+"[21;"+(s+1)+"~":i.key=Y.ESC+"[21~";break;case 122:s?i.key=Y.ESC+"[23;"+(s+1)+"~":i.key=Y.ESC+"[23~";break;case 123:s?i.key=Y.ESC+"[24;"+(s+1)+"~":i.key=Y.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=Y.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Y.DEL:e.keyCode===219?i.key=Y.ESC:e.keyCode===220?i.key=Y.FS:e.keyCode===221&&(i.key=Y.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let l=(o=YP[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=Y.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=Y.ESC+c}else if(e.keyCode===32)i.key=Y.ESC+(e.ctrlKey?Y.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),i.key=Y.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=Y.US),e.key==="@"&&(i.key=Y.NUL));break}return i}var tt=0,GP=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ca,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ca,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||(tt=this._search(t),tt===-1)||this._getKey(this._array[tt])!==t)return!1;do if(this._array[tt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(tt),!0;while(++tt<this._array.length&&this._getKey(this._array[tt])===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&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do yield this._array[tt];while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do t(this._array[tt]);while(++tt<this._array.length&&this._getKey(this._array[tt])===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}},lu=0,t_=0,QP=class extends Te{constructor(){super(),this._decorations=new GP(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new se),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new se),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ue(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new ZP(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=>{lu=i.options.x??0,t_=lu+(i.options.width??1),e>=lu&&e<t_&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},ZP=class extends Vn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new se),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new se),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=qe.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=qe.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},JP=1e3,e4=class{constructor(e,t=JP){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)}},r_=20,Ea=class extends Te{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 e4(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(`
133
133
  `))),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(ke(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ue(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<r_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
@@ -154,7 +154,7 @@ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){t
154
154
  * Fabrice Bellard's javascript vt100 for jslinux:
155
155
  * http://bellard.org/jslinux/
156
156
  * Copyright (c) 2011 Fabrice Bellard
157
- */var p4=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let r=g4.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 m4(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 g4=class Ul{static computeLink(t,r,n,i){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=Ul._getWindowedLineStrings(t-1,n),a=o.join(""),c,d=[];for(;c=s.exec(a);){let u=c[0];if(!m4(u))continue;let[f,p]=Ul._mapStrIdx(n,l,0,c.index),[m,g]=Ul._mapStrIdx(n,f,p,u.length);if(f===-1||p===-1||m===-1||g===-1)continue;let S={start:{x:p+1,y:f+1},end:{x:g,y:m+1}};d.push({range:S,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]}},_4=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function v4(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 y4=class{constructor(e=v4,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||_4;this._linkProvider=this._terminal.registerLinkProvider(new p4(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const i_={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"},Xx=w.forwardRef(({onInput:e,onResize:t,fontSize:r=13},n)=>{const i=w.useRef(null),s=w.useRef(null),o=w.useRef(null),[l,a]=w.useState(!1);return w.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{}}})),w.useEffect(()=>{if(!i.current)return;const c=new u4({cursorBlink:!0,cursorStyle:"bar",fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:i_,allowTransparency:!0,scrollback:5e3,convertEol:!1}),d=new f4,u=new y4;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:i_.background,opacity:l?1:0}})});Xx.displayName="CliTerminal";function s_({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 o_({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 x4({screenshot:e,isCapturing:t,onRefresh:r,onAction:n,addLog:i,connState:s,connScreenshot:o}){const l=w.useRef(null),a=w.useRef(null),c=w.useRef(null),[d,u]=w.useState(!0),[f,p]=w.useState(2e3),[m,g]=w.useState(null),[S,_]=w.useState(""),[,y]=w.useState(!1),[x,N]=w.useState(!1),[T,C]=w.useState(!1),M=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[F,$]=w.useState(M?"mouse":"touch"),[E,U]=w.useState(1),[j,A]=w.useState(0),[V,D]=w.useState(0),O=w.useRef(0),K=w.useRef(t),I=w.useRef(r),H=w.useRef(n),b=w.useRef(null),te=w.useRef(null),ae=w.useRef(!1),k=w.useRef(null),ye=w.useRef(0),G=w.useRef(null),Z=w.useRef(1),X=w.useRef({x:0,y:0}),ce=w.useRef(E),me=w.useRef(j),fe=w.useRef(V),xe=w.useRef(F);w.useEffect(()=>{K.current=t},[t]),w.useEffect(()=>{I.current=r},[r]),w.useEffect(()=>{ce.current=E},[E]),w.useEffect(()=>{me.current=j},[j]),w.useEffect(()=>{fe.current=V},[V]),w.useEffect(()=>{H.current=n},[n]),w.useEffect(()=>{xe.current=F},[F]),w.useEffect(()=>{var ee;(ee=l.current)==null||ee.focus()},[]);const B=s==="connected",Ce=s!=="connected"&&s!=="connecting",Qe=B&&o?o:e;w.useEffect(()=>{E<=1&&(A(0),D(0))},[E]);const pt=(ee,ge,R)=>{if(R<=1)return{x:0,y:0};const q=(R-1)/(2*R)*100,de=(R-1)/(2*R)*100;return{x:Math.max(-q,Math.min(q,ee)),y:Math.max(-de,Math.min(de,ge))}};w.useEffect(()=>{if(!d||!Ce)return;let ee=null;const ge=()=>{ee&&clearInterval(ee),!document.hidden&&(ee=setInterval(()=>{var q;if(!K.current){const de=((q=l.current)==null?void 0:q.clientWidth)||0,P=Math.max(400,Math.ceil(de/100)*100);I.current(P)}},f))},R=()=>{document.hidden?(ee&&clearInterval(ee),ee=null):ge()};return ge(),document.addEventListener("visibilitychange",R),()=>{ee&&clearInterval(ee),document.removeEventListener("visibilitychange",R)}},[d,Ce,f]);const mr=(ee,ge)=>{if(!c.current)return null;const R=c.current.getBoundingClientRect();return!R.width||!R.height?null:{nx:Math.max(0,Math.min(1,(ee-R.left)/R.width)),ny:Math.max(0,Math.min(1,(ge-R.top)/R.height))}},gr=async ee=>{var R;const ge=mr(ee.clientX,ee.clientY);if(ge){g(`Click: ${Math.round(ge.nx*100)}%, ${Math.round(ge.ny*100)}%`),(R=l.current)==null||R.focus();try{const q=await n("input_click",{nx:ge.nx,ny:ge.ny});q!=null&&q.success||i(`❌ Click failed: ${q==null?void 0:q.error}`)}catch(q){i(`❌ Click error: ${q.message||q}`)}}},Dr=async(ee,ge,R,q=0)=>{try{await n("input_key",{type:R?"char":"keyDown",key:ee,code:ge,text:R?ee:void 0,unmodifiedText:R?ee:void 0,modifiers:q})}catch(de){i(`❌ Key error: ${de.message||de}`)}},_r=async ee=>{if(ee.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(ee.key)&&ee.preventDefault();let R=0;ee.altKey&&(R|=1),ee.ctrlKey&&(R|=2),ee.metaKey&&(R|=4),ee.shiftKey&&(R|=8),g(`Key: ${ee.key}`),await Dr(ee.key,ee.code,ee.key.length===1,R)},nn=async ee=>{if(ee.key==="Enter"){if(ee.nativeEvent.isComposing)return;if(S){const ge=S;_(""),g(`IME Sent: ${ge}`);try{const R=await n("input_type",{text:ge});R!=null&&R.success||i(`❌ IME error: ${R==null?void 0:R.error}`)}catch(R){i(`❌ IME error: ${R.message}`)}}else g("Key: Enter"),await Dr("Enter","Enter",!1)}};w.useEffect(()=>{const ee=l.current;if(!ee)return;const ge=R=>{var q;if((q=c.current)!=null&&q.contains(R.target)){R.preventDefault();const de=Date.now();if(de-O.current<40)return;O.current=de;const P=mr(R.clientX,R.clientY);if(!P)return;g(`Scroll: ${Math.round(R.deltaY)}`),n("input_wheel",{nx:P.nx,ny:P.ny,deltaX:Math.round(R.deltaX),deltaY:Math.round(R.deltaY)}).catch(()=>{})}};return ee.addEventListener("wheel",ge,{passive:!1}),()=>ee.removeEventListener("wheel",ge)},[n]);const[rr,kt]=w.useState(null),mt=w.useRef(null);return w.useEffect(()=>{if(F==="mouse"&&!mt.current){const ee={nx:.5,ny:.5};mt.current=ee,kt(ee)}},[F]),w.useEffect(()=>{const ee=l.current;if(!ee)return;const ge=W=>{if(!c.current)return null;const Q=c.current.getBoundingClientRect();return!Q.width||!Q.height?null:{nx:Math.max(0,Math.min(1,(W.clientX-Q.left)/Q.width)),ny:Math.max(0,Math.min(1,(W.clientY-Q.top)/Q.height))}},R=(W,Q)=>{if(!c.current)return{dnx:0,dny:0};const J=c.current,le=J.getBoundingClientRect(),ue=J.naturalWidth||le.width,ie=J.naturalHeight||le.height,_e=ue/ie,we=le.width/le.height;let Le,be;return _e>we?(Le=le.width,be=le.width/_e):(be=le.height,Le=le.height*_e),{dnx:W/Le,dny:Q/be}},q=(W,Q,J)=>{if(J<=1.05)return;const le=-(W-.5)*100,ue=-(Q-.5)*100,ie=pt(le,ue,J);(Math.abs(ie.x-me.current)>.1||Math.abs(ie.y-fe.current)>.1)&&(A(ie.x),D(ie.y),me.current=ie.x,fe.current=ie.y)},de=W=>{if(W.preventDefault(),W.touches.length===1){const Q=W.touches[0];b.current={x:Q.clientX,y:Q.clientY,time:Date.now()},te.current={x:Q.clientX,y:Q.clientY},ae.current=!1,k.current=setTimeout(()=>{if(!ae.current)if(ae.current=!0,xe.current==="mouse"){const J=mt.current||{nx:.5,ny:.5};g("Right Click"),H.current("input_click",{...J,button:"right"}).catch(()=>{})}else{const J=ge(Q);J&&(g("Right Click"),H.current("input_click",{...J,button:"right"}).catch(()=>{}))}},500)}else if(W.touches.length===2){clearTimeout(k.current),ae.current=!0;const Q=W.touches[1].clientX-W.touches[0].clientX,J=W.touches[1].clientY-W.touches[0].clientY;G.current=Math.sqrt(Q*Q+J*J),Z.current=ce.current,X.current={x:(W.touches[0].clientX+W.touches[1].clientX)/2,y:(W.touches[0].clientY+W.touches[1].clientY)/2}}},P=W=>{if(W.preventDefault(),W.touches.length===1&&te.current){const Q=W.touches[0],J=Q.clientX-te.current.x,le=Q.clientY-te.current.y;if(!ae.current&&(Math.abs(J)>10||Math.abs(le)>10)&&(ae.current=!0,clearTimeout(k.current)),ae.current)if(xe.current==="mouse"){const ue=R(J,le),ie=mt.current||{nx:.5,ny:.5},_e=Math.max(0,Math.min(1,ie.nx+ue.dnx)),we=Math.max(0,Math.min(1,ie.ny+ue.dny));mt.current={nx:_e,ny:we},kt({nx:_e,ny:we}),g(`Cursor: ${Math.round(_e*100)}%, ${Math.round(we*100)}%`),q(_e,we,ce.current);const Le=Date.now();Le-O.current>=30&&(O.current=Le,H.current("input_mouseMoved",{nx:_e,ny:we}).catch(()=>{}))}else if(ce.current>1){const ue=a.current;if(ue){const ie=ue.clientWidth,_e=ue.clientHeight,we=me.current+J/ie*100,Le=fe.current+le/_e*100,be=pt(we,Le,ce.current);A(be.x),D(be.y),me.current=be.x,fe.current=be.y}}else{const ue=ge(Q);if(ue){const ie=Date.now();ie-O.current>=40&&(O.current=ie,g("Scroll"),H.current("input_wheel",{nx:ue.nx,ny:ue.ny,deltaX:Math.round(-J*2.5),deltaY:Math.round(-le*2.5)}).catch(()=>{}))}}te.current={x:Q.clientX,y:Q.clientY}}else if(W.touches.length===2&&G.current!==null){const Q=W.touches[1].clientX-W.touches[0].clientX,J=W.touches[1].clientY-W.touches[0].clientY,ue=Math.sqrt(Q*Q+J*J)/G.current,ie=(W.touches[0].clientX+W.touches[1].clientX)/2,_e=(W.touches[0].clientY+W.touches[1].clientY)/2,we=ie-X.current.x,Le=_e-X.current.y,be=Math.abs(ue-1)>.03;if(xe.current==="mouse"){if(be){const nt=Math.max(.5,Math.min(5,Z.current*ue));U(nt),ce.current=nt}else if(Math.abs(we)>2||Math.abs(Le)>2){const nt=mt.current||{nx:.5,ny:.5},gt=Date.now();gt-O.current>=30&&(O.current=gt,g("Scroll"),H.current("input_wheel",{nx:nt.nx,ny:nt.ny,deltaX:Math.round(-we*3),deltaY:Math.round(-Le*3)}).catch(()=>{}))}}else{const nt=Math.max(.5,Math.min(5,Z.current*ue));U(nt),ce.current=nt;const gt=a.current;if(gt&&nt>1){const vr=gt.clientWidth,Xo=gt.clientHeight,rc=me.current+we/vr*100,nc=fe.current+Le/Xo*100,Jn=pt(rc,nc,nt);A(Jn.x),D(Jn.y),me.current=Jn.x,fe.current=Jn.y}}X.current={x:ie,y:_e}}},L=W=>{var Q;if(clearTimeout(k.current),G.current=null,W.touches.length===0&&W.changedTouches.length===1&&!ae.current){const J=W.changedTouches[0],le=Date.now();if(le-(((Q=b.current)==null?void 0:Q.time)||0)<40)return;if(xe.current==="mouse"){const ie=mt.current||ge(J);ie&&(g(`Click: ${Math.round(ie.nx*100)}%, ${Math.round(ie.ny*100)}%`),H.current("input_click",{...ie}).catch(()=>{}))}else{const ie=ge(J);if(!ie)return;le-ye.current<300?(g("Double tap"),H.current("input_click",{...ie,clickCount:2}).catch(()=>{}),ye.current=0):(g(`Tap: ${Math.round(ie.nx*100)}%, ${Math.round(ie.ny*100)}%`),H.current("input_click",{...ie}).catch(()=>{}),ye.current=le)}}ae.current=!1};return ee.addEventListener("touchstart",de,{passive:!1}),ee.addEventListener("touchmove",P,{passive:!1}),ee.addEventListener("touchend",L,{passive:!1}),()=>{ee.removeEventListener("touchstart",de),ee.removeEventListener("touchmove",P),ee.removeEventListener("touchend",L),clearTimeout(k.current)}},[]),h.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:_r,onContextMenu:ee=>ee.preventDefault(),onFocus:()=>y(!0),onBlur:()=>y(!1),tabIndex:0,children:[h.jsxs("div",{ref:a,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[Qe?h.jsx("img",{ref:c,src:Qe,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${E}) translate(${j}%, ${V}%)`,transformOrigin:"center center",cursor:F==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:gr,onContextMenu:ee=>ee.preventDefault(),onDragStart:ee=>ee.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..."})]}),F==="mouse"&&rr&&Qe&&c.current&&(()=>{var Le;const ee=c.current,ge=ee.getBoundingClientRect(),R=(Le=a.current)==null?void 0:Le.getBoundingClientRect();if(!R)return null;const q=ee.naturalWidth||ge.width,de=ee.naturalHeight||ge.height,P=q/de,L=ge.width/ge.height;let W,Q,J,le;P>L?(W=ge.width,Q=ge.width/P,J=0,le=(ge.height-Q)/2):(Q=ge.height,W=ge.height*P,J=(ge.width-W)/2,le=0);const ue=ge.left-R.left+J+W*rr.nx,ie=ge.top-R.top+le+Q*rr.ny,_e=Math.max(8,Math.min(R.width-8,ue)),we=Math.max(8,Math.min(R.height-8,ie));return h.jsxs("div",{style:{position:"absolute",left:_e-8,top:we-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)"}})]})})()]}),h.jsxs("div",{onTouchStart:ee=>ee.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:()=>{$(ee=>{const ge=ee==="touch"?"mouse":"touch";if(ge==="mouse"&&!mt.current){const R={nx:.5,ny:.5};mt.current=R,kt(R)}return ge})},className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${F==="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:F==="mouse"?"🖱️":"👆"}),h.jsx("span",{className:`text-[10px] font-bold ${F==="mouse"?"text-blue-400":"text-slate-400"}`,children:F==="mouse"?"Mouse":"Touch"})]}),h.jsxs("div",{className:"relative",children:[h.jsx("div",{onClick:()=>{C(!T),N(!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:S,autoFocus:!0,onTouchStart:ee=>ee.stopPropagation(),onChange:ee=>_(ee.target.value),onKeyDown:nn,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:()=>{N(!x),C(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${x?"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:B?"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:B?"#10b981":"#fbbf24"}}),h.jsx("span",{className:"text-[8px] font-extrabold",style:{color:B?"#10b981":"#fbbf24"},children:B?"Connected":"WS"})]}),E>1&&h.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(E*100),"%"]}),m&&h.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:m})]})]}),x&&h.jsxs("div",{onTouchStart:ee=>ee.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: ",E===1?"FIT":`${Math.round(E*100)}%`]}),h.jsxs("div",{style:{display:"flex",gap:4},children:[h.jsx("button",{onClick:ee=>{ee.stopPropagation(),U(ge=>Math.max(.5,ge-.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:ee=>{ee.stopPropagation(),U(1),A(0),D(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:"FIT"}),h.jsx("button",{onClick:ee=>{ee.stopPropagation(),U(ge=>Math.min(5,ge+.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:ee=>{var q;ee.stopPropagation();const ge=((q=l.current)==null?void 0:q.clientWidth)||0,R=ge>0?Math.max(400,Math.ceil(ge/100)*100):void 0;r(R)},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:ee=>u(ee.target.checked)})]}),h.jsxs("select",{value:f,onChange:ee=>p(Number(ee.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:`
157
+ */var p4=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let r=g4.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 m4(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 g4=class Ul{static computeLink(t,r,n,i){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=Ul._getWindowedLineStrings(t-1,n),a=o.join(""),c,d=[];for(;c=s.exec(a);){let u=c[0];if(!m4(u))continue;let[f,p]=Ul._mapStrIdx(n,l,0,c.index),[m,g]=Ul._mapStrIdx(n,f,p,u.length);if(f===-1||p===-1||m===-1||g===-1)continue;let S={start:{x:p+1,y:f+1},end:{x:g,y:m+1}};d.push({range:S,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]}},_4=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function v4(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 y4=class{constructor(e=v4,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||_4;this._linkProvider=this._terminal.registerLinkProvider(new p4(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const i_={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"},Xx=w.forwardRef(({onInput:e,onResize:t,fontSize:r=13},n)=>{const i=w.useRef(null),s=w.useRef(null),o=w.useRef(null),[l,a]=w.useState(!1);return w.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{}}})),w.useEffect(()=>{if(!i.current)return;const c=new u4({cursorBlink:!0,cursorStyle:"bar",fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:i_,allowTransparency:!0,scrollback:5e3,convertEol:!1}),d=new f4,u=new y4;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:i_.background,opacity:l?1:0}})});Xx.displayName="CliTerminal";function s_({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 o_({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 x4({screenshot:e,isCapturing:t,onRefresh:r,onAction:n,addLog:i,connState:s,connScreenshot:o}){const l=w.useRef(null),a=w.useRef(null),c=w.useRef(null),[d,u]=w.useState(!0),[f,p]=w.useState(2e3),[m,g]=w.useState(null),[S,_]=w.useState(""),[,y]=w.useState(!1),[x,N]=w.useState(!1),[T,C]=w.useState(!1),A=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[F,W]=w.useState(A?"mouse":"touch"),[E,U]=w.useState(1),[O,D]=w.useState(0),[V,I]=w.useState(0),B=w.useRef(0),K=w.useRef(t),R=w.useRef(r),$=w.useRef(n),b=w.useRef(null),te=w.useRef(null),ae=w.useRef(!1),k=w.useRef(null),ye=w.useRef(0),G=w.useRef(null),Z=w.useRef(1),X=w.useRef({x:0,y:0}),ce=w.useRef(E),me=w.useRef(O),fe=w.useRef(V),xe=w.useRef(F);w.useEffect(()=>{K.current=t},[t]),w.useEffect(()=>{R.current=r},[r]),w.useEffect(()=>{ce.current=E},[E]),w.useEffect(()=>{me.current=O},[O]),w.useEffect(()=>{fe.current=V},[V]),w.useEffect(()=>{$.current=n},[n]),w.useEffect(()=>{xe.current=F},[F]),w.useEffect(()=>{var ee;(ee=l.current)==null||ee.focus()},[]);const j=s==="connected",Ce=s!=="connected"&&s!=="connecting",Qe=j&&o?o:e;w.useEffect(()=>{E<=1&&(D(0),I(0))},[E]);const pt=(ee,ge,M)=>{if(M<=1)return{x:0,y:0};const q=(M-1)/(2*M)*100,de=(M-1)/(2*M)*100;return{x:Math.max(-q,Math.min(q,ee)),y:Math.max(-de,Math.min(de,ge))}};w.useEffect(()=>{if(!d||!Ce)return;let ee=null;const ge=()=>{ee&&clearInterval(ee),!document.hidden&&(ee=setInterval(()=>{var q;if(!K.current){const de=((q=l.current)==null?void 0:q.clientWidth)||0,P=Math.max(400,Math.ceil(de/100)*100);R.current(P)}},f))},M=()=>{document.hidden?(ee&&clearInterval(ee),ee=null):ge()};return ge(),document.addEventListener("visibilitychange",M),()=>{ee&&clearInterval(ee),document.removeEventListener("visibilitychange",M)}},[d,Ce,f]);const mr=(ee,ge)=>{if(!c.current)return null;const M=c.current.getBoundingClientRect();return!M.width||!M.height?null:{nx:Math.max(0,Math.min(1,(ee-M.left)/M.width)),ny:Math.max(0,Math.min(1,(ge-M.top)/M.height))}},gr=async ee=>{var M;const ge=mr(ee.clientX,ee.clientY);if(ge){g(`Click: ${Math.round(ge.nx*100)}%, ${Math.round(ge.ny*100)}%`),(M=l.current)==null||M.focus();try{const q=await n("input_click",{nx:ge.nx,ny:ge.ny});q!=null&&q.success||i(`❌ Click failed: ${q==null?void 0:q.error}`)}catch(q){i(`❌ Click error: ${q.message||q}`)}}},Dr=async(ee,ge,M,q=0)=>{try{await n("input_key",{type:M?"char":"keyDown",key:ee,code:ge,text:M?ee:void 0,unmodifiedText:M?ee:void 0,modifiers:q})}catch(de){i(`❌ Key error: ${de.message||de}`)}},_r=async ee=>{if(ee.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(ee.key)&&ee.preventDefault();let M=0;ee.altKey&&(M|=1),ee.ctrlKey&&(M|=2),ee.metaKey&&(M|=4),ee.shiftKey&&(M|=8),g(`Key: ${ee.key}`),await Dr(ee.key,ee.code,ee.key.length===1,M)},nn=async ee=>{if(ee.key==="Enter"){if(ee.nativeEvent.isComposing)return;if(S){const ge=S;_(""),g(`IME Sent: ${ge}`);try{const M=await n("input_type",{text:ge});M!=null&&M.success||i(`❌ IME error: ${M==null?void 0:M.error}`)}catch(M){i(`❌ IME error: ${M.message}`)}}else g("Key: Enter"),await Dr("Enter","Enter",!1)}};w.useEffect(()=>{const ee=l.current;if(!ee)return;const ge=M=>{var q;if((q=c.current)!=null&&q.contains(M.target)){M.preventDefault();const de=Date.now();if(de-B.current<40)return;B.current=de;const P=mr(M.clientX,M.clientY);if(!P)return;g(`Scroll: ${Math.round(M.deltaY)}`),n("input_wheel",{nx:P.nx,ny:P.ny,deltaX:Math.round(M.deltaX),deltaY:Math.round(M.deltaY)}).catch(()=>{})}};return ee.addEventListener("wheel",ge,{passive:!1}),()=>ee.removeEventListener("wheel",ge)},[n]);const[rr,kt]=w.useState(null),mt=w.useRef(null);return w.useEffect(()=>{if(F==="mouse"&&!mt.current){const ee={nx:.5,ny:.5};mt.current=ee,kt(ee)}},[F]),w.useEffect(()=>{const ee=l.current;if(!ee)return;const ge=H=>{if(!c.current)return null;const Q=c.current.getBoundingClientRect();return!Q.width||!Q.height?null:{nx:Math.max(0,Math.min(1,(H.clientX-Q.left)/Q.width)),ny:Math.max(0,Math.min(1,(H.clientY-Q.top)/Q.height))}},M=(H,Q)=>{if(!c.current)return{dnx:0,dny:0};const J=c.current,le=J.getBoundingClientRect(),ue=J.naturalWidth||le.width,ie=J.naturalHeight||le.height,_e=ue/ie,we=le.width/le.height;let Le,be;return _e>we?(Le=le.width,be=le.width/_e):(be=le.height,Le=le.height*_e),{dnx:H/Le,dny:Q/be}},q=(H,Q,J)=>{if(J<=1.05)return;const le=-(H-.5)*100,ue=-(Q-.5)*100,ie=pt(le,ue,J);(Math.abs(ie.x-me.current)>.1||Math.abs(ie.y-fe.current)>.1)&&(D(ie.x),I(ie.y),me.current=ie.x,fe.current=ie.y)},de=H=>{if(H.preventDefault(),H.touches.length===1){const Q=H.touches[0];b.current={x:Q.clientX,y:Q.clientY,time:Date.now()},te.current={x:Q.clientX,y:Q.clientY},ae.current=!1,k.current=setTimeout(()=>{if(!ae.current)if(ae.current=!0,xe.current==="mouse"){const J=mt.current||{nx:.5,ny:.5};g("Right Click"),$.current("input_click",{...J,button:"right"}).catch(()=>{})}else{const J=ge(Q);J&&(g("Right Click"),$.current("input_click",{...J,button:"right"}).catch(()=>{}))}},500)}else if(H.touches.length===2){clearTimeout(k.current),ae.current=!0;const Q=H.touches[1].clientX-H.touches[0].clientX,J=H.touches[1].clientY-H.touches[0].clientY;G.current=Math.sqrt(Q*Q+J*J),Z.current=ce.current,X.current={x:(H.touches[0].clientX+H.touches[1].clientX)/2,y:(H.touches[0].clientY+H.touches[1].clientY)/2}}},P=H=>{if(H.preventDefault(),H.touches.length===1&&te.current){const Q=H.touches[0],J=Q.clientX-te.current.x,le=Q.clientY-te.current.y;if(!ae.current&&(Math.abs(J)>10||Math.abs(le)>10)&&(ae.current=!0,clearTimeout(k.current)),ae.current)if(xe.current==="mouse"){const ue=M(J,le),ie=mt.current||{nx:.5,ny:.5},_e=Math.max(0,Math.min(1,ie.nx+ue.dnx)),we=Math.max(0,Math.min(1,ie.ny+ue.dny));mt.current={nx:_e,ny:we},kt({nx:_e,ny:we}),g(`Cursor: ${Math.round(_e*100)}%, ${Math.round(we*100)}%`),q(_e,we,ce.current);const Le=Date.now();Le-B.current>=30&&(B.current=Le,$.current("input_mouseMoved",{nx:_e,ny:we}).catch(()=>{}))}else if(ce.current>1){const ue=a.current;if(ue){const ie=ue.clientWidth,_e=ue.clientHeight,we=me.current+J/ie*100,Le=fe.current+le/_e*100,be=pt(we,Le,ce.current);D(be.x),I(be.y),me.current=be.x,fe.current=be.y}}else{const ue=ge(Q);if(ue){const ie=Date.now();ie-B.current>=40&&(B.current=ie,g("Scroll"),$.current("input_wheel",{nx:ue.nx,ny:ue.ny,deltaX:Math.round(-J*2.5),deltaY:Math.round(-le*2.5)}).catch(()=>{}))}}te.current={x:Q.clientX,y:Q.clientY}}else if(H.touches.length===2&&G.current!==null){const Q=H.touches[1].clientX-H.touches[0].clientX,J=H.touches[1].clientY-H.touches[0].clientY,ue=Math.sqrt(Q*Q+J*J)/G.current,ie=(H.touches[0].clientX+H.touches[1].clientX)/2,_e=(H.touches[0].clientY+H.touches[1].clientY)/2,we=ie-X.current.x,Le=_e-X.current.y,be=Math.abs(ue-1)>.03;if(xe.current==="mouse"){if(be){const nt=Math.max(.5,Math.min(5,Z.current*ue));U(nt),ce.current=nt}else if(Math.abs(we)>2||Math.abs(Le)>2){const nt=mt.current||{nx:.5,ny:.5},gt=Date.now();gt-B.current>=30&&(B.current=gt,g("Scroll"),$.current("input_wheel",{nx:nt.nx,ny:nt.ny,deltaX:Math.round(-we*3),deltaY:Math.round(-Le*3)}).catch(()=>{}))}}else{const nt=Math.max(.5,Math.min(5,Z.current*ue));U(nt),ce.current=nt;const gt=a.current;if(gt&&nt>1){const vr=gt.clientWidth,Xo=gt.clientHeight,rc=me.current+we/vr*100,nc=fe.current+Le/Xo*100,Jn=pt(rc,nc,nt);D(Jn.x),I(Jn.y),me.current=Jn.x,fe.current=Jn.y}}X.current={x:ie,y:_e}}},L=H=>{var Q;if(clearTimeout(k.current),G.current=null,H.touches.length===0&&H.changedTouches.length===1&&!ae.current){const J=H.changedTouches[0],le=Date.now();if(le-(((Q=b.current)==null?void 0:Q.time)||0)<40)return;if(xe.current==="mouse"){const ie=mt.current||ge(J);ie&&(g(`Click: ${Math.round(ie.nx*100)}%, ${Math.round(ie.ny*100)}%`),$.current("input_click",{...ie}).catch(()=>{}))}else{const ie=ge(J);if(!ie)return;le-ye.current<300?(g("Double tap"),$.current("input_click",{...ie,clickCount:2}).catch(()=>{}),ye.current=0):(g(`Tap: ${Math.round(ie.nx*100)}%, ${Math.round(ie.ny*100)}%`),$.current("input_click",{...ie}).catch(()=>{}),ye.current=le)}}ae.current=!1};return ee.addEventListener("touchstart",de,{passive:!1}),ee.addEventListener("touchmove",P,{passive:!1}),ee.addEventListener("touchend",L,{passive:!1}),()=>{ee.removeEventListener("touchstart",de),ee.removeEventListener("touchmove",P),ee.removeEventListener("touchend",L),clearTimeout(k.current)}},[]),h.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:_r,onContextMenu:ee=>ee.preventDefault(),onFocus:()=>y(!0),onBlur:()=>y(!1),tabIndex:0,children:[h.jsxs("div",{ref:a,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[Qe?h.jsx("img",{ref:c,src:Qe,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${E}) translate(${O}%, ${V}%)`,transformOrigin:"center center",cursor:F==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:gr,onContextMenu:ee=>ee.preventDefault(),onDragStart:ee=>ee.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..."})]}),F==="mouse"&&rr&&Qe&&c.current&&(()=>{var Le;const ee=c.current,ge=ee.getBoundingClientRect(),M=(Le=a.current)==null?void 0:Le.getBoundingClientRect();if(!M)return null;const q=ee.naturalWidth||ge.width,de=ee.naturalHeight||ge.height,P=q/de,L=ge.width/ge.height;let H,Q,J,le;P>L?(H=ge.width,Q=ge.width/P,J=0,le=(ge.height-Q)/2):(Q=ge.height,H=ge.height*P,J=(ge.width-H)/2,le=0);const ue=ge.left-M.left+J+H*rr.nx,ie=ge.top-M.top+le+Q*rr.ny,_e=Math.max(8,Math.min(M.width-8,ue)),we=Math.max(8,Math.min(M.height-8,ie));return h.jsxs("div",{style:{position:"absolute",left:_e-8,top:we-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)"}})]})})()]}),h.jsxs("div",{onTouchStart:ee=>ee.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:()=>{W(ee=>{const ge=ee==="touch"?"mouse":"touch";if(ge==="mouse"&&!mt.current){const M={nx:.5,ny:.5};mt.current=M,kt(M)}return ge})},className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${F==="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:F==="mouse"?"🖱️":"👆"}),h.jsx("span",{className:`text-[10px] font-bold ${F==="mouse"?"text-blue-400":"text-slate-400"}`,children:F==="mouse"?"Mouse":"Touch"})]}),h.jsxs("div",{className:"relative",children:[h.jsx("div",{onClick:()=>{C(!T),N(!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:S,autoFocus:!0,onTouchStart:ee=>ee.stopPropagation(),onChange:ee=>_(ee.target.value),onKeyDown:nn,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:()=>{N(!x),C(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${x?"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"})]}),E>1&&h.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(E*100),"%"]}),m&&h.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:m})]})]}),x&&h.jsxs("div",{onTouchStart:ee=>ee.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: ",E===1?"FIT":`${Math.round(E*100)}%`]}),h.jsxs("div",{style:{display:"flex",gap:4},children:[h.jsx("button",{onClick:ee=>{ee.stopPropagation(),U(ge=>Math.max(.5,ge-.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:ee=>{ee.stopPropagation(),U(1),D(0),I(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:"FIT"}),h.jsx("button",{onClick:ee=>{ee.stopPropagation(),U(ge=>Math.min(5,ge+.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:ee=>{var q;ee.stopPropagation();const ge=((q=l.current)==null?void 0:q.clientWidth)||0,M=ge>0?Math.max(400,Math.ceil(ge/100)*100):void 0;r(M)},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:ee=>u(ee.target.checked)})]}),h.jsxs("select",{value:f,onChange:ee=>p(Number(ee.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:`
158
158
  @keyframes slideUp {
159
159
  from { opacity: 0; transform: translateY(6px); }
160
160
  to { opacity: 1; transform: translateY(0); }
@@ -163,9 +163,9 @@ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){t
163
163
  from { opacity: 0; transform: translateY(6px); }
164
164
  to { opacity: 1; transform: translateY(0); }
165
165
  }
166
- `})]})}function w4({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=w.useRef(null),m=w.useCallback(g=>{if(!n||!o||!p.current)return;const S=p.current,_=S.getBoundingClientRect(),y=(g.clientX-_.left)/_.width*S.naturalWidth,x=(g.clientY-_.top)/_.height*S.naturalHeight;o(y,x,S.naturalWidth,S.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 Gx({activeConv:e,onModalButton:t}){const[r,n]=w.useState(null);if(w.useEffect(()=>{n(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=s=>{r||(n(s),t(s))};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(rx,{size:14})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),h.jsx("div",{className:"flex gap-2 flex-wrap",children:e.modalButtons.map((s,o)=>{const l=s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),a=/^(run|approve|accept|yes|allow|always)/.test(l),c=/^(reject|deny|delete|remove|abort)/.test(l),d=r===s,u=r!==null;return h.jsx("button",{onClick:()=>i(s),disabled:u,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${a?"bg-white text-amber-700 font-extrabold":c?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${u&&!d?"opacity-40":"opacity-100"} ${u?"cursor-not-allowed":"cursor-pointer"}`,children:d?"⏳ ...":s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim()},o)})})]})]})}const xr=new Map;function S4({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var ye;const{sendCommand:a}=Li(),c=!!(o||l),d=`${e}:${r}`,u=xr.get(d),[f,p]=w.useState(!1),[m,g]=w.useState(!1),[S,_]=w.useState((u==null?void 0:u.models)||[]),[y,x]=w.useState((u==null?void 0:u.modes)||[]),N=G=>G?typeof G=="string"?G:typeof G=="object"?G.name||G.id||JSON.stringify(G):String(G):"",[T,C]=w.useState(N(i)),[M,F]=w.useState(N(s)),[$,E]=w.useState(!1),[U,j]=w.useState(!1),A=w.useRef(0),V=G=>G.map(Z=>typeof Z=="string"?Z:(Z==null?void 0:Z.name)||(Z==null?void 0:Z.id)||String(Z));w.useEffect(()=>{if(o){const G=o.find(Z=>Z.category==="model");if(G){const Z=V(G.options.map(ce=>ce.value));_(Z),G.currentValue&&C(N(G.currentValue));const X=xr.get(d)||{models:[],modes:[]};xr.set(d,{...X,models:Z})}}if(l&&l.length>0){const G=V(l.map(X=>X.id));x(G);const Z=xr.get(d)||{models:[],modes:[]};xr.set(d,{...Z,modes:G})}else if(o){const G=o.find(Z=>Z.category!=="model");if(G){const Z=V(G.options.map(ce=>ce.value));x(Z),G.currentValue&&F(N(G.currentValue));const X=xr.get(d)||{models:[],modes:[]};xr.set(d,{...X,modes:Z})}}},[o,l,d]),w.useEffect(()=>{p(!1),g(!1),C(N(i)),F(N(s));const G=xr.get(d);G?(_(G.models),x(G.modes)):(_([]),x([]))},[e,r]),w.useEffect(()=>{i&&Date.now()>A.current&&C(N(i))},[i]),w.useEffect(()=>{s&&Date.now()>A.current&&F(N(s))},[s]);const D=w.useCallback(async(G,Z={})=>{const X={...Z},ce=e.split(":");return ce.length>=3&&(ce[1]==="ide"||ce[1]==="cli"||ce[1]==="acp")&&(X._targetInstance=ce.slice(2).join(":"),X._targetType=ce[1]),await a(e,G,X)},[e]),O=async()=>{var G,Z;if(S.length>0){p(!f);return}if(c){p(!0);return}E(!0);try{const X=await D("list_extension_models",{agentType:r,ideType:t}),ce=(X==null?void 0:X.models)||((G=X==null?void 0:X.result)==null?void 0:G.models)||[],me=V(ce);_(me),X!=null&&X.current&&C(N(X.current)),(Z=X==null?void 0:X.result)!=null&&Z.current&&C(N(X.result.current));const fe=xr.get(d)||{models:[],modes:[]};xr.set(d,{...fe,models:me}),p(!0)}catch{}finally{E(!1)}},K=async()=>{var G,Z;if(y.length>0){g(!m);return}if(c){g(!0);return}j(!0);try{const X=await D("list_extension_modes",{agentType:r,ideType:t}),ce=(X==null?void 0:X.modes)||((G=X==null?void 0:X.result)==null?void 0:G.modes)||[],me=V(ce);x(me),X!=null&&X.current&&F(N(X.current)),(Z=X==null?void 0:X.result)!=null&&Z.current&&F(N(X.result.current));const fe=xr.get(d)||{models:[],modes:[]};xr.set(d,{...fe,modes:me}),g(!0)}catch{}finally{j(!1)}},I=async G=>{p(!1),C(G),A.current=Date.now()+5e3;try{c?await D("change_model",{agentType:r,ideType:t,model:G}):await D("set_extension_model",{agentType:r,ideType:t,model:G})}catch{}},H=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(G=>G.category!=="model")),b=H?(ye=o==null?void 0:o.find(G=>G.category!=="model"))==null?void 0:ye.configId:void 0,te=async G=>{g(!1),F(G),A.current=Date.now()+5e3;try{c&&H&&b?await D("set_thought_level",{agentType:r,ideType:t,configId:b,value:G}):c?await D("set_mode",{agentType:r,ideType:t,mode:G}):await D("set_extension_mode",{agentType:r,ideType:t,mode:G})}catch{}},k={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:k},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?`${k}55`:"transparent",border:"1px solid",color:T?"var(--text-primary)":"var(--text-muted)"},onClick:O,children:[h.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),$?"...":T||"Model",h.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),f&&S.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"}),S.map(G=>h.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:G===T?`${k}18`:"transparent",color:G===T?k:"var(--text-secondary)",fontWeight:G===T?600:400,borderLeft:G===T?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Z=>{Z.currentTarget.style.background=`${k}12`},onMouseLeave:Z=>{Z.currentTarget.style.background=G===T?`${k}18`:"transparent"},onClick:()=>I(G),children:G},G))]})]})]}),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?`${k}55`:"transparent",border:"1px solid",color:M?"var(--text-primary)":"var(--text-muted)"},onClick:K,children:[h.jsx("span",{className:"text-[9px] opacity-60",children:H?"🧠":"⚡"}),U?"...":M||(H?"Thinking":"Mode"),h.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),m&&y.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>g(!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:H?"SELECT THINKING LEVEL":"SELECT MODE"}),y.map(G=>h.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:G===M?`${k}18`:"transparent",color:G===M?k:"var(--text-secondary)",fontWeight:G===M?600:400,borderLeft:G===M?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Z=>{Z.currentTarget.style.background=`${k}12`},onMouseLeave:Z=>{Z.currentTarget.style.background=G===M?`${k}18`:"transparent"},onClick:()=>te(G),children:G},G))]})]})]})]})}const ar=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),Or=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function Qx({activeConv:e,ides:t,agentInput:r,setAgentInput:n,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a}){const c=w.useRef(null),{sendCommand:d}=Li(),[u,f]=w.useState([]),[p,m]=w.useState(0),[g,S]=w.useState(!0),[_,y]=w.useState(!1),x=w.useRef("");e.tabKey!==x.current&&(x.current=e.tabKey,f([]),m(0),S(!0));const N=w.useCallback(async()=>{var M,F,$,E,U;if(!(_||!g)){y(!0);try{const j=t.find(I=>I.id===e.ideId),A=(j==null?void 0:j.daemonId)||((M=e.ideId)==null?void 0:M.split(":")[0])||"";if(!A){S(!1);return}const V=e.ideType||e.agentType||"",D=(e.ideId||"").split(":"),O=D.length>=3?D.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:A,agentType:V,instanceId:O,offset:p});const K=await d(A,"chat_history",{agentType:V,offset:p,limit:30,instanceId:O});console.log("[ChatPane] got result:",{count:((F=K.messages)==null?void 0:F.length)||0,hasMore:K.hasMore}),(($=K.messages)==null?void 0:$.length)>0&&(f(I=>[...K.messages,...I]),m(I=>I+K.messages.length)),S(K.hasMore)}catch(j){console.warn("[ChatPane] Failed to load history:",j),!((E=j==null?void 0:j.message)!=null&&E.includes("P2P not available"))&&!((U=j==null?void 0:j.message)!=null&&U.includes("channel not open"))&&S(!1)}finally{y(!1)}}},[_,g,p,t,e]),T=w.useRef(0);w.useEffect(()=>{if(e.messages.length<10&&g&&!_&&u.length===0){const M=T.current;if(M>5)return;const $=setTimeout(()=>{T.current=M+1,N()},M===0?0:2e3);return()=>clearTimeout($)}else u.length>0&&(T.current=0)},[e.tabKey,e.messages.length,g,_,u.length,N]);const C=(()=>{const M=e.messages.map((E,U)=>{const j=`${e.ideId}-${E.id??`i-${U}`}`;return{...E,receivedAt:E.receivedAt||l[j]||0}});if(u.length===0)return M;const F=new Set(M.map(E=>`${E.role}:${(E.content||"").slice(0,100)}`));return[...u.filter(E=>!F.has(`${E.role}:${(E.content||"").slice(0,100)}`)),...M]})();return h.jsxs(h.Fragment,{children:[h.jsx(ix,{messages:C,actionLogs:a.filter(M=>M.ideId===e.tabKey).sort((M,F)=>M.timestamp-F.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",isCliMode:ar(e)||Or(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:N,isLoadingMore:_,hasMoreHistory:g,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(nx,{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(lo,{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(UT,{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(lo,{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}),!ar(e)&&(()=>{const M=t.find(F=>F.id===e.ideId);return h.jsx(S4,{ideId:e.ideId,ideType:e.ideType,agentType:e.streamSource==="agent-stream"?e.agentType:e.ideType,agentName:e.streamSource==="agent-stream"?e.agentName:e.displaySecondary,serverModel:(M==null?void 0:M.currentModel)||void 0,serverMode:(M==null?void 0:M.currentPlan)||void 0,acpConfigOptions:Or(e)?M==null?void 0:M.acpConfigOptions:void 0,acpModes:Or(e)?M==null?void 0:M.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:c,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:M=>n(M.target.value),onPaste:M=>{const F=M.clipboardData.getData("text");F&&n($=>$+F),M.preventDefault()},onKeyDown:M=>{if(M.key==="Enter"){if(M.nativeEvent.isComposing){M.preventDefault();return}M.preventDefault(),i()}},onBlur:()=>{window.innerWidth<768&&setTimeout(()=>{document.documentElement.scrollTop=0},100)},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"})})})]})})]})}function b4({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){const l=w.useRef(null),{sendCommand:a,sendData:c}=Li();return 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 d=t.current.get(e.tabKey);if(d&&d.length>0)for(const u of d)r.current.write(u);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var u;(u=r.current)==null||u.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 f;const d=(f=e.ideId)!=null&&f.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";if(!window.confirm(`Stop ${d}?
167
- This will terminate the CLI process.`))return;const u=e.ideId||e.daemonId||"";try{await a(u,"stop_cli",{cliType:d})}catch(p){console.error("Stop CLI failed:",p)}},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(Gx,{activeConv:e,onModalButton:o}),h.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:h.jsx(Xx,{ref:r,onInput:d=>{var p;const u=e.ideId||e.daemonId||"",f=(p=e.ideId)!=null&&p.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(u,{type:"pty_input",cliType:f,data:d})||a(u,"pty_input",{cliType:f,data:d}).catch(console.error)},onResize:(d,u)=>{var m;const f=e.ideId||e.daemonId||"",p=(m=e.ideId)!=null&&m.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(f,{type:"pty_resize",cliType:p,cols:d,rows:u})||a(f,"pty_resize",{cliType:p,cols:d,rows:u,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:d=>i(d.target.value),onPaste:d=>{const u=d.clipboardData.getData("text");u&&i(f=>f+u),d.preventDefault()},onKeyDown:d=>{if(d.key==="Enter"){if(d.nativeEvent.isComposing){d.preventDefault();return}d.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 k4({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 au=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),cu=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function C4({activeConv:e,agentCount:t,wsStatus:r,isConnected:n,onOpenHistory:i}){const s=gs(),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(xf,{size:18})," Dashboard",h.jsxs("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:[t," Active",h.jsx("span",{className:"inline-block w-[5px] h-[5px] rounded-full ml-1 align-middle",style:{background:o}})]})]}),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&&!au(e)&&!cu(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(KT,{size:14})," IDE"]}),e&&!au(e)&&!cu(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($T,{size:16})}),e&&!au(e)&&!cu(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(oo,{size:16})})]})]})}function Xr(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function E4(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 l_(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function a_(e){return(e.id||"").includes(":cli:")}function c_(e){return(e.id||"").includes(":acp:")}function rd(e,t){return Xr(e)}function N4(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 T4({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," — ",Xr(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(GT,{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(HT,{size:13})," Refresh History"]})})})]})]})}function L4({sortedConversations:e,activeTabId:t,tabsOverflow:r,tabsContainerRef:n,terminalRef:i,onSelectTab:s,onReorder:o,pinTab:l,clearTabPinTimers:a,retryConnection:c}){const{sendCommand:d}=Li(),u=w.useRef(null),f=w.useRef(null),p=w.useRef(null),m=w.useRef(null),[g,S]=w.useState(!1),_=w.useCallback(($,E)=>{const U=E.touches[0];p.current={x:U.clientX,y:U.clientY},f.current=$,m.current=setTimeout(()=>{S(!0)},400)},[]),y=w.useCallback($=>{if(!g||!f.current){m.current&&(clearTimeout(m.current),m.current=null);return}$.preventDefault();const E=$.touches[0],U=n.current;if(!U)return;const j=Array.from(U.querySelectorAll("[data-tabkey]"));for(const A of j){const V=A.getBoundingClientRect();if(E.clientX>=V.left&&E.clientX<=V.right){const D=A.getAttribute("data-tabkey");if(D&&D!==f.current){const O=e.map(H=>H.tabKey),K=O.indexOf(f.current),I=O.indexOf(D);if(K!==-1&&I!==-1){const H=[...O];H.splice(K,1),H.splice(I,0,f.current),o(H)}}break}}},[g,e,n,o]),x=w.useCallback(()=>{m.current&&(clearTimeout(m.current),m.current=null),S(!1),f.current=null,p.current=null},[]),[N,T]=w.useState(!1),[C,M]=w.useState(!1),F=w.useCallback(()=>{const $=n.current;$&&(T($.scrollLeft>4),M($.scrollLeft+$.clientWidth<$.scrollWidth-4))},[n]);return w.useEffect(()=>{const $=n.current;if(!$)return;F(),$.addEventListener("scroll",F,{passive:!0});const E=new ResizeObserver(F);return E.observe($),()=>{$.removeEventListener("scroll",F),E.disconnect()}},[n,F,e.length]),h.jsxs("div",{className:"relative shrink-0",children:[r&&N&&h.jsx("div",{className:"absolute left-0 top-0 bottom-0 z-[3] w-5 pointer-events-none",style:{background:"linear-gradient(to right, var(--bg-secondary), transparent)"}}),r&&C&&h.jsx("div",{className:"absolute right-0 top-0 bottom-0 z-[3] w-5 pointer-events-none",style:{background:"linear-gradient(to left, var(--bg-secondary), transparent)"}}),h.jsxs("div",{ref:n,className:"dashboard-agent-tabs flex overflow-x-auto overflow-y-visible shrink-0 bg-bg-secondary border-b border-border-subtle pt-1.5 pb-0 gap-1 select-none",onWheel:$=>{const E=n.current;E&&Math.abs($.deltaY)>Math.abs($.deltaX)&&($.preventDefault(),E.scrollLeft+=$.deltaY)},style:{paddingLeft:8,paddingRight:8,scrollbarWidth:"none",WebkitOverflowScrolling:"touch"},children:[e.map(($,E)=>{const U=t===$.tabKey,j=$.status==="working"?"agent-tab-working":$.status==="waiting_approval"?"agent-tab-waiting":"",A=E<9?String(E+1):null,V=$.connectionState==="gave_up";return h.jsxs("div",{"data-tabkey":$.tabKey,className:`${j} shrink-0 px-2.5 py-1.5 rounded-t-lg border-b-0 cursor-grab flex items-center gap-2 transition-all duration-200`,draggable:!0,onDragStart:()=>{u.current=$.tabKey},onDragOver:D=>{D.preventDefault(),D.currentTarget.style.borderLeft="2px solid var(--accent-primary)"},onDragLeave:D=>{D.currentTarget.style.borderLeft=U?"1px solid var(--border-subtle)":"1px solid transparent"},onDrop:D=>{if(D.preventDefault(),D.currentTarget.style.borderLeft=U?"1px solid var(--border-subtle)":"1px solid transparent",!u.current||u.current===$.tabKey)return;const O=e.map(b=>b.tabKey),K=O.indexOf(u.current),I=O.indexOf($.tabKey);if(K===-1||I===-1)return;const H=[...O];H.splice(K,1),H.splice(I,0,u.current),o(H),u.current=null},onDragEnd:()=>{u.current=null},onTouchStart:D=>_($.tabKey,D),onTouchMove:y,onTouchEnd:x,onClick:()=>{a(),s($.tabKey),$.streamSource==="agent-stream"&&$.agentType&&(d($.ideId,"agent_stream_focus",{agentType:$.agentType}).catch(()=>{}),l($.tabKey,[200,1500])),ar($)&&setTimeout(()=>{var D,O;(O=(D=i.current)==null?void 0:D.bumpResize)==null||O.call(D)},100)},style:{background:U?"var(--bg-primary)":"var(--bg-glass)",borderTop:U?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:U?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:U?"1px solid var(--border-subtle)":"1px solid transparent",opacity:g&&f.current===$.tabKey?V?.15:.3:V?U?.6:.3:U?1:.65},children:[$.status==="working"?h.jsx("div",{className:"tab-spinner"}):$.status==="waiting_approval"?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400",children:"▲"}):$.connectionState==="gave_up"?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-red-400",children:"●"}):$.connectionState==="connecting"?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-blue-400",children:"○"}):$.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:$.displayPrimary}),h.jsx("div",{className:"text-[8px] opacity-50 flex gap-1 items-center",children:V?h.jsx("span",{className:"text-red-400 opacity-100",children:"Disconnected"}):h.jsxs(h.Fragment,{children:[$.displaySecondary,$.machineName&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"opacity-40",children:"·"}),h.jsxs("span",{className:"opacity-70",children:["🖥 ",$.machineName]})]})]})})]}),V?h.jsx("button",{onClick:D=>{var K;D.stopPropagation();const O=$.daemonId||((K=$.ideId)==null?void 0:K.split(":")[0])||"";c==null||c(O)},title:"Reconnect",className:"shrink-0 ml-1 text-[11px] px-1.5 py-0.5 rounded cursor-pointer transition-all hover:scale-110",style:{background:"var(--accent-primary)",color:"white",border:"none",opacity:1},children:"↻"}):A?h.jsx("span",{className:"text-[9px] opacity-35 font-mono ml-0.5 shrink-0",children:A}):null]},$.tabKey)}),e.length===0&&h.jsx("div",{className:"p-2 text-xs opacity-40",children:"No active agents online."})]})]})}const u_={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function P4({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.jsx("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:u_[n.type]||u_.info},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const D4=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function I4(e){var n;const t=(n=e.workspaceFolders)==null?void 0:n[0];return t!=null&&t.name?t.name:((t==null?void 0:t.path)??"").split("/").filter(Boolean).pop()||"Workspace"}function R4(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 S,_,y,x,N;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((S=o.id)==null?void 0:S.split(":")[0])||o.id,d=n?n[c]||"new":void 0,u=I4(o),f=Xr(o.type),p=o.agentStreams,m=Array.isArray(p)?p:[],g=D4(o);if(g){const T=rd(o.type),C=(_=o.agents)==null?void 0:_[0],M=(y=o.activeChat)==null?void 0:y.activeModal,F=M&&Array.isArray(M.buttons)&&M.buttons.length>0,$=(x=o.activeChat)==null?void 0:x.status,E=$==="generating"||$==="loading"||$&&$.toLowerCase()==="thinking",j=F||$==="waiting_approval"?"waiting_approval":E?"working":(C==null?void 0:C.status)||"idle",A=o.activeChat||{title:"",messages:[]};let V=A.title&&String(A.title).trim()?String(A.title).trim():"";const D=(N=o.activeChat)==null?void 0:N.id,O=o.chats;if(D&&Array.isArray(O)&&O.length>0){const te=O.find(ae=>ae.id===D||ae.id&&String(ae.id)===String(D));te!=null&&te.title&&String(te.title).trim()&&(V=String(te.title).trim())}const K=A.messages||[],I=t[o.id]||[],H=new Map;K.filter(te=>te.role==="user").forEach(te=>{H.set(te.content,(H.get(te.content)||0)+1)});const b=I.filter(te=>{const ae=H.get(te.content)||0;return ae>0?(H.set(te.content,ae-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:T,agentType:ar(o)||Or(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:j,title:V,messages:[...K,...b],ideType:o.type,workspaceName:u,displayPrimary:V||T||u,displaySecondary:f,cdpconnected:o.cdpconnected,modalButtons:F?M.buttons:void 0,modalMessage:F?M.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,connectionState:d})}if(g&&(ar(o)||Or(o)))return l;for(const T of m){const C=T.activeModal&&Array.isArray(T.activeModal.buttons)&&T.activeModal.buttons.length>0,M=C?"waiting_approval":T.status==="streaming"?"working":T.status,F=`${o.id}:${T.agentType}`,$=T.messages||[],E=t[F]||[],U=new Map;$.filter(A=>A.role==="user").forEach(A=>{U.set(A.content,(U.get(A.content)||0)+1)});const j=E.filter(A=>{const V=U.get(A.content)||0;return V>0?(U.set(A.content,V-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:T.agentName,agentType:T.agentType,status:M,title:"",messages:[...$,...j],ideType:o.type,workspaceName:u,displayPrimary:T.agentName,displaySecondary:f,cdpconnected:o.cdpconnected,modalButtons:C?T.activeModal.buttons:void 0,modalMessage:C?T.activeModal.message:void 0,streamSource:"agent-stream",tabKey:F,machineName:a,connectionState:d})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:rd(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:u,displayPrimary:u||f,displaySecondary:f,cdpconnected:o.cdpconnected,streamSource:"native",tabKey:o.id,connectionState:d}),l})}function M4(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function h_(){try{const e=localStorage.getItem("theme");if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function uu(e){return e==="system"?M4():e}function A4(){const[e,t]=w.useState(h_),[r,n]=w.useState(()=>uu(h_()));w.useEffect(()=>{document.documentElement.setAttribute("data-theme",r)},[r]),w.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=w.useCallback(o=>{t(o),n(uu(o));try{localStorage.setItem("theme",o)}catch{}},[]),s=w.useCallback(()=>{t(o=>{const l=o==="dark"?"light":o==="light"?"system":"dark";n(uu(l));try{localStorage.setItem("theme",l)}catch{}return l})},[]);return{theme:r,preference:e,setPreference:i,cycleTheme:s,isDark:r==="dark"}}const d_={dark:"Dark",light:"Light",system:"System"};function j4({collapsed:e}){const{preference:t,cycleTheme:r}=A4(),n=t==="dark"?h.jsx(ZT,{size:16}):t==="light"?h.jsx(QT,{size:16}):h.jsx(JT,{size:16});return h.jsxs("div",{className:`nav-item cursor-pointer ${e?"justify-center py-2.5 px-0":""}`,onClick:r,title:`Theme: ${d_[t]} (click to cycle)`,children:[h.jsx("span",{className:"nav-icon",children:n}),!e&&h.jsx("span",{className:"text-xs",children:d_[t]})]})}let B4=Y0;function Df(){return B4()}class O4{constructor(){ws(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 z4=new O4;class F4{constructor(){ws(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 Xt=new F4,f_=Xt;const $4={enabled:!0,onApproval:!0,onComplete:!0,onError:!0,throttleMs:5e3};async function W4(){return"Notification"in window?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"}function Zx(){return"Notification"in window&&Notification.permission==="granted"}let ni=null;async function H4(){if(ni!==null)return ni;try{if(!("serviceWorker"in navigator)||!("PushManager"in window))return ni=!1,!1;const e=await navigator.serviceWorker.getRegistration();return e?(ni=!!await e.pushManager.getSubscription(),ni):(ni=!1,!1)}catch{return ni=!1,!1}}function U4(e,t,r){if(Zx())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 V4(e,t={}){const r={...$4,...t},n=w.useRef(new Map),i=w.useRef(0),s=w.useRef(null);w.useEffect(()=>{H4().then(l=>{s.current=l})},[]);const o=w.useCallback((l,a,c)=>{const d=Date.now();d-i.current<r.throttleMs||(i.current=d,U4(l,a,c))},[r.throttleMs]);w.useEffect(()=>{var l;if(!(!r.enabled||!Zx())&&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&&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&&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])}function K4(){const{sendCommand:e}=Li(),t=Df(),{updateIdeChats:r,screenshotMap:n,setScreenshotMap:i}=t,s=t.ides||[],o=t.toasts||[],l=t.setToasts||(()=>{}),a=t.wsStatus||"connected",c=t.isConnected??!0,d=t.connectionStates||{},u=t.retryConnection,f=t.showReconnected||!1,[p,m]=w.useState(()=>{try{const L=new URLSearchParams(window.location.search).get("activeTab");return L||sessionStorage.getItem("adhdev_dashboard_activeTab")}catch{return null}}),g=w.useCallback(P=>{m(P);try{P?sessionStorage.setItem("adhdev_dashboard_activeTab",P):sessionStorage.removeItem("adhdev_dashboard_activeTab")}catch{}},[]),S=w.useRef([]),[_,y]=w.useState(""),[x,N]=w.useState({}),[T,C]=w.useState(!1),[M,F]=w.useState(!1),[$,E]=w.useState(!1),[U,j]=w.useState([]),[A,V]=w.useState({}),[D,O]=w.useState({}),K=w.useRef(null),I=w.useRef(null),H=w.useRef(null),[b,te]=w.useState(!1),ae=s.find(P=>P.type==="adhdev-daemon"),k=(ae==null?void 0:ae.detectedIdes)||[],ye=!!ae,G=w.useMemo(()=>{var W,Q;const P=s.filter(J=>J.type!=="adhdev-daemon"),L=new Map;for(const J of P){const le=L.get(J.id);if(!le)L.set(J.id,J);else{const ue=(((W=le.workspaceFolders)==null?void 0:W.length)||0)+(le.activeChat?1:0);((((Q=J.workspaceFolders)==null?void 0:Q.length)||0)+(J.activeChat?1:0)>ue||(J.timestamp||0)>(le.timestamp||0))&&L.set(J.id,J)}}return Array.from(L.values())},[s]),Z=w.useMemo(()=>{const P=R4(G,A,s,d),L=Date.now();return P.map(W=>{const Q=D[W.tabKey];return Q&&L-Q<5e3?{...W,messages:[],title:""}:W})},[G,A,D,s]);w.useEffect(()=>{W4()},[]);const X=w.useMemo(()=>Z.map(P=>({id:P.tabKey,name:P.title||P.agentName||P.ideId,status:P.status,activeModal:P.modalMessage?{message:P.modalMessage,buttons:P.modalButtons}:null})),[Z]);V4(X);const[ce,me]=w.useState(()=>{try{return JSON.parse(sessionStorage.getItem("adhdev_tabOrder")||"[]")}catch{return[]}}),fe=w.useMemo(()=>{if(ce.length===0)return Z;const P=new Map(ce.map((L,W)=>[L,W]));return[...Z].sort((L,W)=>{const Q=P.get(L.tabKey)??9999,J=P.get(W.tabKey)??9999;return Q-J})},[Z,ce]);w.useEffect(()=>{const P=H.current;if(!P)return;const L=()=>te(P.scrollWidth>P.clientWidth+2);L();const W=new ResizeObserver(L);return W.observe(P),P.addEventListener("scroll",L),()=>{W.disconnect(),P.removeEventListener("scroll",L)}},[fe.length]);const xe=w.useCallback(P=>{me(P);try{sessionStorage.setItem("adhdev_tabOrder",JSON.stringify(P))}catch{}},[]);w.useEffect(()=>{if(Object.keys(D).length===0)return;const L=setTimeout(()=>{O(W=>{const Q=Date.now(),J={};for(const[le,ue]of Object.entries(W))Q-ue<5e3&&(J[le]=ue);return Object.keys(J).length===Object.keys(W).length?W:J})},5500);return()=>clearTimeout(L)},[D]);const B=fe.find(P=>P.tabKey===p),Ce=fe.map(P=>P.tabKey).join(","),Qe=w.useRef(!1);w.useEffect(()=>{if(fe.length===0||Qe.current&&p&&fe.some(L=>L.tabKey===p))return;const P=fe.find(L=>L.cdpconnected===!0);P?g(P.tabKey):(!p||!fe.some(L=>L.tabKey===p))&&g(fe[0].tabKey)},[Ce]);const pt=w.useCallback(()=>{S.current.forEach(P=>clearTimeout(P)),S.current=[]},[]),mr=w.useCallback((P,L)=>{pt();for(const W of L)S.current.push(setTimeout(()=>g(P),W))},[pt]);w.useEffect(()=>{var W;if(!((W=B==null?void 0:B.messages)!=null&&W.length))return;const P=B.ideId,L=Date.now();N(Q=>{let J=!1;const le={...Q};return B.messages.forEach((ue,ie)=>{const _e=`${P}-${ue.id??`i-${ie}`}`;le[_e]==null&&(le[_e]=L,J=!0)}),J?le:Q})},[B==null?void 0:B.ideId,B==null?void 0:B.messages]);const gr=w.useRef(!1);w.useEffect(()=>{if(!T){gr.current=!1;return}if(!B||gr.current||M)return;const P=s.find(L=>L.id===B.ideId);P&&(!P.chats||P.chats.length===0)&&(gr.current=!0,de())},[T,B==null?void 0:B.ideId]),w.useEffect(()=>{const P=setInterval(()=>{const L=Date.now()-3e5;j(W=>{const Q=W.filter(J=>J.timestamp>L).slice(-100);return Q.length===W.length?W:Q})},6e4);return()=>clearInterval(P)},[]);const Dr=w.useRef(new Map);w.useEffect(()=>{const P=(W,Q)=>{var ie,_e,we;if(!Q)return;for(const Le of Z){if(!ar(Le))continue;const nt=(ie=Le.ideId)!=null&&ie.includes(":cli:")?Le.ideId.split(":cli:")[1]:"";if(W===nt||W===Le.agentType||W===Le.ideType){const vr=Dr.current.get(Le.tabKey)||[];vr.push(Q),vr.length>1e4&&vr.splice(0,vr.length-5e3),Dr.current.set(Le.tabKey,vr)}}const J=B&&ar(B),le=(_e=B==null?void 0:B.ideId)!=null&&_e.includes(":cli:")?B.ideId.split(":cli:")[1]:"",ue=W===le||W===(B==null?void 0:B.agentType)||W===(B==null?void 0:B.ideType);J&&ue&&((we=K.current)==null||we.write(Q))},L=f_.onPtyOutput(P);return()=>{L()}},[B==null?void 0:B.agentType,B==null?void 0:B.ideType,B==null?void 0:B.tabKey,Z]),w.useEffect(()=>{if(!B||!ar(B))return;const L=setTimeout(()=>{if(K.current){const W=Dr.current.get(B.tabKey);if(W&&W.length>0)for(const Q of W)K.current.write(Q);K.current.bumpResize()}},200);return()=>clearTimeout(L)},[B==null?void 0:B.tabKey]),w.useEffect(()=>{if(!B)return;const P=setTimeout(()=>{var L;(L=I.current)==null||L.focus()},150);return()=>clearTimeout(P)},[B==null?void 0:B.tabKey]),w.useEffect(()=>{const P=L=>{var ue,ie,_e,we,Le,be;const W=parseInt(L.key);if(isNaN(W)||W<1||W>9)return;if(L.ctrlKey){L.preventDefault();const nt=fe[W-1];nt&&(pt(),g(nt.tabKey));return}const Q=(ue=document.activeElement)==null?void 0:ue.tagName,J=Q==="INPUT"||Q==="TEXTAREA"||((ie=document.activeElement)==null?void 0:ie.isContentEditable),le=((we=(_e=document.activeElement)==null?void 0:_e.closest)==null?void 0:we.call(_e,".xterm-helper-textarea"))!=null||((be=(Le=document.activeElement)==null?void 0:Le.classList)==null?void 0:be.contains("xterm-helper-textarea"));if(!J&&!le){L.preventDefault();const nt=fe[W-1];nt&&(pt(),g(nt.tabKey))}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[fe,pt,g]),w.useEffect(()=>{const P=z4.on("status_event",L=>{var le;const W=Xr(L.ideType||"");let Q="",J="info";if(L.event==="agent:generating_completed"){const ue=L.duration?` (${L.duration}s)`:"";Q=`✅ ${W} agent task completed${ue}`,J="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(L.ideId){const ie={role:"system",timestamp:Date.now(),content:`✅ Task completed${ue}`,_localId:`sys_complete_${Date.now()}`};V(_e=>{for(const we of Object.keys(_e))if(we.includes(L.ideId))return{..._e,[we]:[..._e[we]||[],ie]};return _e})}}else if(L.event==="agent:generating_started")L.ideId&&V(ue=>{const ie={...ue};for(const _e of Object.keys(ie))_e.includes(L.ideId)&&(ie[_e]=(ie[_e]||[]).filter(we=>{var Le;return!(we.role==="system"&&((Le=we._localId)!=null&&Le.startsWith("sys_complete_")))}));return ie});else if((L.event==="agent:waiting_approval"||L.event==="agent:approval_needed")&&(Q=`⚡ ${W} approval needed`,J="warning",L.ideId)){const ue=L.modalMessage||"Approval requested",ie=(le=L.modalButtons)!=null&&le.length?L.modalButtons.map(we=>`[${we}]`).join(" "):"[Approve] [Reject]",_e={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${ue}
168
- ${ie}`,_localId:`sys_approval_${Date.now()}`};V(we=>{for(const Le of Object.keys(we))if(Le.includes(L.ideId))return{...we,[Le]:[...we[Le]||[],_e]};return we})}if(Q){const ue=Date.now();l(ie=>[...ie.slice(-4),{id:ue,message:Q,type:J,timestamp:ue,ideId:L.ideId}]),setTimeout(()=>l(ie=>ie.filter(_e=>_e.id!==ue)),5e3)}});return()=>P()},[]),w.useEffect(()=>{var L;const P=W=>{const Q=W.data;(Q==null?void 0:Q.type)==="notification_action"&&Q.action==="approve"&&Q.ideId&&e(Q.ideId,"resolve_action",{action:"approve",button:"Approve"}).catch(J=>console.error("[SW Action] approve failed:",J))};return(L=navigator.serviceWorker)==null||L.addEventListener("message",P),()=>{var W;return(W=navigator.serviceWorker)==null?void 0:W.removeEventListener("message",P)}},[]);const _r=async()=>{if(!B)return;const P=_.trim();if(!P)return;const L=B.ideId,W=B.tabKey;y(""),mr(W,[100,500,1500,3e3]);const Q=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,J={role:"user",content:P,timestamp:Date.now(),_localId:Q};V(le=>({...le,[W]:[...le[W]||[],J]}));try{if(ar(B)&&!Or(B)){const le=L||B.daemonId||"";if(!le)return;const ue=B.ideType||B.agentType||"";await e(le,"agent_command",{agentType:ue,cliType:ue,action:"send_chat",message:P,text:P})}else if(Or(B)){const le=L||B.daemonId||"";if(!le)return;await e(le,"send_chat",{message:P,text:P,agentType:B.agentType})}else{const le=L||B.daemonId||"";if(!le)return;await e(le,"send_chat",{message:P,text:P,...B.streamSource==="agent-stream"&&{agentType:B.agentType}})}setTimeout(()=>{const le=Date.now()-6e4;V(ue=>{const ie=ue[W];if(!ie)return ue;const _e=ie.filter(we=>we.timestamp>le);return _e.length===ie.length?ue:{...ue,[W]:_e}})},6e4)}catch(le){console.error("Send failed",le),y(P),V(ue=>({...ue,[W]:(ue[W]||[]).filter(ie=>ie._localId!==Q)}))}},nn=async()=>{if(B)try{ye?await e(B.ideId,"launch_ide",{ideType:B.ideType,enableCdp:!0}):await e(B.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(P){console.error("Relaunch failed",P)}},rr=async P=>{try{await e("standalone","launch_ide",{ideType:P,enableCdp:!0})}catch(L){console.error("Launch failed",L)}},kt=async P=>{if(B){console.log("[ModalButton] ideId:",B.ideId,"button:",P,"agentType:",B.agentType,"source:",B.streamSource),j(L=>[...L,{ideId:B.tabKey,text:`🖱️ **${P}** clicked`,timestamp:Date.now()}]);try{let L;if(ar(B)&&!Or(B)){const Q=(B.modalButtons||[]).indexOf(P),J=P.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase();let le;Q>=0?le=`${Q+1}\r`:/^(deny|no|reject|cancel)/.test(J)?le="3\r":/always/.test(J)?le="2\r":le="1\r";const ue=B.daemonId||B.ideId,ie=B.ideType||B.agentType||"";f_.sendPtyInput(ue,ie,le)||await e(ue,"pty_input",{cliType:ie,data:le}),L={success:!0}}else{const W=P.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),Q=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(W),J=B.ideId||B.daemonId||"";L=await e(J,"resolve_action",{button:P,action:Q?"approve":"reject",...B.streamSource==="agent-stream"&&{agentType:B.agentType}})}console.log("[ModalButton] result:",L),L.success||j(W=>[...W,{ideId:B.tabKey,text:`⚠️ **${P}** failed — button not found`,timestamp:Date.now()}])}catch(L){console.error("[ModalButton] Error:",L),j(W=>[...W,{ideId:B.tabKey,text:`❌ **${P}** error`,timestamp:Date.now()}])}}},mt=async(P,L)=>{try{const W=P||(B==null?void 0:B.daemonId)||"",Q=await e(W,"switch_chat",{id:L,sessionId:L,...(B==null?void 0:B.streamSource)==="agent-stream"&&{agentType:B==null?void 0:B.agentType}}),J=Q==null?void 0:Q.result;(Q==null?void 0:Q.success)===!0||J==="switched"||J==="switched-by-title"||(J===!1||J==="not_found"?l(ue=>[...ue,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof J=="string"&&J.startsWith("error:")?l(ue=>[...ue,{id:Date.now(),message:`⚠️ Switch error: ${J}`,type:"warning",timestamp:Date.now()}]):l(ue=>[...ue,{id:Date.now(),message:"⚠️ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(W){console.error("Switch failed",W),l(Q=>[...Q,{id:Date.now(),message:`❌ Switch failed: ${W.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},ee=async()=>{if(!(!B||$)){E(!0);try{const P=B.ideId||B.daemonId||"";await e(P,"new_chat",{...B.streamSource==="agent-stream"&&{agentType:B.agentType}}),O(L=>({...L,[B.tabKey]:Date.now()})),V(L=>({...L,[B.tabKey]:[]}))}catch(P){console.error("New chat failed",P)}finally{E(!1)}}},[ge,R]=w.useState(!1),q=async()=>{if(!B||ge)return;R(!0);const P=B.tabKey;try{await e(B.ideId,"agent_stream_focus",{agentType:B.agentType}),mr(P,[200,1500,3e3])}catch(L){console.error("Focus agent failed",L)}finally{R(!1)}},de=async()=>{var P;if(!(!B||M)){F(!0);try{const L=B.ideId||B.daemonId||"",W=await e(L,"list_chats",{forceExpand:!0,...B.streamSource==="agent-stream"&&{agentType:B.agentType}}),Q=(W==null?void 0:W.chats)||((P=W==null?void 0:W.result)==null?void 0:P.chats);W!=null&&W.success&&Array.isArray(Q)&&r(B.ideId,Q)}catch(L){console.error("Refresh history failed",L)}finally{F(!1)}}};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(k4,{wsStatus:a,showReconnected:f}),h.jsx(C4,{activeConv:B,agentCount:G.length,wsStatus:a,isConnected:c,onOpenHistory:()=>C(!0)}),h.jsx(L4,{sortedConversations:fe,activeTabId:p,tabsOverflow:b,tabsContainerRef:H,terminalRef:K,onSelectTab:P=>{Qe.current=!0,g(P)},onReorder:xe,pinTab:mr,clearTabPinTimers:pt,retryConnection:u}),h.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden relative",children:B?h.jsxs(h.Fragment,{children:[h.jsx(Gx,{activeConv:B,onModalButton:kt}),h.jsx("div",{className:"desktop-only px-3 pt-1 pb-2",children:!ar(B)&&!Or(B)&&n[B.ideId]?h.jsx(w4,{screenshotUrl:n[B.ideId],mode:"preview",onDismiss:()=>{const P={...n};delete P[B.ideId],i(P)}}):!ar(B)&&!Or(B)&&B.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(rx,{size:14})}),h.jsx("span",{className:"flex-1",children:"CDP not connected — chat history & screenshots unavailable for this IDE."}),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:nn,children:"Relaunch with CDP"})]}):null}),ar(B)&&!Or(B)?h.jsx(b4,{activeConv:B,ptyBuffers:Dr,terminalRef:K,agentInput:_,setAgentInput:y,handleSendChat:_r,handleModalButton:kt}):h.jsx(Qx,{activeConv:B,ides:s,agentInput:_,setAgentInput:y,handleSendChat:_r,handleFocusAgent:q,isFocusingAgent:ge,messageReceivedAt:x,actionLogs:U})]}):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:ye&&k.length>0?16:0},children:ye?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),ye&&k.length>0&&h.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:k.filter(P=>P.running||!0).map(P=>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:()=>rr(P.type),onMouseEnter:L=>L.currentTarget.style.background="rgba(139,92,246,0.2)",onMouseLeave:L=>L.currentTarget.style.background="rgba(139,92,246,0.1)",children:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(qT,{size:14})," Launch ",P.name]})},P.type))})]})]})}),T&&B&&h.jsx(T4,{activeConv:B,ides:s,isCreatingChat:$,isRefreshingHistory:M,onClose:()=>C(!1),onNewChat:ee,onSwitchSession:mt,onRefreshHistory:de}),h.jsx("style",{children:`
166
+ `})]})}function w4({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=w.useRef(null),m=w.useCallback(g=>{if(!n||!o||!p.current)return;const S=p.current,_=S.getBoundingClientRect(),y=(g.clientX-_.left)/_.width*S.naturalWidth,x=(g.clientY-_.top)/_.height*S.naturalHeight;o(y,x,S.naturalWidth,S.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 Gx({activeConv:e,onModalButton:t}){const[r,n]=w.useState(null);if(w.useEffect(()=>{n(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=s=>{r||(n(s),t(s))};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(rx,{size:14})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),h.jsx("div",{className:"flex gap-2 flex-wrap",children:e.modalButtons.map((s,o)=>{const l=s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),a=/^(run|approve|accept|yes|allow|always)/.test(l),c=/^(reject|deny|delete|remove|abort)/.test(l),d=r===s,u=r!==null;return h.jsx("button",{onClick:()=>i(s),disabled:u,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${a?"bg-white text-amber-700 font-extrabold":c?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${u&&!d?"opacity-40":"opacity-100"} ${u?"cursor-not-allowed":"cursor-pointer"}`,children:d?"⏳ ...":s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim()},o)})})]})]})}const xr=new Map;function S4({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var ye;const{sendCommand:a}=Li(),c=!!(o||l),d=`${e}:${r}`,u=xr.get(d),[f,p]=w.useState(!1),[m,g]=w.useState(!1),[S,_]=w.useState((u==null?void 0:u.models)||[]),[y,x]=w.useState((u==null?void 0:u.modes)||[]),N=G=>G?typeof G=="string"?G:typeof G=="object"?G.name||G.id||JSON.stringify(G):String(G):"",[T,C]=w.useState(N(i)),[A,F]=w.useState(N(s)),[W,E]=w.useState(!1),[U,O]=w.useState(!1),D=w.useRef(0),V=G=>G.map(Z=>typeof Z=="string"?Z:(Z==null?void 0:Z.name)||(Z==null?void 0:Z.id)||String(Z));w.useEffect(()=>{if(o){const G=o.find(Z=>Z.category==="model");if(G){const Z=V(G.options.map(ce=>ce.value));_(Z),G.currentValue&&C(N(G.currentValue));const X=xr.get(d)||{models:[],modes:[]};xr.set(d,{...X,models:Z})}}if(l&&l.length>0){const G=V(l.map(X=>X.id));x(G);const Z=xr.get(d)||{models:[],modes:[]};xr.set(d,{...Z,modes:G})}else if(o){const G=o.find(Z=>Z.category!=="model");if(G){const Z=V(G.options.map(ce=>ce.value));x(Z),G.currentValue&&F(N(G.currentValue));const X=xr.get(d)||{models:[],modes:[]};xr.set(d,{...X,modes:Z})}}},[o,l,d]),w.useEffect(()=>{p(!1),g(!1),C(N(i)),F(N(s));const G=xr.get(d);G?(_(G.models),x(G.modes)):(_([]),x([]))},[e,r]),w.useEffect(()=>{i&&Date.now()>D.current&&C(N(i))},[i]),w.useEffect(()=>{s&&Date.now()>D.current&&F(N(s))},[s]);const I=w.useCallback(async(G,Z={})=>{const X={...Z},ce=e.split(":");return ce.length>=3&&(ce[1]==="ide"||ce[1]==="cli"||ce[1]==="acp")&&(X._targetInstance=ce.slice(2).join(":"),X._targetType=ce[1]),await a(e,G,X)},[e]),B=async()=>{var G,Z;if(S.length>0){p(!f);return}if(c){p(!0);return}E(!0);try{const X=await I("list_extension_models",{agentType:r,ideType:t}),ce=(X==null?void 0:X.models)||((G=X==null?void 0:X.result)==null?void 0:G.models)||[],me=V(ce);_(me),X!=null&&X.current&&C(N(X.current)),(Z=X==null?void 0:X.result)!=null&&Z.current&&C(N(X.result.current));const fe=xr.get(d)||{models:[],modes:[]};xr.set(d,{...fe,models:me}),p(!0)}catch{}finally{E(!1)}},K=async()=>{var G,Z;if(y.length>0){g(!m);return}if(c){g(!0);return}O(!0);try{const X=await I("list_extension_modes",{agentType:r,ideType:t}),ce=(X==null?void 0:X.modes)||((G=X==null?void 0:X.result)==null?void 0:G.modes)||[],me=V(ce);x(me),X!=null&&X.current&&F(N(X.current)),(Z=X==null?void 0:X.result)!=null&&Z.current&&F(N(X.result.current));const fe=xr.get(d)||{models:[],modes:[]};xr.set(d,{...fe,modes:me}),g(!0)}catch{}finally{O(!1)}},R=async G=>{p(!1),C(G),D.current=Date.now()+5e3;try{c?await I("change_model",{agentType:r,ideType:t,model:G}):await I("set_extension_model",{agentType:r,ideType:t,model:G})}catch{}},$=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(G=>G.category!=="model")),b=$?(ye=o==null?void 0:o.find(G=>G.category!=="model"))==null?void 0:ye.configId:void 0,te=async G=>{g(!1),F(G),D.current=Date.now()+5e3;try{c&&$&&b?await I("set_thought_level",{agentType:r,ideType:t,configId:b,value:G}):c?await I("set_mode",{agentType:r,ideType:t,mode:G}):await I("set_extension_mode",{agentType:r,ideType:t,mode:G})}catch{}},k={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:k},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?`${k}55`:"transparent",border:"1px solid",color:T?"var(--text-primary)":"var(--text-muted)"},onClick:B,children:[h.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),W?"...":T||"Model",h.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),f&&S.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"}),S.map(G=>h.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:G===T?`${k}18`:"transparent",color:G===T?k:"var(--text-secondary)",fontWeight:G===T?600:400,borderLeft:G===T?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Z=>{Z.currentTarget.style.background=`${k}12`},onMouseLeave:Z=>{Z.currentTarget.style.background=G===T?`${k}18`:"transparent"},onClick:()=>R(G),children:G},G))]})]})]}),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?`${k}55`:"transparent",border:"1px solid",color:A?"var(--text-primary)":"var(--text-muted)"},onClick:K,children:[h.jsx("span",{className:"text-[9px] opacity-60",children:$?"🧠":"⚡"}),U?"...":A||($?"Thinking":"Mode"),h.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),m&&y.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>g(!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 THINKING LEVEL":"SELECT MODE"}),y.map(G=>h.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:G===A?`${k}18`:"transparent",color:G===A?k:"var(--text-secondary)",fontWeight:G===A?600:400,borderLeft:G===A?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Z=>{Z.currentTarget.style.background=`${k}12`},onMouseLeave:Z=>{Z.currentTarget.style.background=G===A?`${k}18`:"transparent"},onClick:()=>te(G),children:G},G))]})]})]})]})}const ar=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),Or=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function Qx({activeConv:e,ides:t,agentInput:r,setAgentInput:n,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a}){const c=w.useRef(null),{sendCommand:d}=Li(),[u,f]=w.useState([]),[p,m]=w.useState(0),[g,S]=w.useState(!0),[_,y]=w.useState(!1),x=w.useRef("");e.tabKey!==x.current&&(x.current=e.tabKey,f([]),m(0),S(!0));const N=w.useCallback(async()=>{var A,F,W,E,U,O;if(!(_||!g)){y(!0);try{const D=t.find($=>$.id===e.ideId),V=(D==null?void 0:D.daemonId)||((A=e.ideId)==null?void 0:A.split(":")[0])||"";if(!V){S(!1);return}const I=e.ideType||e.agentType||"",B=(e.ideId||"").split(":"),K=B.length>=3?B.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:V,agentType:I,instanceId:K,offset:p});const R=await d(V,"chat_history",{agentType:I,offset:p,limit:30,instanceId:K});console.log("[ChatPane] got result:",{count:((F=R.messages)==null?void 0:F.length)||0,hasMore:R.hasMore}),((W=R.messages)==null?void 0:W.length)>0&&(f($=>[...R.messages,...$]),m($=>$+R.messages.length)),S(R.hasMore)}catch(D){console.warn("[ChatPane] Failed to load history:",D),!((E=D==null?void 0:D.message)!=null&&E.includes("P2P not available"))&&!((U=D==null?void 0:D.message)!=null&&U.includes("channel not open"))&&!((O=D==null?void 0:D.message)!=null&&O.includes("P2P not connected"))&&S(!1)}finally{y(!1)}}},[_,g,p,t,e]),T=w.useRef(0);w.useEffect(()=>{if(e.messages.length<10&&g&&!_&&u.length===0){const A=T.current;if(A>5)return;const W=setTimeout(()=>{T.current=A+1,N()},A===0?0:2e3);return()=>clearTimeout(W)}else u.length>0&&(T.current=0)},[e.tabKey,e.messages.length,g,_,u.length,N]);const C=(()=>{const A=e.messages.map((E,U)=>{const O=`${e.ideId}-${E.id??`i-${U}`}`;return{...E,receivedAt:E.receivedAt||l[O]||0}});if(u.length===0)return A;const F=new Set(A.map(E=>`${E.role}:${(E.content||"").slice(0,100)}`));return[...u.filter(E=>!F.has(`${E.role}:${(E.content||"").slice(0,100)}`)),...A]})();return h.jsxs(h.Fragment,{children:[h.jsx(ix,{messages:C,actionLogs:a.filter(A=>A.ideId===e.tabKey).sort((A,F)=>A.timestamp-F.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",isCliMode:ar(e)||Or(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:N,isLoadingMore:_,hasMoreHistory:g,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(nx,{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(lo,{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(UT,{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(lo,{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}),!ar(e)&&(()=>{const A=t.find(F=>F.id===e.ideId);return h.jsx(S4,{ideId:e.ideId,ideType:e.ideType,agentType:e.streamSource==="agent-stream"?e.agentType:e.ideType,agentName:e.streamSource==="agent-stream"?e.agentName:e.displaySecondary,serverModel:(A==null?void 0:A.currentModel)||void 0,serverMode:(A==null?void 0:A.currentPlan)||void 0,acpConfigOptions:Or(e)?A==null?void 0:A.acpConfigOptions:void 0,acpModes:Or(e)?A==null?void 0:A.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:c,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:A=>n(A.target.value),onPaste:A=>{const F=A.clipboardData.getData("text");F&&n(W=>W+F),A.preventDefault()},onKeyDown:A=>{if(A.key==="Enter"){if(A.nativeEvent.isComposing){A.preventDefault();return}A.preventDefault(),i()}},onBlur:()=>{window.innerWidth<768&&setTimeout(()=>{document.documentElement.scrollTop=0},100)},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"})})})]})})]})}function b4({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){const l=w.useRef(null),{sendCommand:a,sendData:c}=Li();return 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 d=t.current.get(e.tabKey);if(d&&d.length>0)for(const u of d)r.current.write(u);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var u;(u=r.current)==null||u.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 f;const d=(f=e.ideId)!=null&&f.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";if(!window.confirm(`Stop ${d}?
167
+ This will terminate the CLI process.`))return;const u=e.ideId||e.daemonId||"";try{await a(u,"stop_cli",{cliType:d})}catch(p){console.error("Stop CLI failed:",p)}},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(Gx,{activeConv:e,onModalButton:o}),h.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:h.jsx(Xx,{ref:r,onInput:d=>{var p;const u=e.ideId||e.daemonId||"",f=(p=e.ideId)!=null&&p.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(u,{type:"pty_input",cliType:f,data:d})||a(u,"pty_input",{cliType:f,data:d}).catch(console.error)},onResize:(d,u)=>{var m;const f=e.ideId||e.daemonId||"",p=(m=e.ideId)!=null&&m.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(f,{type:"pty_resize",cliType:p,cols:d,rows:u})||a(f,"pty_resize",{cliType:p,cols:d,rows:u,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:d=>i(d.target.value),onPaste:d=>{const u=d.clipboardData.getData("text");u&&i(f=>f+u),d.preventDefault()},onKeyDown:d=>{if(d.key==="Enter"){if(d.nativeEvent.isComposing){d.preventDefault();return}d.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 k4({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 au=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),cu=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function C4({activeConv:e,agentCount:t,wsStatus:r,isConnected:n,onOpenHistory:i}){const s=gs(),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(xf,{size:18})," Dashboard",h.jsxs("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:[t," Active",h.jsx("span",{className:"inline-block w-[5px] h-[5px] rounded-full ml-1 align-middle",style:{background:o}})]})]}),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&&!au(e)&&!cu(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(KT,{size:14})," IDE"]}),e&&!au(e)&&!cu(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($T,{size:16})}),e&&!au(e)&&!cu(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(oo,{size:16})})]})]})}function Xr(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function E4(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 l_(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function a_(e){return(e.id||"").includes(":cli:")}function c_(e){return(e.id||"").includes(":acp:")}function rd(e,t){return Xr(e)}function N4(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 T4({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," — ",Xr(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(GT,{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(HT,{size:13})," Refresh History"]})})})]})]})}function L4({sortedConversations:e,activeTabId:t,tabsOverflow:r,tabsContainerRef:n,terminalRef:i,onSelectTab:s,onReorder:o,pinTab:l,clearTabPinTimers:a,retryConnection:c}){const{sendCommand:d}=Li(),u=w.useRef(null),f=w.useRef(null),p=w.useRef(null),m=w.useRef(null),[g,S]=w.useState(!1),_=w.useCallback((W,E)=>{const U=E.touches[0];p.current={x:U.clientX,y:U.clientY},f.current=W,m.current=setTimeout(()=>{S(!0)},400)},[]),y=w.useCallback(W=>{if(!g||!f.current){m.current&&(clearTimeout(m.current),m.current=null);return}W.preventDefault();const E=W.touches[0],U=n.current;if(!U)return;const O=Array.from(U.querySelectorAll("[data-tabkey]"));for(const D of O){const V=D.getBoundingClientRect();if(E.clientX>=V.left&&E.clientX<=V.right){const I=D.getAttribute("data-tabkey");if(I&&I!==f.current){const B=e.map($=>$.tabKey),K=B.indexOf(f.current),R=B.indexOf(I);if(K!==-1&&R!==-1){const $=[...B];$.splice(K,1),$.splice(R,0,f.current),o($)}}break}}},[g,e,n,o]),x=w.useCallback(()=>{m.current&&(clearTimeout(m.current),m.current=null),S(!1),f.current=null,p.current=null},[]),[N,T]=w.useState(!1),[C,A]=w.useState(!1),F=w.useCallback(()=>{const W=n.current;W&&(T(W.scrollLeft>4),A(W.scrollLeft+W.clientWidth<W.scrollWidth-4))},[n]);return w.useEffect(()=>{const W=n.current;if(!W)return;F(),W.addEventListener("scroll",F,{passive:!0});const E=new ResizeObserver(F);return E.observe(W),()=>{W.removeEventListener("scroll",F),E.disconnect()}},[n,F,e.length]),h.jsxs("div",{className:"relative shrink-0",children:[r&&N&&h.jsx("div",{className:"absolute left-0 top-0 bottom-0 z-[3] w-5 pointer-events-none",style:{background:"linear-gradient(to right, var(--bg-secondary), transparent)"}}),r&&C&&h.jsx("div",{className:"absolute right-0 top-0 bottom-0 z-[3] w-5 pointer-events-none",style:{background:"linear-gradient(to left, var(--bg-secondary), transparent)"}}),h.jsxs("div",{ref:n,className:"dashboard-agent-tabs flex overflow-x-auto overflow-y-visible shrink-0 bg-bg-secondary border-b border-border-subtle pt-1.5 pb-0 gap-1 select-none",onWheel:W=>{const E=n.current;E&&Math.abs(W.deltaY)>Math.abs(W.deltaX)&&(W.preventDefault(),E.scrollLeft+=W.deltaY)},style:{paddingLeft:8,paddingRight:8,scrollbarWidth:"none",WebkitOverflowScrolling:"touch"},children:[e.map((W,E)=>{const U=t===W.tabKey,O=W.status==="working"?"agent-tab-working":W.status==="waiting_approval"?"agent-tab-waiting":"",D=E<9?String(E+1):null,V=W.connectionState==="gave_up";return h.jsxs("div",{"data-tabkey":W.tabKey,className:`${O} shrink-0 px-2.5 py-1.5 rounded-t-lg border-b-0 cursor-grab flex items-center gap-2 transition-all duration-200`,draggable:!0,onDragStart:()=>{u.current=W.tabKey},onDragOver:I=>{I.preventDefault(),I.currentTarget.style.borderLeft="2px solid var(--accent-primary)"},onDragLeave:I=>{I.currentTarget.style.borderLeft=U?"1px solid var(--border-subtle)":"1px solid transparent"},onDrop:I=>{if(I.preventDefault(),I.currentTarget.style.borderLeft=U?"1px solid var(--border-subtle)":"1px solid transparent",!u.current||u.current===W.tabKey)return;const B=e.map(b=>b.tabKey),K=B.indexOf(u.current),R=B.indexOf(W.tabKey);if(K===-1||R===-1)return;const $=[...B];$.splice(K,1),$.splice(R,0,u.current),o($),u.current=null},onDragEnd:()=>{u.current=null},onTouchStart:I=>_(W.tabKey,I),onTouchMove:y,onTouchEnd:x,onClick:()=>{a(),s(W.tabKey),W.streamSource==="agent-stream"&&W.agentType&&(d(W.ideId,"agent_stream_focus",{agentType:W.agentType}).catch(()=>{}),l(W.tabKey,[200,1500])),ar(W)&&setTimeout(()=>{var I,B;(B=(I=i.current)==null?void 0:I.bumpResize)==null||B.call(I)},100)},style:{background:U?"var(--bg-primary)":"var(--bg-glass)",borderTop:U?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:U?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:U?"1px solid var(--border-subtle)":"1px solid transparent",opacity:g&&f.current===W.tabKey?V?.15:.3:V?U?.6:.3:U?1:.65},children:[W.status==="working"?h.jsx("div",{className:"tab-spinner"}):W.status==="waiting_approval"?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400",children:"▲"}):W.connectionState==="gave_up"?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-red-400",children:"●"}):W.connectionState==="connecting"?h.jsx("span",{className:"text-[8px] px-[5px] py-px text-blue-400",children:"○"}):W.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:W.displayPrimary}),h.jsx("div",{className:"text-[8px] opacity-50 flex gap-1 items-center",children:V?h.jsx("span",{className:"text-red-400 opacity-100",children:"Disconnected"}):h.jsxs(h.Fragment,{children:[W.displaySecondary,W.machineName&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"opacity-40",children:"·"}),h.jsxs("span",{className:"opacity-70",children:["🖥 ",W.machineName]})]})]})})]}),V?h.jsx("button",{onClick:I=>{var K;I.stopPropagation();const B=W.daemonId||((K=W.ideId)==null?void 0:K.split(":")[0])||"";c==null||c(B)},title:"Reconnect",className:"shrink-0 ml-1 text-[11px] px-1.5 py-0.5 rounded cursor-pointer transition-all hover:scale-110",style:{background:"var(--accent-primary)",color:"white",border:"none",opacity:1},children:"↻"}):D?h.jsx("span",{className:"text-[9px] opacity-35 font-mono ml-0.5 shrink-0",children:D}):null]},W.tabKey)}),e.length===0&&h.jsx("div",{className:"p-2 text-xs opacity-40",children:"No active agents online."})]})]})}const u_={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function P4({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.jsx("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:u_[n.type]||u_.info},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const D4=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function I4(e){var n;const t=(n=e.workspaceFolders)==null?void 0:n[0];return t!=null&&t.name?t.name:((t==null?void 0:t.path)??"").split("/").filter(Boolean).pop()||"Workspace"}function R4(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 S,_,y,x,N;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((S=o.id)==null?void 0:S.split(":")[0])||o.id,d=n?n[c]||"new":void 0,u=I4(o),f=Xr(o.type),p=o.agentStreams,m=Array.isArray(p)?p:[],g=D4(o);if(g){const T=rd(o.type),C=(_=o.agents)==null?void 0:_[0],A=(y=o.activeChat)==null?void 0:y.activeModal,F=A&&Array.isArray(A.buttons)&&A.buttons.length>0,W=(x=o.activeChat)==null?void 0:x.status,E=W==="generating"||W==="loading"||W&&W.toLowerCase()==="thinking",O=F||W==="waiting_approval"?"waiting_approval":E?"working":(C==null?void 0:C.status)||"idle",D=o.activeChat||{title:"",messages:[]};let V=D.title&&String(D.title).trim()?String(D.title).trim():"";const I=(N=o.activeChat)==null?void 0:N.id,B=o.chats;if(I&&Array.isArray(B)&&B.length>0){const te=B.find(ae=>ae.id===I||ae.id&&String(ae.id)===String(I));te!=null&&te.title&&String(te.title).trim()&&(V=String(te.title).trim())}const K=D.messages||[],R=t[o.id]||[],$=new Map;K.filter(te=>te.role==="user").forEach(te=>{$.set(te.content,($.get(te.content)||0)+1)});const b=R.filter(te=>{const ae=$.get(te.content)||0;return ae>0?($.set(te.content,ae-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:T,agentType:ar(o)||Or(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:O,title:V,messages:[...K,...b],ideType:o.type,workspaceName:u,displayPrimary:V||T||u,displaySecondary:f,cdpconnected:o.cdpconnected,modalButtons:F?A.buttons:void 0,modalMessage:F?A.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,connectionState:d})}if(g&&(ar(o)||Or(o)))return l;for(const T of m){const C=T.activeModal&&Array.isArray(T.activeModal.buttons)&&T.activeModal.buttons.length>0,A=C?"waiting_approval":T.status==="streaming"?"working":T.status,F=`${o.id}:${T.agentType}`,W=T.messages||[],E=t[F]||[],U=new Map;W.filter(D=>D.role==="user").forEach(D=>{U.set(D.content,(U.get(D.content)||0)+1)});const O=E.filter(D=>{const V=U.get(D.content)||0;return V>0?(U.set(D.content,V-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:T.agentName,agentType:T.agentType,status:A,title:"",messages:[...W,...O],ideType:o.type,workspaceName:u,displayPrimary:T.agentName,displaySecondary:f,cdpconnected:o.cdpconnected,modalButtons:C?T.activeModal.buttons:void 0,modalMessage:C?T.activeModal.message:void 0,streamSource:"agent-stream",tabKey:F,machineName:a,connectionState:d})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:rd(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:u,displayPrimary:u||f,displaySecondary:f,cdpconnected:o.cdpconnected,streamSource:"native",tabKey:o.id,connectionState:d}),l})}function M4(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function h_(){try{const e=localStorage.getItem("theme");if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function uu(e){return e==="system"?M4():e}function A4(){const[e,t]=w.useState(h_),[r,n]=w.useState(()=>uu(h_()));w.useEffect(()=>{document.documentElement.setAttribute("data-theme",r)},[r]),w.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=w.useCallback(o=>{t(o),n(uu(o));try{localStorage.setItem("theme",o)}catch{}},[]),s=w.useCallback(()=>{t(o=>{const l=o==="dark"?"light":o==="light"?"system":"dark";n(uu(l));try{localStorage.setItem("theme",l)}catch{}return l})},[]);return{theme:r,preference:e,setPreference:i,cycleTheme:s,isDark:r==="dark"}}const d_={dark:"Dark",light:"Light",system:"System"};function j4({collapsed:e}){const{preference:t,cycleTheme:r}=A4(),n=t==="dark"?h.jsx(ZT,{size:16}):t==="light"?h.jsx(QT,{size:16}):h.jsx(JT,{size:16});return h.jsxs("div",{className:`nav-item cursor-pointer ${e?"justify-center py-2.5 px-0":""}`,onClick:r,title:`Theme: ${d_[t]} (click to cycle)`,children:[h.jsx("span",{className:"nav-icon",children:n}),!e&&h.jsx("span",{className:"text-xs",children:d_[t]})]})}let B4=Y0;function Df(){return B4()}class O4{constructor(){ws(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 z4=new O4;class F4{constructor(){ws(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 Xt=new F4,f_=Xt;const $4={enabled:!0,onApproval:!0,onComplete:!0,onError:!0,throttleMs:5e3};async function W4(){return"Notification"in window?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"}function Zx(){return"Notification"in window&&Notification.permission==="granted"}let ni=null;async function H4(){if(ni!==null)return ni;try{if(!("serviceWorker"in navigator)||!("PushManager"in window))return ni=!1,!1;const e=await navigator.serviceWorker.getRegistration();return e?(ni=!!await e.pushManager.getSubscription(),ni):(ni=!1,!1)}catch{return ni=!1,!1}}function U4(e,t,r){if(Zx())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 V4(e,t={}){const r={...$4,...t},n=w.useRef(new Map),i=w.useRef(0),s=w.useRef(null);w.useEffect(()=>{H4().then(l=>{s.current=l})},[]);const o=w.useCallback((l,a,c)=>{const d=Date.now();d-i.current<r.throttleMs||(i.current=d,U4(l,a,c))},[r.throttleMs]);w.useEffect(()=>{var l;if(!(!r.enabled||!Zx())&&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&&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&&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])}function K4(){const{sendCommand:e}=Li(),t=Df(),{updateIdeChats:r,screenshotMap:n,setScreenshotMap:i}=t,s=t.ides||[],o=t.toasts||[],l=t.setToasts||(()=>{}),a=t.wsStatus||"connected",c=t.isConnected??!0,d=t.connectionStates||{},u=t.retryConnection,f=t.showReconnected||!1,[p,m]=w.useState(()=>{try{const L=new URLSearchParams(window.location.search).get("activeTab");return L||sessionStorage.getItem("adhdev_dashboard_activeTab")}catch{return null}}),g=w.useCallback(P=>{m(P);try{P?sessionStorage.setItem("adhdev_dashboard_activeTab",P):sessionStorage.removeItem("adhdev_dashboard_activeTab")}catch{}},[]),S=w.useRef([]),[_,y]=w.useState(""),[x,N]=w.useState({}),[T,C]=w.useState(!1),[A,F]=w.useState(!1),[W,E]=w.useState(!1),[U,O]=w.useState([]),[D,V]=w.useState({}),[I,B]=w.useState({}),K=w.useRef(null),R=w.useRef(null),$=w.useRef(null),[b,te]=w.useState(!1),ae=s.find(P=>P.type==="adhdev-daemon"),k=(ae==null?void 0:ae.detectedIdes)||[],ye=!!ae,G=w.useMemo(()=>{var H,Q;const P=s.filter(J=>J.type!=="adhdev-daemon"),L=new Map;for(const J of P){const le=L.get(J.id);if(!le)L.set(J.id,J);else{const ue=(((H=le.workspaceFolders)==null?void 0:H.length)||0)+(le.activeChat?1:0);((((Q=J.workspaceFolders)==null?void 0:Q.length)||0)+(J.activeChat?1:0)>ue||(J.timestamp||0)>(le.timestamp||0))&&L.set(J.id,J)}}return Array.from(L.values())},[s]),Z=w.useMemo(()=>{const P=R4(G,D,s,d),L=Date.now();return P.map(H=>{const Q=I[H.tabKey];return Q&&L-Q<5e3?{...H,messages:[],title:""}:H})},[G,D,I,s]);w.useEffect(()=>{W4()},[]);const X=w.useMemo(()=>Z.map(P=>({id:P.tabKey,name:P.title||P.agentName||P.ideId,status:P.status,activeModal:P.modalMessage?{message:P.modalMessage,buttons:P.modalButtons}:null})),[Z]);V4(X);const[ce,me]=w.useState(()=>{try{return JSON.parse(sessionStorage.getItem("adhdev_tabOrder")||"[]")}catch{return[]}}),fe=w.useMemo(()=>{if(ce.length===0)return Z;const P=new Map(ce.map((L,H)=>[L,H]));return[...Z].sort((L,H)=>{const Q=P.get(L.tabKey)??9999,J=P.get(H.tabKey)??9999;return Q-J})},[Z,ce]);w.useEffect(()=>{const P=$.current;if(!P)return;const L=()=>te(P.scrollWidth>P.clientWidth+2);L();const H=new ResizeObserver(L);return H.observe(P),P.addEventListener("scroll",L),()=>{H.disconnect(),P.removeEventListener("scroll",L)}},[fe.length]);const xe=w.useCallback(P=>{me(P);try{sessionStorage.setItem("adhdev_tabOrder",JSON.stringify(P))}catch{}},[]);w.useEffect(()=>{if(Object.keys(I).length===0)return;const L=setTimeout(()=>{B(H=>{const Q=Date.now(),J={};for(const[le,ue]of Object.entries(H))Q-ue<5e3&&(J[le]=ue);return Object.keys(J).length===Object.keys(H).length?H:J})},5500);return()=>clearTimeout(L)},[I]);const j=fe.find(P=>P.tabKey===p),Ce=fe.map(P=>P.tabKey).join(","),Qe=w.useRef(!1);w.useEffect(()=>{if(fe.length===0||Qe.current&&p&&fe.some(L=>L.tabKey===p))return;const P=fe.find(L=>L.cdpconnected===!0);P?g(P.tabKey):(!p||!fe.some(L=>L.tabKey===p))&&g(fe[0].tabKey)},[Ce]);const pt=w.useCallback(()=>{S.current.forEach(P=>clearTimeout(P)),S.current=[]},[]),mr=w.useCallback((P,L)=>{pt();for(const H of L)S.current.push(setTimeout(()=>g(P),H))},[pt]);w.useEffect(()=>{var H;if(!((H=j==null?void 0:j.messages)!=null&&H.length))return;const P=j.ideId,L=Date.now();N(Q=>{let J=!1;const le={...Q};return j.messages.forEach((ue,ie)=>{const _e=`${P}-${ue.id??`i-${ie}`}`;le[_e]==null&&(le[_e]=L,J=!0)}),J?le:Q})},[j==null?void 0:j.ideId,j==null?void 0:j.messages]);const gr=w.useRef(!1);w.useEffect(()=>{if(!T){gr.current=!1;return}if(!j||gr.current||A)return;const P=s.find(L=>L.id===j.ideId);P&&(!P.chats||P.chats.length===0)&&(gr.current=!0,de())},[T,j==null?void 0:j.ideId]),w.useEffect(()=>{const P=setInterval(()=>{const L=Date.now()-3e5;O(H=>{const Q=H.filter(J=>J.timestamp>L).slice(-100);return Q.length===H.length?H:Q})},6e4);return()=>clearInterval(P)},[]);const Dr=w.useRef(new Map);w.useEffect(()=>{const P=(H,Q)=>{var ie,_e,we;if(!Q)return;for(const Le of Z){if(!ar(Le))continue;const nt=(ie=Le.ideId)!=null&&ie.includes(":cli:")?Le.ideId.split(":cli:")[1]:"";if(H===nt||H===Le.agentType||H===Le.ideType){const vr=Dr.current.get(Le.tabKey)||[];vr.push(Q),vr.length>1e4&&vr.splice(0,vr.length-5e3),Dr.current.set(Le.tabKey,vr)}}const J=j&&ar(j),le=(_e=j==null?void 0:j.ideId)!=null&&_e.includes(":cli:")?j.ideId.split(":cli:")[1]:"",ue=H===le||H===(j==null?void 0:j.agentType)||H===(j==null?void 0:j.ideType);J&&ue&&((we=K.current)==null||we.write(Q))},L=f_.onPtyOutput(P);return()=>{L()}},[j==null?void 0:j.agentType,j==null?void 0:j.ideType,j==null?void 0:j.tabKey,Z]),w.useEffect(()=>{if(!j||!ar(j))return;const L=setTimeout(()=>{if(K.current){const H=Dr.current.get(j.tabKey);if(H&&H.length>0)for(const Q of H)K.current.write(Q);K.current.bumpResize()}},200);return()=>clearTimeout(L)},[j==null?void 0:j.tabKey]),w.useEffect(()=>{if(!j)return;const P=setTimeout(()=>{var L;(L=R.current)==null||L.focus()},150);return()=>clearTimeout(P)},[j==null?void 0:j.tabKey]),w.useEffect(()=>{const P=L=>{var ue,ie,_e,we,Le,be;const H=parseInt(L.key);if(isNaN(H)||H<1||H>9)return;if(L.ctrlKey){L.preventDefault();const nt=fe[H-1];nt&&(pt(),g(nt.tabKey));return}const Q=(ue=document.activeElement)==null?void 0:ue.tagName,J=Q==="INPUT"||Q==="TEXTAREA"||((ie=document.activeElement)==null?void 0:ie.isContentEditable),le=((we=(_e=document.activeElement)==null?void 0:_e.closest)==null?void 0:we.call(_e,".xterm-helper-textarea"))!=null||((be=(Le=document.activeElement)==null?void 0:Le.classList)==null?void 0:be.contains("xterm-helper-textarea"));if(!J&&!le){L.preventDefault();const nt=fe[H-1];nt&&(pt(),g(nt.tabKey))}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[fe,pt,g]),w.useEffect(()=>{const P=z4.on("status_event",L=>{var le;const H=Xr(L.ideType||"");let Q="",J="info";if(L.event==="agent:generating_completed"){const ue=L.duration?` (${L.duration}s)`:"";Q=`✅ ${H} agent task completed${ue}`,J="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(L.ideId){const ie={role:"system",timestamp:Date.now(),content:`✅ Task completed${ue}`,_localId:`sys_complete_${Date.now()}`};V(_e=>{for(const we of Object.keys(_e))if(we.includes(L.ideId))return{..._e,[we]:[..._e[we]||[],ie]};return _e})}}else if(L.event==="agent:generating_started")L.ideId&&V(ue=>{const ie={...ue};for(const _e of Object.keys(ie))_e.includes(L.ideId)&&(ie[_e]=(ie[_e]||[]).filter(we=>{var Le;return!(we.role==="system"&&((Le=we._localId)!=null&&Le.startsWith("sys_complete_")))}));return ie});else if((L.event==="agent:waiting_approval"||L.event==="agent:approval_needed")&&(Q=`⚡ ${H} approval needed`,J="warning",L.ideId)){const ue=L.modalMessage||"Approval requested",ie=(le=L.modalButtons)!=null&&le.length?L.modalButtons.map(we=>`[${we}]`).join(" "):"[Approve] [Reject]",_e={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${ue}
168
+ ${ie}`,_localId:`sys_approval_${Date.now()}`};V(we=>{for(const Le of Object.keys(we))if(Le.includes(L.ideId))return{...we,[Le]:[...we[Le]||[],_e]};return we})}if(Q){const ue=Date.now();l(ie=>[...ie.slice(-4),{id:ue,message:Q,type:J,timestamp:ue,ideId:L.ideId}]),setTimeout(()=>l(ie=>ie.filter(_e=>_e.id!==ue)),5e3)}});return()=>P()},[]),w.useEffect(()=>{var L;const P=H=>{const Q=H.data;(Q==null?void 0:Q.type)==="notification_action"&&Q.action==="approve"&&Q.ideId&&e(Q.ideId,"resolve_action",{action:"approve",button:"Approve"}).catch(J=>console.error("[SW Action] approve failed:",J))};return(L=navigator.serviceWorker)==null||L.addEventListener("message",P),()=>{var H;return(H=navigator.serviceWorker)==null?void 0:H.removeEventListener("message",P)}},[]);const _r=async()=>{if(!j)return;const P=_.trim();if(!P)return;const L=j.ideId,H=j.tabKey;y(""),mr(H,[100,500,1500,3e3]);const Q=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,J={role:"user",content:P,timestamp:Date.now(),_localId:Q};V(le=>({...le,[H]:[...le[H]||[],J]}));try{if(ar(j)&&!Or(j)){const le=L||j.daemonId||"";if(!le)return;const ue=j.ideType||j.agentType||"";await e(le,"agent_command",{agentType:ue,cliType:ue,action:"send_chat",message:P,text:P})}else if(Or(j)){const le=L||j.daemonId||"";if(!le)return;await e(le,"send_chat",{message:P,text:P,agentType:j.agentType})}else{const le=L||j.daemonId||"";if(!le)return;await e(le,"send_chat",{message:P,text:P,...j.streamSource==="agent-stream"&&{agentType:j.agentType}})}setTimeout(()=>{const le=Date.now()-6e4;V(ue=>{const ie=ue[H];if(!ie)return ue;const _e=ie.filter(we=>we.timestamp>le);return _e.length===ie.length?ue:{...ue,[H]:_e}})},6e4)}catch(le){console.error("Send failed",le),y(P),V(ue=>({...ue,[H]:(ue[H]||[]).filter(ie=>ie._localId!==Q)}))}},nn=async()=>{if(j)try{ye?await e(j.ideId,"launch_ide",{ideType:j.ideType,enableCdp:!0}):await e(j.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(P){console.error("Relaunch failed",P)}},rr=async P=>{try{await e("standalone","launch_ide",{ideType:P,enableCdp:!0})}catch(L){console.error("Launch failed",L)}},kt=async P=>{if(j){console.log("[ModalButton] ideId:",j.ideId,"button:",P,"agentType:",j.agentType,"source:",j.streamSource),O(L=>[...L,{ideId:j.tabKey,text:`🖱️ **${P}** clicked`,timestamp:Date.now()}]);try{let L;if(ar(j)&&!Or(j)){const Q=(j.modalButtons||[]).indexOf(P),J=P.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase();let le;Q>=0?le=`${Q+1}\r`:/^(deny|no|reject|cancel)/.test(J)?le="3\r":/always/.test(J)?le="2\r":le="1\r";const ue=j.daemonId||j.ideId,ie=j.ideType||j.agentType||"";f_.sendPtyInput(ue,ie,le)||await e(ue,"pty_input",{cliType:ie,data:le}),L={success:!0}}else{const H=P.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),Q=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(H),J=j.ideId||j.daemonId||"";L=await e(J,"resolve_action",{button:P,action:Q?"approve":"reject",...j.streamSource==="agent-stream"&&{agentType:j.agentType}})}console.log("[ModalButton] result:",L),L.success||O(H=>[...H,{ideId:j.tabKey,text:`⚠️ **${P}** failed — button not found`,timestamp:Date.now()}])}catch(L){console.error("[ModalButton] Error:",L),O(H=>[...H,{ideId:j.tabKey,text:`❌ **${P}** error`,timestamp:Date.now()}])}}},mt=async(P,L)=>{try{const H=P||(j==null?void 0:j.daemonId)||"",Q=await e(H,"switch_chat",{id:L,sessionId:L,...(j==null?void 0:j.streamSource)==="agent-stream"&&{agentType:j==null?void 0:j.agentType}}),J=Q==null?void 0:Q.result;(Q==null?void 0:Q.success)===!0||J==="switched"||J==="switched-by-title"||(J===!1||J==="not_found"?l(ue=>[...ue,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof J=="string"&&J.startsWith("error:")?l(ue=>[...ue,{id:Date.now(),message:`⚠️ Switch error: ${J}`,type:"warning",timestamp:Date.now()}]):l(ue=>[...ue,{id:Date.now(),message:"⚠️ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(H){console.error("Switch failed",H),l(Q=>[...Q,{id:Date.now(),message:`❌ Switch failed: ${H.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},ee=async()=>{if(!(!j||W)){E(!0);try{const P=j.ideId||j.daemonId||"";await e(P,"new_chat",{...j.streamSource==="agent-stream"&&{agentType:j.agentType}}),B(L=>({...L,[j.tabKey]:Date.now()})),V(L=>({...L,[j.tabKey]:[]}))}catch(P){console.error("New chat failed",P)}finally{E(!1)}}},[ge,M]=w.useState(!1),q=async()=>{if(!j||ge)return;M(!0);const P=j.tabKey;try{await e(j.ideId,"agent_stream_focus",{agentType:j.agentType}),mr(P,[200,1500,3e3])}catch(L){console.error("Focus agent failed",L)}finally{M(!1)}},de=async()=>{var P;if(!(!j||A)){F(!0);try{const L=j.ideId||j.daemonId||"",H=await e(L,"list_chats",{forceExpand:!0,...j.streamSource==="agent-stream"&&{agentType:j.agentType}}),Q=(H==null?void 0:H.chats)||((P=H==null?void 0:H.result)==null?void 0:P.chats);H!=null&&H.success&&Array.isArray(Q)&&r(j.ideId,Q)}catch(L){console.error("Refresh history failed",L)}finally{F(!1)}}};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(k4,{wsStatus:a,showReconnected:f}),h.jsx(C4,{activeConv:j,agentCount:G.length,wsStatus:a,isConnected:c,onOpenHistory:()=>C(!0)}),h.jsx(L4,{sortedConversations:fe,activeTabId:p,tabsOverflow:b,tabsContainerRef:$,terminalRef:K,onSelectTab:P=>{Qe.current=!0,g(P)},onReorder:xe,pinTab:mr,clearTabPinTimers:pt,retryConnection:u}),h.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden relative",children:j?h.jsxs(h.Fragment,{children:[h.jsx(Gx,{activeConv:j,onModalButton:kt}),h.jsx("div",{className:"desktop-only px-3 pt-1 pb-2",children:!ar(j)&&!Or(j)&&n[j.ideId]?h.jsx(w4,{screenshotUrl:n[j.ideId],mode:"preview",onDismiss:()=>{const P={...n};delete P[j.ideId],i(P)}}):!ar(j)&&!Or(j)&&j.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(rx,{size:14})}),h.jsx("span",{className:"flex-1",children:"CDP not connected — chat history & screenshots unavailable for this IDE."}),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:nn,children:"Relaunch with CDP"})]}):null}),ar(j)&&!Or(j)?h.jsx(b4,{activeConv:j,ptyBuffers:Dr,terminalRef:K,agentInput:_,setAgentInput:y,handleSendChat:_r,handleModalButton:kt}):h.jsx(Qx,{activeConv:j,ides:s,agentInput:_,setAgentInput:y,handleSendChat:_r,handleFocusAgent:q,isFocusingAgent:ge,messageReceivedAt:x,actionLogs:U})]}):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:ye&&k.length>0?16:0},children:ye?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),ye&&k.length>0&&h.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:k.filter(P=>P.running||!0).map(P=>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:()=>rr(P.type),onMouseEnter:L=>L.currentTarget.style.background="rgba(139,92,246,0.2)",onMouseLeave:L=>L.currentTarget.style.background="rgba(139,92,246,0.1)",children:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(qT,{size:14})," Launch ",P.name]})},P.type))})]})]})}),T&&j&&h.jsx(T4,{activeConv:j,ides:s,isCreatingChat:W,isRefreshingHistory:A,onClose:()=>C(!1),onNewChat:ee,onSwitchSession:mt,onRefreshHistory:de}),h.jsx("style",{children:`
169
169
  body { overflow: hidden; overscroll - behavior: none; }
170
170
  .btn { cursor: pointer; border - radius: 8px; font - weight: 600; font - size: 14px; transition: all 0.2s; }
171
171
  .btn - sm { padding: 6px 12px; font - size: 12px; }
@@ -177,10 +177,10 @@ ${ie}`,_localId:`sys_approval_${Date.now()}`};V(we=>{for(const Le of Object.keys
177
177
  }
178
178
  100 % { transform: scale(1); box- shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
179
179
  }
180
- `}),h.jsx(P4,{toasts:o,onDismiss:P=>l(L=>L.filter(W=>W.id!==P)),onClickToast:P=>{if(P.ideId){const L=fe.find(W=>W.ideId===P.ideId||W.tabKey===P.ideId);L&&(pt(),g(L.tabKey))}}}),h.jsx("style",{children:`
180
+ `}),h.jsx(P4,{toasts:o,onDismiss:P=>l(L=>L.filter(H=>H.id!==P)),onClickToast:P=>{if(P.ideId){const L=fe.find(H=>H.ideId===P.ideId||H.tabKey===P.ideId);L&&(pt(),g(L.tabKey))}}}),h.jsx("style",{children:`
181
181
  @keyframes toast -in {
182
182
  from { opacity: 0; transform: translateX(40px); }
183
183
  to { opacity: 1; transform: translateX(0); }
184
184
  }
185
- `})]})}function q4(e){return e.split(":")[0]||""}function Y4({renderHeaderActions:e}={}){var ye,G,Z;const{id:t}=W0(),r=gs(),n=Df(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=Li(),l=w.useMemo(()=>q4(t||""),[t]),a=w.useMemo(()=>i.find(X=>X.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"),g=w.useMemo(()=>i.find(X=>X.id===l||X.daemonId===l),[i,l]),S=(g==null?void 0:g.machineNickname)||((ye=g==null?void 0:g.machine)==null?void 0:ye.hostname)||"",_=((Z=(G=a==null?void 0:a.workspaceFolders)==null?void 0:G[0])==null?void 0:Z.name)||"",[y]=Rb(),x=typeof window<"u"&&window.innerWidth<=768,N=y.get("view")||(x?"chat":"split"),[T,C]=w.useState(N),[M,F]=w.useState("ide"),[$,E]=w.useState(""),[U,j]=w.useState(!1),[A,V]=w.useState(null),[D,O]=w.useState(null),[K,I]=w.useState([]),H=w.useMemo(()=>{var X,ce;return{ideId:t||"",daemonId:l,agentName:rd(c||""),agentType:c||"",status:(u==null?void 0:u.status)||"idle",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:(X=u==null?void 0:u.activeModal)==null?void 0:X.buttons,modalMessage:(ce=u==null?void 0:u.activeModal)==null?void 0:ce.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,u,a,d]);w.useEffect(()=>l?Xt.onScreenshot("ide-page",(ce,me)=>{if(ce!==l)return;const fe=new FileReader;fe.onload=()=>V(fe.result),fe.readAsDataURL(me)}):void 0,[l]),w.useEffect(()=>l?Xt.onStatusEvent((ce,me)=>{if(ce!==l)return;let fe="",xe="info";if(me.event==="agent:generating_completed"?(fe=`✅ Task completed${me.duration?` (${me.duration}s)`:""}`,xe="success"):(me.event==="agent:waiting_approval"||me.event==="agent:approval_requested")&&(fe="⚡ Approval needed",xe="warning"),fe){const B=Date.now();I(Qe=>[...Qe.slice(-4),{id:B,message:fe,type:xe}]),setTimeout(()=>I(Qe=>Qe.filter(pt=>pt.id!==B)),xe==="warning"?1e4:5e3)}}):void 0,[l]),w.useEffect(()=>{const X=l?Xt.get(l):null;!X||!(m==="connected")||(T!=="chat"?X.startScreenshots(c):X.stopScreenshots(c))},[T,m,c,l]);const b=w.useCallback(async(X,ce={})=>{if(!t)throw new Error("No IDE ID");const me={...ce};if(!me._targetInstance&&t){const xe=t.split(":");xe.length>=3&&(xe[1]==="ide"||xe[1]==="cli")&&(me._targetInstance=xe.slice(2).join(":"),me._targetType=xe[1])}const fe=l?Xt.get(l):null;return fe!=null&&fe.hasCommandChannel?await fe.sendCommand(X,me):fe&&fe.connectionState!=="failed"&&fe.connectionState!=="closed"&&await new Promise(B=>{const Ce=Date.now(),Qe=()=>{if(fe.hasCommandChannel)return B(!0);if(Date.now()-Ce>3e3)return B(!1);setTimeout(Qe,200)};Qe()})&&fe.hasCommandChannel?await fe.sendCommand(X,me):await o(t,X,me)},[t,l]),te=async()=>{const X=$.trim();if(!(!X||!t||U)){E(""),j(!0);try{await b("send_chat",{message:X,waitForResponse:!0})}catch(ce){console.error("[IDE] Send failed:",ce)}finally{j(!1)}}},ae=async X=>{if(t)try{const ce=await o(t,"screenshot",{width:X?Math.min(X,1280):1280});ce!=null&&ce.success&&(ce!=null&&ce.base64)&&O(`data:image/jpeg;base64,${ce.base64}`)}catch(ce){console.error("[IDE] Screenshot failed:",ce)}},k=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("span",{className:"ide-name",children:d}),_&&h.jsx("span",{className:"ide-workspace",children:_}),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"})]}),S&&h.jsx("span",{className:"ide-machine-label",children:S})]}),h.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(X=>h.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:T===X?"1px solid var(--accent-primary)":"none",background:T===X?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:T===X?"var(--accent-primary)":void 0},onClick:()=>C(X),children:X==="chat"?h.jsx(xf,{size:14}):X==="split"?"⊞":h.jsx(oo,{size:14})},X)),e&&e({daemonId:l,ideInstanceId:t||""}),h.jsx("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs",onClick:()=>r("/dashboard"),children:"← Back"})]})]}),h.jsxs("div",{className:"ide-content",children:[h.jsxs("div",{className:`ide-chat-panel ${T==="chat"?"full":""} ${T==="remote"?"hidden":""}`,children:[k&&h.jsxs("div",{className:"ide-chat-tabs",children:[h.jsx("button",{className:`ide-chat-tab ${M==="ide"?"active":""}`,onClick:()=>F("ide"),children:d}),h.jsxs("button",{className:`ide-chat-tab ext ${M==="extensions"?"active":""}`,onClick:()=>F("extensions"),children:["Extensions ",h.jsx("span",{className:"ide-ext-badge",children:f.length})]})]}),M==="extensions"&&k?h.jsx(t3,{ideId:t,agentStreams:f,sendCommand:async(X,ce)=>{try{const me=l?Xt.get(l):null;if(me&&m==="connected"){await Promise.race([me.sendCommand(X,ce),new Promise((fe,xe)=>setTimeout(()=>xe(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,X,ce)}}):h.jsx(Qx,{activeConv:H,ides:i,agentInput:$,setAgentInput:E,handleSendChat:te,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[]})]}),h.jsx("div",{className:`ide-remote-panel ${T==="remote"?"full":""} ${T==="chat"?"hidden":""}`,children:h.jsx(x4,{screenshot:D,isCapturing:!1,onRefresh:ae,addLog:()=>{},connState:m,connScreenshot:A,onAction:async(X,ce)=>{const me=l?Xt.get(l):null;if(me&&m==="connected")try{return await me.sendInput(X,ce)}catch(fe){console.error("[Connection Input] Failed:",fe)}return await o(t,"cdp_remote_action",{action:X,params:ce})}})})]}),K.length>0&&h.jsx("div",{className:"ide-toasts",children:K.map(X=>h.jsx("div",{className:`ide-toast ${X.type}`,onClick:()=>I(ce=>ce.filter(me=>me.id!==X.id)),children:X.message},X.id))})]}):h.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function X4(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 G4(){var jf,Bf,Of,zf,Ff,$f,Wf,Hf,Uf,Vf;const{id:e}=W0(),t=gs(),{sendCommand:r}=Li(),n=r,i=Df(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=w.useState([]),[c,d]=w.useState([]),[u,f]=w.useState(0),[p,m]=w.useState(!0),[g,S]=w.useState("debug"),[_,y]=w.useState(null),[x,N]=w.useState([]),[T,C]=w.useState(!1),[M,F]=w.useState(""),[$,E]=w.useState(""),[U,j]=w.useState(""),[A,V]=w.useState(""),[D,O]=w.useState(""),[K,I]=w.useState(""),[H,b]=w.useState(""),[te,ae]=w.useState("overview"),[k,ye]=w.useState([]),[G,Z]=w.useState(!1),[X,ce]=w.useState(!1),[me,fe]=w.useState(""),[xe,B]=w.useState([]),[Ce,Qe]=w.useState(!1),[pt,mr]=w.useState(null),[gr,Dr]=w.useState("all"),[_r,nn]=w.useState(""),[rr,kt]=w.useState(!1),[mt,ee]=w.useState(null),ge=w.useRef(null),R=w.useRef(!1);w.useEffect(()=>{if(!e||te!=="logs"||!p)return;const v=async()=>{try{const oe=await r(e,"get_logs",{count:200,minLevel:g,since:u}),ve=(oe==null?void 0:oe.result)||oe;if(oe!=null&&oe.success&&Array.isArray(ve==null?void 0:ve.logs)&&ve.logs.length>0){d(Pt=>[...Pt,...ve.logs.map(Ir=>({timestamp:Ir.ts,level:Ir.level,message:`[${Ir.category}] ${Ir.message}`}))].slice(-300));const je=Math.max(...ve.logs.map(Pt=>Pt.ts));f(je)}}catch{}};v();const z=setInterval(v,3e3);return()=>clearInterval(z)},[e,te,p,u,g]),w.useEffect(()=>{if(p&&c.length>0){const v=R.current?"smooth":"instant";setTimeout(()=>{var z;(z=ge.current)==null||z.scrollIntoView({behavior:v}),R.current=!0},50)}},[c.length,l.length,p]),w.useEffect(()=>{te!=="logs"&&(R.current=!1)},[te]);const q=async()=>{var v;if(e){Qe(!0);try{const z=await r(e,"get_provider_settings",{}),oe=(z==null?void 0:z.result)||z;if(z!=null&&z.success&&(oe!=null&&oe.settings)){const ve=[];for(const[je,Pt]of Object.entries(oe.settings)){const Kt=W.find(Ir=>Ir.type===je);ve.push({type:je,displayName:(Kt==null?void 0:Kt.displayName)||je,icon:(Kt==null?void 0:Kt.icon)||"",category:(Kt==null?void 0:Kt.category)||"unknown",schema:Pt,values:((v=oe.values)==null?void 0:v[je])||{}})}ve.sort((je,Pt)=>je.category.localeCompare(Pt.category)||je.displayName.localeCompare(Pt.displayName)),B(ve)}}catch{}Qe(!1)}};w.useEffect(()=>{te==="providers"&&xe.length===0&&q()},[te]);const de=async(v,z,oe)=>{mr(`${v}.${z}`),B(ve=>ve.map(je=>je.type===v?{...je,values:{...je.values,[z]:oe}}:je));try{const ve=await r(e,"set_provider_setting",{providerType:v,key:z,value:oe});ve!=null&&ve.success||q()}catch{q()}mr(null)},P=s.find(v=>v.id===e&&v.daemonMode),L=P?{id:P.id,hostname:((jf=P.machine)==null?void 0:jf.hostname)||P.id,platform:((Bf=P.machine)==null?void 0:Bf.platform)||"unknown",arch:((Of=P.machine)==null?void 0:Of.arch)||"",cpus:((zf=P.machine)==null?void 0:zf.cpus)||0,totalMem:((Ff=P.machine)==null?void 0:Ff.totalMem)||0,freeMem:(($f=P.machine)==null?void 0:$f.freeMem)||0,availableMem:(Wf=P.machine)==null?void 0:Wf.availableMem,loadavg:((Hf=P.machine)==null?void 0:Hf.loadavg)||[],uptime:((Uf=P.machine)==null?void 0:Uf.uptime)||0,release:((Vf=P.machine)==null?void 0:Vf.release)||"",cdpconnected:P.cdpconnected||!1,machineNickname:P.machineNickname||null,p2p:P.p2p||{available:!1,state:"unavailable",peers:0,screenshotActive:!1},detectedIdes:P.detectedIdes||[],managedIdeIds:P.managedIdeIds||[],managedCliIds:P.managedCliIds||[],workspaces:P.workspaces||[],defaultWorkspaceId:P.defaultWorkspaceId??P.activeWorkspaceId??null,defaultWorkspacePath:P.defaultWorkspacePath??P.activeWorkspacePath??null,workspaceActivity:P.workspaceActivity||[]}:null,W=(P==null?void 0:P.availableProviders)||[],Q={};for(const v of W)Q[v.type]=v.icon;const J=v=>Q[v]||"",le=W.filter(v=>v.category==="cli"),ue=W.filter(v=>v.category==="acp");w.useEffect(()=>{!U&&le.length>0&&j(le[0].type)},[U,le.length]),w.useEffect(()=>{!A&&ue.length>0&&V(ue[0].type)},[A,ue.length]);const ie=s.filter(v=>v.daemonId===e&&!v.daemonMode).filter(v=>!a_(v)&&!c_(v)).map(v=>({id:v.id,type:v.type,version:v.version||"",instanceId:v.instanceId||"",status:v.status,workspaceFolders:v.workspaceFolders||[],activeFile:v.activeFile||null,terminals:v.terminals||0,aiAgents:N4(v.aiAgents||v.agents||[]),activeChat:v.activeChat||null,chats:v.chats||[],agentStreams:v.agentStreams||[],cdpconnected:v.cdpconnected||!1,daemonId:e})),_e=s.filter(v=>v.daemonId===e&&a_(v)).map(v=>{var z,oe;return{id:v.id,type:v.type,cliName:v.cliName||v.type,status:v.status,workingDir:v.workingDir||((oe=(z=v.workspaceFolders)==null?void 0:z[0])==null?void 0:oe.path)||"",activeChat:v.activeChat||null,daemonId:e}}),we=s.filter(v=>v.daemonId===e&&c_(v)).map(v=>{var z,oe;return{id:v.id,type:v.type,acpName:v.cliName||v.type,status:v.status,workingDir:v.workingDir||((oe=(z=v.workspaceFolders)==null?void 0:z[0])==null?void 0:oe.path)||"",activeChat:v.activeChat||null,currentModel:v.currentModel,currentPlan:v.currentPlan,daemonId:e}}),Le=((L==null?void 0:L.detectedIdes)||[]).filter(v=>!v.running&&!ie.some(z=>(z.type||"").toLowerCase()===(v.type||"").toLowerCase())),be=(v,z)=>{a(oe=>[...oe.slice(-100),{timestamp:Date.now(),level:v,message:z}]),setTimeout(()=>{var oe;return(oe=ge.current)==null?void 0:oe.scrollIntoView({behavior:"smooth"})},100)},nt=async v=>{if(!(!e||_)){y(v),be("info",`Launching ${Xr(v)}...`);try{const z=await r(e,"launch_ide",{ideType:v,enableCdp:!0});be(z!=null&&z.success?"info":"error",z!=null&&z.success?`${Xr(v)} launched`:`Failed: ${z==null?void 0:z.error}`)}catch(z){be("error",`Launch error: ${z.message}`)}finally{y(null)}}},gt=async v=>{if(!e)return;const{cliType:z,dir:oe,workspaceId:ve,useDefaultWorkspace:je,useHome:Pt,argsStr:Kt,model:Ir}=v;if(!z){be("warn","Select a CLI or ACP provider first");return}const o1=Kt?Kt.split(/\s+/).filter(Boolean):void 0,Kf=(oe==null?void 0:oe.trim())||(ve?"(saved id)":je?"(default workspace)":Pt?"(home)":"");be("info",`Launching ${z}${Kf?` in ${Kf}`:""}${Ir?` (model: ${Ir})`:""}...`);try{const ei={cliType:z,cliArgs:o1,initialModel:Ir||void 0};oe!=null&&oe.trim()?ei.dir=oe.trim():ve?ei.workspaceId=ve:je?ei.useDefaultWorkspace=!0:Pt&&(ei.useHome=!0);const nr=await r(e,"launch_cli",ei),sn=(nr==null?void 0:nr.result)||nr;nr!=null&&nr.success?(be("info",`${z} launched`),(sn==null?void 0:sn.launchSource)==="home"?be("info","📂 Running in home directory (explicit choice)"):(sn==null?void 0:sn.launchSource)==="defaultWorkspace"&&be("info","📂 Using default workspace (explicit choice)")):(be("error",`Failed: ${(nr==null?void 0:nr.error)||(sn==null?void 0:sn.error)}`),(nr==null?void 0:nr.code)==="WORKSPACE_LAUNCH_CONTEXT_REQUIRED"&&ee({cliType:z,argsStr:Kt,model:Ir}))}catch(ei){be("error",`Launch error: ${ei.message}`)}},vr=(v,z,oe,ve)=>{if(e){if(!v){be("warn","Select a provider");return}if(!z.trim()){ee({cliType:v,argsStr:oe,model:ve});return}gt({cliType:v,dir:z,argsStr:oe,model:ve})}},Xo=async(v,z,oe)=>{if(e&&window.confirm(`Stop ${v}?
186
- This will terminate the process.`))try{const ve=await r(e,"stop_cli",{cliType:v,dir:z,_targetInstance:oe});ve!=null&&ve.success?be("info",`${v} stopped`):be("error",`Stop failed: ${(ve==null?void 0:ve.error)||"Unknown error"}`)}catch(ve){be("error",`Stop failed: ${ve.message}`)}},rc=async v=>{try{await r(v.id,"restart_session",{ideType:v.type}),be("info",`${Xr(v.type)} restart initiated`)}catch(z){be("error",`Restart failed: ${z.message}`)}},nc=async()=>{if(e)try{const v=await r(e,"detect_ides",{});be("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){be("error",`Detection failed: ${v.message}`)}},Jn=async()=>{if(e){C(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&N(v.result)}catch(v){be("error",`Failed: ${v.message}`)}finally{C(!1)}}},If=async()=>{if(!(!e||!_r.trim())){kt(!0);try{const v=await r(e,"workspace_add",{path:_r.trim()});v!=null&&v.success?(be("info",`Workspace added: ${_r.trim()}`),nn("")):be("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){be("error",v.message)}finally{kt(!1)}}},Jx=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){kt(!0);try{const z=await r(e,"workspace_remove",{id:v});z!=null&&z.success?be("info","Workspace removed"):be("error",(z==null?void 0:z.error)||"workspace_remove failed")}catch(z){be("error",z.message)}finally{kt(!1)}}},e1=async v=>{if(e){kt(!0);try{const z=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(z!=null&&z.success){be("info",v?"Default workspace updated":"Default workspace cleared");const oe=typeof z.defaultWorkspacePath=="string"?z.defaultWorkspacePath:"";oe&&(F(oe),O(oe))}else be("error",(z==null?void 0:z.error)||"workspace_set_default failed")}catch(z){be("error",z.message)}finally{kt(!1)}}},t1=async v=>{if(!e||!v.trim())return;const z=v.trim();kt(!0);try{const oe=await r(e,"workspace_set_default",{path:z});oe!=null&&oe.success?(be("info","Default workspace set from history"),F(z),O(z)):be("error",(oe==null?void 0:oe.error)||"Could not set default (path missing on disk?)")}catch(oe){be("error",oe.message)}finally{kt(!1)}},ic=w.useCallback(async()=>{var v;if(e){Z(!0);try{let z=await r(e,"get_cli_history",{});z!=null&&z.success||(z=await n(e,"get_cli_history"));const oe=(z==null?void 0:z.history)??((v=z==null?void 0:z.result)==null?void 0:v.history);z!=null&&z.success&&Array.isArray(oe)&&ye(oe)}catch{}Z(!1)}},[e,r,n]);w.useEffect(()=>{te==="overview"&&e&&ic()},[te,e,ic]);const Rf=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:me}),be("info",`Nickname set to "${me||"(cleared)"}"`),ce(!1)}catch(v){be("error",`Failed: ${v.message}`)}};if(!L)return o?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 Mf=L.availableMem??L.freeMem,r1=L.totalMem>0?Math.min(100,Math.max(0,Math.round((L.totalMem-Mf)/L.totalMem*100))):0,Af=L.loadavg[0]||0,n1=L.machineNickname||L.hostname,i1=(v,z,oe)=>{const ve=W.find(Pt=>Pt.type===v),je=(oe||[]).join(" ");(ve==null?void 0:ve.category)==="acp"?(V(v),O(z),b(je),ae("acps")):(j(v),F(z),E(je),ae("clis"))},s1=[{id:"overview",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(VT,{size:14})," Overview"]})},{id:"ides",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(oo,{size:14})," IDEs"]}),count:ie.length},{id:"clis",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(nx,{size:14})," CLIs"]}),count:_e.length},{id:"acps",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(YT,{size:14})," ACP Agents"]}),count:we.length},{id:"providers",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(zT,{size:14})," Providers"]}),count:xe.length>0?xe.length:void 0},{id:"logs",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(OT,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"dashboard-header flex-col !items-stretch !p-0",children:[h.jsx("div",{className:"flex items-center justify-between px-6 py-4 w-full",children:h.jsxs("div",{className:"flex items-center gap-3.5",children:[h.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"←"}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[X?h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsx("input",{autoFocus:!0,value:me,onChange:v=>fe(v.target.value),onKeyDown:v=>{v.key==="Enter"&&Rf(),v.key==="Escape"&&ce(!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-[200px]"}),h.jsx("button",{onClick:Rf,className:"machine-btn text-green-500 border-green-500/30",children:"✓"}),h.jsx("button",{onClick:()=>ce(!1),className:"machine-btn",children:"✕"})]}):h.jsx("h1",{className:"header-title cursor-pointer",onClick:()=>{ce(!0),fe(L.machineNickname||"")},title:"Click to set nickname",children:n1}),h.jsx("span",{className:"status-dot-md online"})]}),h.jsxs("div",{className:"header-subtitle mt-1 flex gap-2 items-center",children:[h.jsxs("span",{children:[L.platform," · ",L.arch," · ",L.cpus," cores"]}),L.p2p.available&&h.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:L.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:L.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",L.p2p.state==="connected"?`● ${L.p2p.peers}`:"○"]}),L.cdpconnected&&h.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500",children:"CDP ●"}),L.machineNickname&&h.jsxs("span",{className:"text-text-muted opacity-80",children:["(",L.hostname,")"]})]})]})]})}),h.jsx("div",{className:"machine-tabs px-6",children:s1.map(v=>h.jsxs("button",{onClick:()=>ae(v.id),className:`machine-tab${te===v.id?" active":""}`,children:[v.label,v.count!==void 0&&h.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),h.jsxs("div",{className:"page-content",children:[te==="overview"&&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(s_,{icon:h.jsx(cg,{size:16}),label:"Uptime",value:E4(L.uptime)}),h.jsx(s_,{icon:h.jsx(oo,{size:16}),label:"IDEs",value:`${ie.length}`,sub:`${_e.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(o_,{value:Math.min(Math.round(Af/L.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${Af.toFixed(2)} avg / ${L.cpus} cores`}),h.jsx(o_,{value:r1,max:100,label:"Memory",color:"#3b82f6",detail:`${l_(L.totalMem-Mf)} / ${l_(L.totalMem)}${L.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(lo,{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:rr,value:L.defaultWorkspaceId||"",onChange:v=>{const z=v.target.value;e1(z===""?null:z)},children:[h.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(L.workspaces||[]).map(v=>h.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),L.defaultWorkspacePath&&h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:L.defaultWorkspacePath,children:L.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:_r,disabled:rr,onChange:v=>nn(v.target.value),onKeyDown:v=>v.key==="Enter"&&void If()}),h.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:rr,onClick:()=>void If(),children:"Add"})]}),(L.workspaces||[]).length>0&&h.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(L.workspaces||[]).map(v=>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:v.path,children:v.path}),h.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:rr,onClick:()=>void Jx(v.id),children:"Remove"})]},v.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(cg,{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"}),k.length>0?h.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,z)=>{const oe=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.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:v.dir,children:[J(v.cliType)," ",oe]}),h.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.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 gt({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>i1(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${z}`)})}):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."}),(L.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:(L.workspaceActivity||[]).slice(0,12).map(v=>{const z=v.path.split("/").filter(Boolean).pop()||v.path,oe=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ve=(v.kind==="cli"||v.kind==="acp")&&!!v.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:v.path,children:z}),oe&&h.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:oe}),v.agentType&&h.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),h.jsx("span",{className:"text-[9px] text-text-muted",children:X4(v.lastUsedAt)}),h.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ve&&h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void gt({cliType:v.agentType,dir:v.path}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{F(v.path),O(v.path),ae("clis")},children:"CLIs tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{F(v.path),O(v.path),ae("acps")},children:"ACP tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:rr,onClick:()=>void t1(v.path),children:"Set default"})]})]},`${v.path}-${v.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:()=>ae("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),ie.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:ie.map(v=>{var oe,ve,je;const z=(v.agentStreams||[]).some(Pt=>Pt.status==="generating"||Pt.status==="streaming")||((oe=v.activeChat)==null?void 0:oe.status)==="generating";return h.jsxs("div",{onClick:()=>t(`/ide/${v.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${z?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[h.jsx("span",{children:J(v.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:Xr(v.type)}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:((je=(ve=v.workspaceFolders)==null?void 0:ve[0])==null?void 0:je.name)||""}),z&&h.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),h.jsx("span",{className:`${z?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:z?"#fb923c":"#22c55e",boxShadow:z?"0 0 8px rgba(249,115,22,0.4)":"none",animation:z?"pulse-dot 1.5s infinite":"none"}})]},v.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:()=>ae("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),_e.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:_e.map(v=>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:J(v.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workingDir.split("/").pop()}),h.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),L.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:L.detectedIdes.map(v=>h.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${v.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:J(v.type)}),v.name||v.type,h.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),te==="ides"&&h.jsxs("div",{children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ie.length,")"]}),ie.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:ie.map(v=>{var z,oe;return 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:J(v.type)}),h.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Xr(v.type)}),v.version&&h.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.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:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[h.jsx(oo,{size:13})," Control"]}),h.jsx("button",{onClick:()=>rc(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"})]})]}),h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(130px,1fr))] gap-1.5 text-xs text-text-secondary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",((z=v.workspaceFolders)==null?void 0:z.map(ve=>ve.name).join(", "))||"—"]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"File:"})," ",((oe=v.activeFile)==null?void 0:oe.split("/").pop())||"—"]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"Terminals:"})," ",v.terminals]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"CDP:"})," ",v.cdpconnected?"● connected":"○ Off"]})]}),v.aiAgents.length>0&&h.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:v.aiAgents.map(ve=>h.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${ve.status==="generating"||ve.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[ve.name," · ",ve.status]},ve.id))})]},v.id)})}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",Le.length,")"]}),h.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:L.defaultWorkspacePath?`Opens in default workspace: ${L.defaultWorkspacePath.split("/").filter(Boolean).pop()||L.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."}),h.jsxs("div",{className:"flex flex-wrap gap-2",children:[Le.map(v=>h.jsxs("button",{onClick:()=>nt(v.type||v.id||""),disabled:!!_,className:"machine-btn-primary flex items-center gap-1.5",style:{opacity:_&&_!==v.type?.4:1},children:[h.jsx("span",{children:J(v.type)}),_===v.type?"⏳ Launching...":`▶ ${v.name||Xr(v.type)}`]},v.type)),Le.length===0&&h.jsxs("div",{className:"text-xs text-text-muted italic",children:["All detected IDEs are running, or none detected.",h.jsxs("button",{onClick:nc,className:"machine-btn ml-2 flex items-center gap-1",children:[h.jsx(WT,{size:12})," Scan"]})]})]})]}),te==="clis"&&h.jsxs("div",{children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),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:U,onChange:v=>j(v.target.value),className:"machine-input",children:le.length>0?le.map(v=>h.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):h.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),h.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:M,onChange:v=>F(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),h.jsx("input",{type:"text",placeholder:"Args (optional)",value:$,onChange:v=>E(v.target.value),className:"machine-input min-w-[150px]"}),h.jsx("button",{onClick:()=>vr(U,M,$||void 0),className:"machine-btn-primary",children:"▶ Launch"}),h.jsx("button",{type:"button",disabled:!(L!=null&&L.defaultWorkspacePath),title:L!=null&&L.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void gt({cliType:U,useDefaultWorkspace:!0,argsStr:$||void 0}),className:"machine-btn text-[10px]",children:"Default"}),h.jsx("button",{type:"button",onClick:()=>void gt({cliType:U,useHome:!0,argsStr:$||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 (",_e.length,")"]}),_e.length===0?h.jsx("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 CLIs running"}):h.jsx("div",{className:"flex flex-col gap-2 mb-5",children:_e.map(v=>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:J(v.type)}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),h.jsx("div",{className:"text-[11px] text-text-muted",children:v.workingDir})]})]}),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 ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),v.status==="stopped"?h.jsx("button",{onClick:()=>vr(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):h.jsx("button",{onClick:()=>Xo(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),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:ic,disabled:G,className:"machine-btn",children:G?"⏳":"↻ Load"})]}),k.length>0&&h.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,z)=>{var oe,ve;return h.jsxs("div",{onClick:()=>{j(v.cliType),F(v.dir),E((v.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:je=>je.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:je=>je.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:J(v.cliType)}),h.jsx("span",{children:((oe=v.dir)==null?void 0:oe.split("/").filter(Boolean).pop())||"root"}),((ve=v.cliArgs)==null?void 0:ve.length)>0&&h.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),h.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},z)})}),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:Jn,disabled:T,className:"machine-btn",children:T?"⏳":"↻ Load"})]}),x.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,z)=>h.jsx("button",{onClick:()=>F(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(lo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},z))})]})]}),te==="acps"&&h.jsxs("div",{children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),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:A,onChange:v=>V(v.target.value),className:"machine-input",children:ue.length>0?ue.map(v=>h.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):h.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),h.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:D,onChange:v=>O(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),h.jsx("input",{type:"text",placeholder:"Model (default)",value:K,onChange:v=>I(v.target.value),className:"machine-input min-w-[120px]"}),h.jsx("input",{type:"text",placeholder:"Args (optional)",value:H,onChange:v=>b(v.target.value),className:"machine-input min-w-[120px]"}),h.jsx("button",{onClick:()=>vr(A,D,H||void 0,K||void 0),className:"machine-btn-primary",children:"▶ Launch"}),h.jsx("button",{type:"button",disabled:!(L!=null&&L.defaultWorkspacePath),title:L!=null&&L.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void gt({cliType:A,useDefaultWorkspace:!0,argsStr:H||void 0,model:K||void 0}),className:"machine-btn text-[10px]",children:"Default"}),h.jsx("button",{type:"button",onClick:()=>void gt({cliType:A,useHome:!0,argsStr:H||void 0,model:K||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 (",we.length,")"]}),we.length===0?h.jsx("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 ACP agents running"}):h.jsx("div",{className:"flex flex-col gap-2 mb-5",children:we.map(v=>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:J(v.type)}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),h.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[h.jsx("span",{children:v.workingDir}),v.currentModel&&h.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&h.jsxs("span",{className:"text-amber-500",children:["📋 ",v.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 ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":v.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),h.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:h.jsx(xf,{size:14})}),v.status==="stopped"?h.jsx("button",{onClick:()=>vr(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):h.jsx("button",{onClick:()=>Xo(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),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:Jn,disabled:T,className:"machine-btn",children:T?"⏳":"↻ Load"})]}),x.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,z)=>h.jsx("button",{onClick:()=>O(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(lo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},z))})]})]}),te==="providers"&&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(v=>h.jsx("button",{onClick:()=>Dr(v),className:`machine-btn text-[10px] px-2 py-0.5 ${gr===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),h.jsx("button",{onClick:q,disabled:Ce,className:"machine-btn",children:Ce?"⏳ Loading...":"↻ Refresh"})]}),Ce&&xe.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:xe.filter(v=>gr==="all"||v.category===gr).map(v=>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:v.icon}),h.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),h.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:v.category==="acp"?"rgba(139,92,246,0.08)":v.category==="cli"?"rgba(59,130,246,0.08)":v.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:v.category==="acp"?"#a78bfa":v.category==="cli"?"#60a5fa":v.category==="ide"?"#86efac":"#fbbf24"},children:v.category})]}),h.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(z=>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:[z.label||z.key,pt===`${v.type}.${z.key}`&&h.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),z.description&&h.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:z.description})]}),h.jsx("div",{className:"shrink-0",children:z.type==="boolean"?h.jsx("button",{onClick:()=>de(v.type,z.key,!(v.values[z.key]??z.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[z.key]??z.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:v.values[z.key]??z.default?21:3}})}):z.type==="number"?h.jsx("input",{type:"number",value:v.values[z.key]??z.default??0,min:z.min,max:z.max,onChange:oe=>{const ve=parseInt(oe.target.value)||0;z.min!==void 0&&ve<z.min||z.max!==void 0&&ve>z.max||de(v.type,z.key,ve)},className:"machine-input w-20 text-center text-[11px]"}):z.type==="select"&&z.options?h.jsx("select",{value:v.values[z.key]??z.default??"",onChange:oe=>de(v.type,z.key,oe.target.value),className:"machine-input text-[11px]",children:z.options.map(oe=>h.jsx("option",{value:oe,children:oe},oe))}):h.jsx("input",{type:"text",value:v.values[z.key]??z.default??"",onBlur:oe=>de(v.type,z.key,oe.target.value),className:"machine-input w-[120px] text-[11px]"})})]},z.key))})]},v.type))})]}),te==="logs"&&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(v=>h.jsx("button",{onClick:()=>{S(v),d([]),f(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),h.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),h.jsx("button",{onClick:()=>{d([]),f(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:[c.length===0&&h.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,z)=>h.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[h.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),h.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#475569":"#8b5cf6"},children:v.level==="error"?"ERR":v.level==="warn"?"WRN":v.level==="debug"?"DBG":"INF"}),h.jsx("span",{children:v.message})]},z)),h.jsx("div",{ref:ge})]})]})]}),mt&&L&&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:(L.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."}):(L.workspaces||[]).map(v=>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:()=>{const z=mt;ee(null),gt({cliType:z.cliType,workspaceId:v.id,argsStr:z.argsStr,model:z.model})},children:[h.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.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:!L.defaultWorkspacePath,onClick:()=>{const v=mt;ee(null),gt({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=mt;ee(null),gt({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>ee(null),children:"Cancel"})]})]})})]})}function Q4(){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 p_=Q4(),m_=3e3,Z4=3e4;let cn=null,J4=0;const Na=new Map,nd=new Set;let ii=null;async function Vl(e,t,r){const n=cn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++J4}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{Na.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);Na.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 eD{constructor(t){ws(this,"daemonId");ws(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(cn==null?void 0:cn.readyState)===WebSocket.OPEN}get connectionState(){return(cn==null?void 0:cn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return Vl(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId;return Vl(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ii&&(clearInterval(ii),ii=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId,i=await Vl(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());nd.forEach(o=>o("standalone",s))}}catch{}};r(),ii=setInterval(r,2e3)}stopScreenshots(t){ii&&(clearInterval(ii),ii=null)}}let si=null;function tD(e){(!si||si.daemonId!==e)&&(si=new eD(e));const t=Xt._originalGet||Xt.get.bind(Xt);Xt._originalGet=t,Xt.get=r=>r===e||r.startsWith("standalone")?si:t(r),Xt.getState=r=>(r===e||r.startsWith("standalone"))&&(si==null?void 0:si.connectionState)||"disconnected",Xt.onScreenshot=(r,n)=>(nd.add(n),()=>{nd.delete(n)})}function rD({children:e}){const t=w.useRef(hm()),r=hm();t.current=r;const[,n]=w.useState("disconnected"),i=w.useRef(null),s=w.useRef(),o=w.useRef(m_),l=w.useRef(!0);return w.useEffect(()=>{l.current=!0;function a(){var u,f;if(!l.current||((u=i.current)==null?void 0:u.readyState)===WebSocket.OPEN||((f=i.current)==null?void 0:f.readyState)===WebSocket.CONNECTING)return;n("connecting"),console.log(`[Standalone WS] Connecting to ${p_}...`);let d;try{d=new WebSocket(p_)}catch(p){console.error("[Standalone WS] Failed to create WebSocket:",p),c();return}i.current=d,d.onopen=()=>{if(!l.current){d.close();return}n("connected"),o.current=m_,console.log("[Standalone WS] Connected")},cn=d,d.onmessage=p=>{var m;try{const g=JSON.parse(p.data);if((g.type==="command_result"||g.type==="error")&&g.requestId){const S=Na.get(g.requestId);S&&(Na.delete(g.requestId),g.type==="error"?S.reject(new Error(((m=g.data)==null?void 0:m.message)||"Command failed")):S.resolve(g.data));return}if(g.type==="status"||g.type==="initial_state"){const S=g.data;if(!S)return;const{injectEntries:_,markLoaded:y}=t.current,x=[],N=S.id||"standalone";tD(N),x.push({id:N,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:S.hostname,platform:S.platform,...S.system||{}},system:S.system||null,timestamp:S.timestamp,cdpConnected:S.cdpConnected,detectedIdes:S.detectedIdes||[],availableProviders:S.availableProviders||[],workspaces:S.workspaces,defaultWorkspaceId:S.defaultWorkspaceId??S.activeWorkspaceId,defaultWorkspacePath:S.defaultWorkspacePath??S.activeWorkspacePath,workspaceActivity:S.workspaceActivity,managedIdeIds:(S.ides||[]).map(T=>T.id),managedCliIds:(S.clis||[]).map(T=>T.id)});for(const T of S.ides||[])x.push({...T,daemonId:S.id||"standalone",status:T.cdpConnected?"online":"detected"});for(const T of S.clis||[])x.push({...T,daemonId:S.id||"standalone",status:T.isRunning?"running":"stopped"});x.length>0&&_(x),y()}}catch(g){console.error("[Standalone WS] Parse error:",g)}},d.onclose=()=>{l.current&&(n("disconnected"),i.current=null,c())},d.onerror=p=>{console.warn("[Standalone WS] Error, will reconnect:",p)}}function c(){if(!l.current)return;clearTimeout(s.current);const d=o.current;console.log(`[Standalone WS] Reconnecting in ${d}ms...`),s.current=setTimeout(()=>{o.current=Math.min(o.current*1.5,Z4),a()},d)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,cn=null)}},[]),h.jsx(h.Fragment,{children:e})}function nD({children:e}){return h.jsx(Ab,{children:h.jsx(rD,{children:e})})}const iD=[{id:"dashboard",path:"/dashboard",icon:h.jsx(jT,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:h.jsx(BT,{}),label:"Burrow"}];function sD({children:e}){const t=gs(),r=$o(),[n,i]=w.useState(!1),[s,o]=w.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:iD.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(FT,{})}),!s&&"About"]}),!s&&h.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.7"]}),h.jsx(j4,{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 oD=[{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."}],lD=[{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."}],aD=[{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}],hu={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 cD(){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.7"]})]}),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:oD.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:hu.ides},{label:"Extension agents",items:hu.agents},{label:"CLI agents",items:hu.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:aD.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:lD.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 g_(){const{ides:e}=Y0(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?h.jsx(Al,{to:`/machines/${t.id}`,replace:!0}):e.length>0?h.jsx(Al,{to:`/machines/${e[0].id}`,replace:!0}):h.jsx(Al,{to:"/dashboard",replace:!0})}function uD(){return h.jsx(Ib,{children:h.jsx(nD,{children:h.jsx(zb,{value:{sendCommand:Vl,sendData:()=>!1},children:h.jsx(sD,{children:h.jsxs(Tb,{children:[h.jsx(Nn,{path:"/dashboard",element:h.jsx(K4,{})}),h.jsx(Nn,{path:"/ide/:id",element:h.jsx(Y4,{})}),h.jsx(Nn,{path:"/machine",element:h.jsx(g_,{})}),h.jsx(Nn,{path:"/machines/:id",element:h.jsx(G4,{})}),h.jsx(Nn,{path:"/machines",element:h.jsx(g_,{})}),h.jsx(Nn,{path:"/about",element:h.jsx(cD,{})}),h.jsx(Nn,{path:"*",element:h.jsx(Al,{to:"/dashboard",replace:!0})})]})})})})})}I0(document.getElementById("root")).render(h.jsx(w.StrictMode,{children:h.jsx(uD,{})}));
185
+ `})]})}function q4(e){return e.split(":")[0]||""}function Y4({renderHeaderActions:e}={}){var ye,G,Z;const{id:t}=W0(),r=gs(),n=Df(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=Li(),l=w.useMemo(()=>q4(t||""),[t]),a=w.useMemo(()=>i.find(X=>X.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"),g=w.useMemo(()=>i.find(X=>X.id===l||X.daemonId===l),[i,l]),S=(g==null?void 0:g.machineNickname)||((ye=g==null?void 0:g.machine)==null?void 0:ye.hostname)||"",_=((Z=(G=a==null?void 0:a.workspaceFolders)==null?void 0:G[0])==null?void 0:Z.name)||"",[y]=Rb(),x=typeof window<"u"&&window.innerWidth<=768,N=y.get("view")||(x?"chat":"split"),[T,C]=w.useState(N),[A,F]=w.useState("ide"),[W,E]=w.useState(""),[U,O]=w.useState(!1),[D,V]=w.useState(null),[I,B]=w.useState(null),[K,R]=w.useState([]),$=w.useMemo(()=>{var X,ce;return{ideId:t||"",daemonId:l,agentName:rd(c||""),agentType:c||"",status:(u==null?void 0:u.status)||"idle",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:(X=u==null?void 0:u.activeModal)==null?void 0:X.buttons,modalMessage:(ce=u==null?void 0:u.activeModal)==null?void 0:ce.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,u,a,d]);w.useEffect(()=>l?Xt.onScreenshot("ide-page",(ce,me)=>{if(ce!==l)return;const fe=new FileReader;fe.onload=()=>V(fe.result),fe.readAsDataURL(me)}):void 0,[l]),w.useEffect(()=>l?Xt.onStatusEvent((ce,me)=>{if(ce!==l)return;let fe="",xe="info";if(me.event==="agent:generating_completed"?(fe=`✅ Task completed${me.duration?` (${me.duration}s)`:""}`,xe="success"):(me.event==="agent:waiting_approval"||me.event==="agent:approval_requested")&&(fe="⚡ Approval needed",xe="warning"),fe){const j=Date.now();R(Qe=>[...Qe.slice(-4),{id:j,message:fe,type:xe}]),setTimeout(()=>R(Qe=>Qe.filter(pt=>pt.id!==j)),xe==="warning"?1e4:5e3)}}):void 0,[l]),w.useEffect(()=>{const X=l?Xt.get(l):null;!X||!(m==="connected")||(T!=="chat"?X.startScreenshots(c):X.stopScreenshots(c))},[T,m,c,l]);const b=w.useCallback(async(X,ce={})=>{if(!t)throw new Error("No IDE ID");const me={...ce};if(!me._targetInstance&&t){const xe=t.split(":");xe.length>=3&&(xe[1]==="ide"||xe[1]==="cli")&&(me._targetInstance=xe.slice(2).join(":"),me._targetType=xe[1])}const fe=l?Xt.get(l):null;return fe!=null&&fe.hasCommandChannel?await fe.sendCommand(X,me):fe&&fe.connectionState!=="failed"&&fe.connectionState!=="closed"&&await new Promise(j=>{const Ce=Date.now(),Qe=()=>{if(fe.hasCommandChannel)return j(!0);if(Date.now()-Ce>3e3)return j(!1);setTimeout(Qe,200)};Qe()})&&fe.hasCommandChannel?await fe.sendCommand(X,me):await o(t,X,me)},[t,l]),te=async()=>{const X=W.trim();if(!(!X||!t||U)){E(""),O(!0);try{await b("send_chat",{message:X,waitForResponse:!0})}catch(ce){console.error("[IDE] Send failed:",ce)}finally{O(!1)}}},ae=async X=>{if(t)try{const ce=await o(t,"screenshot",{width:X?Math.min(X,1280):1280});ce!=null&&ce.success&&(ce!=null&&ce.base64)&&B(`data:image/jpeg;base64,${ce.base64}`)}catch(ce){console.error("[IDE] Screenshot failed:",ce)}},k=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("span",{className:"ide-name",children:d}),_&&h.jsx("span",{className:"ide-workspace",children:_}),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"})]}),S&&h.jsx("span",{className:"ide-machine-label",children:S})]}),h.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(X=>h.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:T===X?"1px solid var(--accent-primary)":"none",background:T===X?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:T===X?"var(--accent-primary)":void 0},onClick:()=>C(X),children:X==="chat"?h.jsx(xf,{size:14}):X==="split"?"⊞":h.jsx(oo,{size:14})},X)),e&&e({daemonId:l,ideInstanceId:t||""}),h.jsx("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs",onClick:()=>r("/dashboard"),children:"← Back"})]})]}),h.jsxs("div",{className:"ide-content",children:[h.jsxs("div",{className:`ide-chat-panel ${T==="chat"?"full":""} ${T==="remote"?"hidden":""}`,children:[k&&h.jsxs("div",{className:"ide-chat-tabs",children:[h.jsx("button",{className:`ide-chat-tab ${A==="ide"?"active":""}`,onClick:()=>F("ide"),children:d}),h.jsxs("button",{className:`ide-chat-tab ext ${A==="extensions"?"active":""}`,onClick:()=>F("extensions"),children:["Extensions ",h.jsx("span",{className:"ide-ext-badge",children:f.length})]})]}),A==="extensions"&&k?h.jsx(t3,{ideId:t,agentStreams:f,sendCommand:async(X,ce)=>{try{const me=l?Xt.get(l):null;if(me&&m==="connected"){await Promise.race([me.sendCommand(X,ce),new Promise((fe,xe)=>setTimeout(()=>xe(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,X,ce)}}):h.jsx(Qx,{activeConv:$,ides:i,agentInput:W,setAgentInput:E,handleSendChat:te,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[]})]}),h.jsx("div",{className:`ide-remote-panel ${T==="remote"?"full":""} ${T==="chat"?"hidden":""}`,children:h.jsx(x4,{screenshot:I,isCapturing:!1,onRefresh:ae,addLog:()=>{},connState:m,connScreenshot:D,onAction:async(X,ce)=>{const me=l?Xt.get(l):null;if(me&&m==="connected")try{return await me.sendInput(X,ce)}catch(fe){console.error("[Connection Input] Failed:",fe)}return await o(t,"cdp_remote_action",{action:X,params:ce})}})})]}),K.length>0&&h.jsx("div",{className:"ide-toasts",children:K.map(X=>h.jsx("div",{className:`ide-toast ${X.type}`,onClick:()=>R(ce=>ce.filter(me=>me.id!==X.id)),children:X.message},X.id))})]}):h.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function X4(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 G4(){var jf,Bf,Of,zf,Ff,$f,Wf,Hf,Uf,Vf;const{id:e}=W0(),t=gs(),{sendCommand:r}=Li(),n=r,i=Df(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=w.useState([]),[c,d]=w.useState([]),[u,f]=w.useState(0),[p,m]=w.useState(!0),[g,S]=w.useState("debug"),[_,y]=w.useState(null),[x,N]=w.useState([]),[T,C]=w.useState(!1),[A,F]=w.useState(""),[W,E]=w.useState(""),[U,O]=w.useState(""),[D,V]=w.useState(""),[I,B]=w.useState(""),[K,R]=w.useState(""),[$,b]=w.useState(""),[te,ae]=w.useState("overview"),[k,ye]=w.useState([]),[G,Z]=w.useState(!1),[X,ce]=w.useState(!1),[me,fe]=w.useState(""),[xe,j]=w.useState([]),[Ce,Qe]=w.useState(!1),[pt,mr]=w.useState(null),[gr,Dr]=w.useState("all"),[_r,nn]=w.useState(""),[rr,kt]=w.useState(!1),[mt,ee]=w.useState(null),ge=w.useRef(null),M=w.useRef(!1);w.useEffect(()=>{if(!e||te!=="logs"||!p)return;const v=async()=>{try{const oe=await r(e,"get_logs",{count:200,minLevel:g,since:u}),ve=(oe==null?void 0:oe.result)||oe;if(oe!=null&&oe.success&&Array.isArray(ve==null?void 0:ve.logs)&&ve.logs.length>0){d(Pt=>[...Pt,...ve.logs.map(Ir=>({timestamp:Ir.ts,level:Ir.level,message:`[${Ir.category}] ${Ir.message}`}))].slice(-300));const je=Math.max(...ve.logs.map(Pt=>Pt.ts));f(je)}}catch{}};v();const z=setInterval(v,3e3);return()=>clearInterval(z)},[e,te,p,u,g]),w.useEffect(()=>{if(p&&c.length>0){const v=M.current?"smooth":"instant";setTimeout(()=>{var z;(z=ge.current)==null||z.scrollIntoView({behavior:v}),M.current=!0},50)}},[c.length,l.length,p]),w.useEffect(()=>{te!=="logs"&&(M.current=!1)},[te]);const q=async()=>{var v;if(e){Qe(!0);try{const z=await r(e,"get_provider_settings",{}),oe=(z==null?void 0:z.result)||z;if(z!=null&&z.success&&(oe!=null&&oe.settings)){const ve=[];for(const[je,Pt]of Object.entries(oe.settings)){const Kt=H.find(Ir=>Ir.type===je);ve.push({type:je,displayName:(Kt==null?void 0:Kt.displayName)||je,icon:(Kt==null?void 0:Kt.icon)||"",category:(Kt==null?void 0:Kt.category)||"unknown",schema:Pt,values:((v=oe.values)==null?void 0:v[je])||{}})}ve.sort((je,Pt)=>je.category.localeCompare(Pt.category)||je.displayName.localeCompare(Pt.displayName)),j(ve)}}catch{}Qe(!1)}};w.useEffect(()=>{te==="providers"&&xe.length===0&&q()},[te]);const de=async(v,z,oe)=>{mr(`${v}.${z}`),j(ve=>ve.map(je=>je.type===v?{...je,values:{...je.values,[z]:oe}}:je));try{const ve=await r(e,"set_provider_setting",{providerType:v,key:z,value:oe});ve!=null&&ve.success||q()}catch{q()}mr(null)},P=s.find(v=>v.id===e&&v.daemonMode),L=P?{id:P.id,hostname:((jf=P.machine)==null?void 0:jf.hostname)||P.id,platform:((Bf=P.machine)==null?void 0:Bf.platform)||"unknown",arch:((Of=P.machine)==null?void 0:Of.arch)||"",cpus:((zf=P.machine)==null?void 0:zf.cpus)||0,totalMem:((Ff=P.machine)==null?void 0:Ff.totalMem)||0,freeMem:(($f=P.machine)==null?void 0:$f.freeMem)||0,availableMem:(Wf=P.machine)==null?void 0:Wf.availableMem,loadavg:((Hf=P.machine)==null?void 0:Hf.loadavg)||[],uptime:((Uf=P.machine)==null?void 0:Uf.uptime)||0,release:((Vf=P.machine)==null?void 0:Vf.release)||"",cdpconnected:P.cdpconnected||!1,machineNickname:P.machineNickname||null,p2p:P.p2p||{available:!1,state:"unavailable",peers:0,screenshotActive:!1},detectedIdes:P.detectedIdes||[],managedIdeIds:P.managedIdeIds||[],managedCliIds:P.managedCliIds||[],workspaces:P.workspaces||[],defaultWorkspaceId:P.defaultWorkspaceId??P.activeWorkspaceId??null,defaultWorkspacePath:P.defaultWorkspacePath??P.activeWorkspacePath??null,workspaceActivity:P.workspaceActivity||[]}:null,H=(P==null?void 0:P.availableProviders)||[],Q={};for(const v of H)Q[v.type]=v.icon;const J=v=>Q[v]||"",le=H.filter(v=>v.category==="cli"),ue=H.filter(v=>v.category==="acp");w.useEffect(()=>{!U&&le.length>0&&O(le[0].type)},[U,le.length]),w.useEffect(()=>{!D&&ue.length>0&&V(ue[0].type)},[D,ue.length]);const ie=s.filter(v=>v.daemonId===e&&!v.daemonMode).filter(v=>!a_(v)&&!c_(v)).map(v=>({id:v.id,type:v.type,version:v.version||"",instanceId:v.instanceId||"",status:v.status,workspaceFolders:v.workspaceFolders||[],activeFile:v.activeFile||null,terminals:v.terminals||0,aiAgents:N4(v.aiAgents||v.agents||[]),activeChat:v.activeChat||null,chats:v.chats||[],agentStreams:v.agentStreams||[],cdpconnected:v.cdpconnected||!1,daemonId:e})),_e=s.filter(v=>v.daemonId===e&&a_(v)).map(v=>{var z,oe;return{id:v.id,type:v.type,cliName:v.cliName||v.type,status:v.status,workingDir:v.workingDir||((oe=(z=v.workspaceFolders)==null?void 0:z[0])==null?void 0:oe.path)||"",activeChat:v.activeChat||null,daemonId:e}}),we=s.filter(v=>v.daemonId===e&&c_(v)).map(v=>{var z,oe;return{id:v.id,type:v.type,acpName:v.cliName||v.type,status:v.status,workingDir:v.workingDir||((oe=(z=v.workspaceFolders)==null?void 0:z[0])==null?void 0:oe.path)||"",activeChat:v.activeChat||null,currentModel:v.currentModel,currentPlan:v.currentPlan,daemonId:e}}),Le=((L==null?void 0:L.detectedIdes)||[]).filter(v=>!v.running&&!ie.some(z=>(z.type||"").toLowerCase()===(v.type||"").toLowerCase())),be=(v,z)=>{a(oe=>[...oe.slice(-100),{timestamp:Date.now(),level:v,message:z}]),setTimeout(()=>{var oe;return(oe=ge.current)==null?void 0:oe.scrollIntoView({behavior:"smooth"})},100)},nt=async v=>{if(!(!e||_)){y(v),be("info",`Launching ${Xr(v)}...`);try{const z=await r(e,"launch_ide",{ideType:v,enableCdp:!0});be(z!=null&&z.success?"info":"error",z!=null&&z.success?`${Xr(v)} launched`:`Failed: ${z==null?void 0:z.error}`)}catch(z){be("error",`Launch error: ${z.message}`)}finally{y(null)}}},gt=async v=>{if(!e)return;const{cliType:z,dir:oe,workspaceId:ve,useDefaultWorkspace:je,useHome:Pt,argsStr:Kt,model:Ir}=v;if(!z){be("warn","Select a CLI or ACP provider first");return}const o1=Kt?Kt.split(/\s+/).filter(Boolean):void 0,Kf=(oe==null?void 0:oe.trim())||(ve?"(saved id)":je?"(default workspace)":Pt?"(home)":"");be("info",`Launching ${z}${Kf?` in ${Kf}`:""}${Ir?` (model: ${Ir})`:""}...`);try{const ei={cliType:z,cliArgs:o1,initialModel:Ir||void 0};oe!=null&&oe.trim()?ei.dir=oe.trim():ve?ei.workspaceId=ve:je?ei.useDefaultWorkspace=!0:Pt&&(ei.useHome=!0);const nr=await r(e,"launch_cli",ei),sn=(nr==null?void 0:nr.result)||nr;nr!=null&&nr.success?(be("info",`${z} launched`),(sn==null?void 0:sn.launchSource)==="home"?be("info","📂 Running in home directory (explicit choice)"):(sn==null?void 0:sn.launchSource)==="defaultWorkspace"&&be("info","📂 Using default workspace (explicit choice)")):(be("error",`Failed: ${(nr==null?void 0:nr.error)||(sn==null?void 0:sn.error)}`),(nr==null?void 0:nr.code)==="WORKSPACE_LAUNCH_CONTEXT_REQUIRED"&&ee({cliType:z,argsStr:Kt,model:Ir}))}catch(ei){be("error",`Launch error: ${ei.message}`)}},vr=(v,z,oe,ve)=>{if(e){if(!v){be("warn","Select a provider");return}if(!z.trim()){ee({cliType:v,argsStr:oe,model:ve});return}gt({cliType:v,dir:z,argsStr:oe,model:ve})}},Xo=async(v,z,oe)=>{if(e&&window.confirm(`Stop ${v}?
186
+ This will terminate the process.`))try{const ve=await r(e,"stop_cli",{cliType:v,dir:z,_targetInstance:oe});ve!=null&&ve.success?be("info",`${v} stopped`):be("error",`Stop failed: ${(ve==null?void 0:ve.error)||"Unknown error"}`)}catch(ve){be("error",`Stop failed: ${ve.message}`)}},rc=async v=>{try{await r(v.id,"restart_session",{ideType:v.type}),be("info",`${Xr(v.type)} restart initiated`)}catch(z){be("error",`Restart failed: ${z.message}`)}},nc=async()=>{if(e)try{const v=await r(e,"detect_ides",{});be("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){be("error",`Detection failed: ${v.message}`)}},Jn=async()=>{if(e){C(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&N(v.result)}catch(v){be("error",`Failed: ${v.message}`)}finally{C(!1)}}},If=async()=>{if(!(!e||!_r.trim())){kt(!0);try{const v=await r(e,"workspace_add",{path:_r.trim()});v!=null&&v.success?(be("info",`Workspace added: ${_r.trim()}`),nn("")):be("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){be("error",v.message)}finally{kt(!1)}}},Jx=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){kt(!0);try{const z=await r(e,"workspace_remove",{id:v});z!=null&&z.success?be("info","Workspace removed"):be("error",(z==null?void 0:z.error)||"workspace_remove failed")}catch(z){be("error",z.message)}finally{kt(!1)}}},e1=async v=>{if(e){kt(!0);try{const z=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(z!=null&&z.success){be("info",v?"Default workspace updated":"Default workspace cleared");const oe=typeof z.defaultWorkspacePath=="string"?z.defaultWorkspacePath:"";oe&&(F(oe),B(oe))}else be("error",(z==null?void 0:z.error)||"workspace_set_default failed")}catch(z){be("error",z.message)}finally{kt(!1)}}},t1=async v=>{if(!e||!v.trim())return;const z=v.trim();kt(!0);try{const oe=await r(e,"workspace_set_default",{path:z});oe!=null&&oe.success?(be("info","Default workspace set from history"),F(z),B(z)):be("error",(oe==null?void 0:oe.error)||"Could not set default (path missing on disk?)")}catch(oe){be("error",oe.message)}finally{kt(!1)}},ic=w.useCallback(async()=>{var v;if(e){Z(!0);try{let z=await r(e,"get_cli_history",{});z!=null&&z.success||(z=await n(e,"get_cli_history"));const oe=(z==null?void 0:z.history)??((v=z==null?void 0:z.result)==null?void 0:v.history);z!=null&&z.success&&Array.isArray(oe)&&ye(oe)}catch{}Z(!1)}},[e,r,n]);w.useEffect(()=>{te==="overview"&&e&&ic()},[te,e,ic]);const Rf=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:me}),be("info",`Nickname set to "${me||"(cleared)"}"`),ce(!1)}catch(v){be("error",`Failed: ${v.message}`)}};if(!L)return o?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 Mf=L.availableMem??L.freeMem,r1=L.totalMem>0?Math.min(100,Math.max(0,Math.round((L.totalMem-Mf)/L.totalMem*100))):0,Af=L.loadavg[0]||0,n1=L.machineNickname||L.hostname,i1=(v,z,oe)=>{const ve=H.find(Pt=>Pt.type===v),je=(oe||[]).join(" ");(ve==null?void 0:ve.category)==="acp"?(V(v),B(z),b(je),ae("acps")):(O(v),F(z),E(je),ae("clis"))},s1=[{id:"overview",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(VT,{size:14})," Overview"]})},{id:"ides",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(oo,{size:14})," IDEs"]}),count:ie.length},{id:"clis",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(nx,{size:14})," CLIs"]}),count:_e.length},{id:"acps",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(YT,{size:14})," ACP Agents"]}),count:we.length},{id:"providers",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(zT,{size:14})," Providers"]}),count:xe.length>0?xe.length:void 0},{id:"logs",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(OT,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"dashboard-header flex-col !items-stretch !p-0",children:[h.jsx("div",{className:"flex items-center justify-between px-6 py-4 w-full",children:h.jsxs("div",{className:"flex items-center gap-3.5",children:[h.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"←"}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[X?h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsx("input",{autoFocus:!0,value:me,onChange:v=>fe(v.target.value),onKeyDown:v=>{v.key==="Enter"&&Rf(),v.key==="Escape"&&ce(!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-[200px]"}),h.jsx("button",{onClick:Rf,className:"machine-btn text-green-500 border-green-500/30",children:"✓"}),h.jsx("button",{onClick:()=>ce(!1),className:"machine-btn",children:"✕"})]}):h.jsx("h1",{className:"header-title cursor-pointer",onClick:()=>{ce(!0),fe(L.machineNickname||"")},title:"Click to set nickname",children:n1}),h.jsx("span",{className:"status-dot-md online"})]}),h.jsxs("div",{className:"header-subtitle mt-1 flex gap-2 items-center",children:[h.jsxs("span",{children:[L.platform," · ",L.arch," · ",L.cpus," cores"]}),L.p2p.available&&h.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:L.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:L.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",L.p2p.state==="connected"?`● ${L.p2p.peers}`:"○"]}),L.cdpconnected&&h.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500",children:"CDP ●"}),L.machineNickname&&h.jsxs("span",{className:"text-text-muted opacity-80",children:["(",L.hostname,")"]})]})]})]})}),h.jsx("div",{className:"machine-tabs px-6",children:s1.map(v=>h.jsxs("button",{onClick:()=>ae(v.id),className:`machine-tab${te===v.id?" active":""}`,children:[v.label,v.count!==void 0&&h.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),h.jsxs("div",{className:"page-content",children:[te==="overview"&&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(s_,{icon:h.jsx(cg,{size:16}),label:"Uptime",value:E4(L.uptime)}),h.jsx(s_,{icon:h.jsx(oo,{size:16}),label:"IDEs",value:`${ie.length}`,sub:`${_e.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(o_,{value:Math.min(Math.round(Af/L.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${Af.toFixed(2)} avg / ${L.cpus} cores`}),h.jsx(o_,{value:r1,max:100,label:"Memory",color:"#3b82f6",detail:`${l_(L.totalMem-Mf)} / ${l_(L.totalMem)}${L.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(lo,{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:rr,value:L.defaultWorkspaceId||"",onChange:v=>{const z=v.target.value;e1(z===""?null:z)},children:[h.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(L.workspaces||[]).map(v=>h.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),L.defaultWorkspacePath&&h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:L.defaultWorkspacePath,children:L.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:_r,disabled:rr,onChange:v=>nn(v.target.value),onKeyDown:v=>v.key==="Enter"&&void If()}),h.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:rr,onClick:()=>void If(),children:"Add"})]}),(L.workspaces||[]).length>0&&h.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(L.workspaces||[]).map(v=>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:v.path,children:v.path}),h.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:rr,onClick:()=>void Jx(v.id),children:"Remove"})]},v.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(cg,{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"}),k.length>0?h.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,z)=>{const oe=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.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:v.dir,children:[J(v.cliType)," ",oe]}),h.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.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 gt({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>i1(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${z}`)})}):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."}),(L.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:(L.workspaceActivity||[]).slice(0,12).map(v=>{const z=v.path.split("/").filter(Boolean).pop()||v.path,oe=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ve=(v.kind==="cli"||v.kind==="acp")&&!!v.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:v.path,children:z}),oe&&h.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:oe}),v.agentType&&h.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),h.jsx("span",{className:"text-[9px] text-text-muted",children:X4(v.lastUsedAt)}),h.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ve&&h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void gt({cliType:v.agentType,dir:v.path}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{F(v.path),B(v.path),ae("clis")},children:"CLIs tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{F(v.path),B(v.path),ae("acps")},children:"ACP tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:rr,onClick:()=>void t1(v.path),children:"Set default"})]})]},`${v.path}-${v.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:()=>ae("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),ie.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:ie.map(v=>{var oe,ve,je;const z=(v.agentStreams||[]).some(Pt=>Pt.status==="generating"||Pt.status==="streaming")||((oe=v.activeChat)==null?void 0:oe.status)==="generating";return h.jsxs("div",{onClick:()=>t(`/ide/${v.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${z?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[h.jsx("span",{children:J(v.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:Xr(v.type)}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:((je=(ve=v.workspaceFolders)==null?void 0:ve[0])==null?void 0:je.name)||""}),z&&h.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),h.jsx("span",{className:`${z?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:z?"#fb923c":"#22c55e",boxShadow:z?"0 0 8px rgba(249,115,22,0.4)":"none",animation:z?"pulse-dot 1.5s infinite":"none"}})]},v.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:()=>ae("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),_e.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:_e.map(v=>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:J(v.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workingDir.split("/").pop()}),h.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),L.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:L.detectedIdes.map(v=>h.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${v.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:J(v.type)}),v.name||v.type,h.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),te==="ides"&&h.jsxs("div",{children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ie.length,")"]}),ie.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:ie.map(v=>{var z,oe;return 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:J(v.type)}),h.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Xr(v.type)}),v.version&&h.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.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:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[h.jsx(oo,{size:13})," Control"]}),h.jsx("button",{onClick:()=>rc(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"})]})]}),h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(130px,1fr))] gap-1.5 text-xs text-text-secondary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",((z=v.workspaceFolders)==null?void 0:z.map(ve=>ve.name).join(", "))||"—"]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"File:"})," ",((oe=v.activeFile)==null?void 0:oe.split("/").pop())||"—"]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"Terminals:"})," ",v.terminals]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"CDP:"})," ",v.cdpconnected?"● connected":"○ Off"]})]}),v.aiAgents.length>0&&h.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:v.aiAgents.map(ve=>h.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${ve.status==="generating"||ve.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[ve.name," · ",ve.status]},ve.id))})]},v.id)})}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",Le.length,")"]}),h.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:L.defaultWorkspacePath?`Opens in default workspace: ${L.defaultWorkspacePath.split("/").filter(Boolean).pop()||L.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."}),h.jsxs("div",{className:"flex flex-wrap gap-2",children:[Le.map(v=>h.jsxs("button",{onClick:()=>nt(v.type||v.id||""),disabled:!!_,className:"machine-btn-primary flex items-center gap-1.5",style:{opacity:_&&_!==v.type?.4:1},children:[h.jsx("span",{children:J(v.type)}),_===v.type?"⏳ Launching...":`▶ ${v.name||Xr(v.type)}`]},v.type)),Le.length===0&&h.jsxs("div",{className:"text-xs text-text-muted italic",children:["All detected IDEs are running, or none detected.",h.jsxs("button",{onClick:nc,className:"machine-btn ml-2 flex items-center gap-1",children:[h.jsx(WT,{size:12})," Scan"]})]})]})]}),te==="clis"&&h.jsxs("div",{children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),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:U,onChange:v=>O(v.target.value),className:"machine-input",children:le.length>0?le.map(v=>h.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):h.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),h.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:A,onChange:v=>F(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),h.jsx("input",{type:"text",placeholder:"Args (optional)",value:W,onChange:v=>E(v.target.value),className:"machine-input min-w-[150px]"}),h.jsx("button",{onClick:()=>vr(U,A,W||void 0),className:"machine-btn-primary",children:"▶ Launch"}),h.jsx("button",{type:"button",disabled:!(L!=null&&L.defaultWorkspacePath),title:L!=null&&L.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void gt({cliType:U,useDefaultWorkspace:!0,argsStr:W||void 0}),className:"machine-btn text-[10px]",children:"Default"}),h.jsx("button",{type:"button",onClick:()=>void gt({cliType:U,useHome:!0,argsStr:W||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 (",_e.length,")"]}),_e.length===0?h.jsx("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 CLIs running"}):h.jsx("div",{className:"flex flex-col gap-2 mb-5",children:_e.map(v=>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:J(v.type)}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),h.jsx("div",{className:"text-[11px] text-text-muted",children:v.workingDir})]})]}),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 ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),v.status==="stopped"?h.jsx("button",{onClick:()=>vr(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):h.jsx("button",{onClick:()=>Xo(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),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:ic,disabled:G,className:"machine-btn",children:G?"⏳":"↻ Load"})]}),k.length>0&&h.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,z)=>{var oe,ve;return h.jsxs("div",{onClick:()=>{O(v.cliType),F(v.dir),E((v.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:je=>je.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:je=>je.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:J(v.cliType)}),h.jsx("span",{children:((oe=v.dir)==null?void 0:oe.split("/").filter(Boolean).pop())||"root"}),((ve=v.cliArgs)==null?void 0:ve.length)>0&&h.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),h.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},z)})}),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:Jn,disabled:T,className:"machine-btn",children:T?"⏳":"↻ Load"})]}),x.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,z)=>h.jsx("button",{onClick:()=>F(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(lo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},z))})]})]}),te==="acps"&&h.jsxs("div",{children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),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:D,onChange:v=>V(v.target.value),className:"machine-input",children:ue.length>0?ue.map(v=>h.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):h.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),h.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:I,onChange:v=>B(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),h.jsx("input",{type:"text",placeholder:"Model (default)",value:K,onChange:v=>R(v.target.value),className:"machine-input min-w-[120px]"}),h.jsx("input",{type:"text",placeholder:"Args (optional)",value:$,onChange:v=>b(v.target.value),className:"machine-input min-w-[120px]"}),h.jsx("button",{onClick:()=>vr(D,I,$||void 0,K||void 0),className:"machine-btn-primary",children:"▶ Launch"}),h.jsx("button",{type:"button",disabled:!(L!=null&&L.defaultWorkspacePath),title:L!=null&&L.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void gt({cliType:D,useDefaultWorkspace:!0,argsStr:$||void 0,model:K||void 0}),className:"machine-btn text-[10px]",children:"Default"}),h.jsx("button",{type:"button",onClick:()=>void gt({cliType:D,useHome:!0,argsStr:$||void 0,model:K||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 (",we.length,")"]}),we.length===0?h.jsx("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 ACP agents running"}):h.jsx("div",{className:"flex flex-col gap-2 mb-5",children:we.map(v=>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:J(v.type)}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),h.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[h.jsx("span",{children:v.workingDir}),v.currentModel&&h.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&h.jsxs("span",{className:"text-amber-500",children:["📋 ",v.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 ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":v.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),h.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:h.jsx(xf,{size:14})}),v.status==="stopped"?h.jsx("button",{onClick:()=>vr(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):h.jsx("button",{onClick:()=>Xo(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),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:Jn,disabled:T,className:"machine-btn",children:T?"⏳":"↻ Load"})]}),x.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,z)=>h.jsx("button",{onClick:()=>B(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(lo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},z))})]})]}),te==="providers"&&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(v=>h.jsx("button",{onClick:()=>Dr(v),className:`machine-btn text-[10px] px-2 py-0.5 ${gr===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),h.jsx("button",{onClick:q,disabled:Ce,className:"machine-btn",children:Ce?"⏳ Loading...":"↻ Refresh"})]}),Ce&&xe.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:xe.filter(v=>gr==="all"||v.category===gr).map(v=>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:v.icon}),h.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),h.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:v.category==="acp"?"rgba(139,92,246,0.08)":v.category==="cli"?"rgba(59,130,246,0.08)":v.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:v.category==="acp"?"#a78bfa":v.category==="cli"?"#60a5fa":v.category==="ide"?"#86efac":"#fbbf24"},children:v.category})]}),h.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(z=>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:[z.label||z.key,pt===`${v.type}.${z.key}`&&h.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),z.description&&h.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:z.description})]}),h.jsx("div",{className:"shrink-0",children:z.type==="boolean"?h.jsx("button",{onClick:()=>de(v.type,z.key,!(v.values[z.key]??z.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[z.key]??z.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:v.values[z.key]??z.default?21:3}})}):z.type==="number"?h.jsx("input",{type:"number",value:v.values[z.key]??z.default??0,min:z.min,max:z.max,onChange:oe=>{const ve=parseInt(oe.target.value)||0;z.min!==void 0&&ve<z.min||z.max!==void 0&&ve>z.max||de(v.type,z.key,ve)},className:"machine-input w-20 text-center text-[11px]"}):z.type==="select"&&z.options?h.jsx("select",{value:v.values[z.key]??z.default??"",onChange:oe=>de(v.type,z.key,oe.target.value),className:"machine-input text-[11px]",children:z.options.map(oe=>h.jsx("option",{value:oe,children:oe},oe))}):h.jsx("input",{type:"text",value:v.values[z.key]??z.default??"",onBlur:oe=>de(v.type,z.key,oe.target.value),className:"machine-input w-[120px] text-[11px]"})})]},z.key))})]},v.type))})]}),te==="logs"&&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(v=>h.jsx("button",{onClick:()=>{S(v),d([]),f(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),h.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),h.jsx("button",{onClick:()=>{d([]),f(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:[c.length===0&&h.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,z)=>h.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[h.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),h.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#475569":"#8b5cf6"},children:v.level==="error"?"ERR":v.level==="warn"?"WRN":v.level==="debug"?"DBG":"INF"}),h.jsx("span",{children:v.message})]},z)),h.jsx("div",{ref:ge})]})]})]}),mt&&L&&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:(L.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."}):(L.workspaces||[]).map(v=>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:()=>{const z=mt;ee(null),gt({cliType:z.cliType,workspaceId:v.id,argsStr:z.argsStr,model:z.model})},children:[h.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.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:!L.defaultWorkspacePath,onClick:()=>{const v=mt;ee(null),gt({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=mt;ee(null),gt({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>ee(null),children:"Cancel"})]})]})})]})}function Q4(){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 p_=Q4(),m_=3e3,Z4=3e4;let cn=null,J4=0;const Na=new Map,nd=new Set;let ii=null;async function Vl(e,t,r){const n=cn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++J4}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{Na.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);Na.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 eD{constructor(t){ws(this,"daemonId");ws(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(cn==null?void 0:cn.readyState)===WebSocket.OPEN}get connectionState(){return(cn==null?void 0:cn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return Vl(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId;return Vl(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ii&&(clearInterval(ii),ii=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId,i=await Vl(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());nd.forEach(o=>o("standalone",s))}}catch{}};r(),ii=setInterval(r,2e3)}stopScreenshots(t){ii&&(clearInterval(ii),ii=null)}}let si=null;function tD(e){(!si||si.daemonId!==e)&&(si=new eD(e));const t=Xt._originalGet||Xt.get.bind(Xt);Xt._originalGet=t,Xt.get=r=>r===e||r.startsWith("standalone")?si:t(r),Xt.getState=r=>(r===e||r.startsWith("standalone"))&&(si==null?void 0:si.connectionState)||"disconnected",Xt.onScreenshot=(r,n)=>(nd.add(n),()=>{nd.delete(n)})}function rD({children:e}){const t=w.useRef(hm()),r=hm();t.current=r;const[,n]=w.useState("disconnected"),i=w.useRef(null),s=w.useRef(),o=w.useRef(m_),l=w.useRef(!0);return w.useEffect(()=>{l.current=!0;function a(){var u,f;if(!l.current||((u=i.current)==null?void 0:u.readyState)===WebSocket.OPEN||((f=i.current)==null?void 0:f.readyState)===WebSocket.CONNECTING)return;n("connecting"),console.log(`[Standalone WS] Connecting to ${p_}...`);let d;try{d=new WebSocket(p_)}catch(p){console.error("[Standalone WS] Failed to create WebSocket:",p),c();return}i.current=d,d.onopen=()=>{if(!l.current){d.close();return}n("connected"),o.current=m_,console.log("[Standalone WS] Connected")},cn=d,d.onmessage=p=>{var m;try{const g=JSON.parse(p.data);if((g.type==="command_result"||g.type==="error")&&g.requestId){const S=Na.get(g.requestId);S&&(Na.delete(g.requestId),g.type==="error"?S.reject(new Error(((m=g.data)==null?void 0:m.message)||"Command failed")):S.resolve(g.data));return}if(g.type==="status"||g.type==="initial_state"){const S=g.data;if(!S)return;const{injectEntries:_,markLoaded:y}=t.current,x=[],N=S.id||"standalone";tD(N),x.push({id:N,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:S.hostname,platform:S.platform,...S.system||{}},system:S.system||null,timestamp:S.timestamp,cdpConnected:S.cdpConnected,detectedIdes:S.detectedIdes||[],availableProviders:S.availableProviders||[],workspaces:S.workspaces,defaultWorkspaceId:S.defaultWorkspaceId??S.activeWorkspaceId,defaultWorkspacePath:S.defaultWorkspacePath??S.activeWorkspacePath,workspaceActivity:S.workspaceActivity,managedIdeIds:(S.ides||[]).map(T=>T.id),managedCliIds:(S.clis||[]).map(T=>T.id)});for(const T of S.ides||[])x.push({...T,daemonId:S.id||"standalone",status:T.cdpConnected?"online":"detected"});for(const T of S.clis||[])x.push({...T,daemonId:S.id||"standalone",status:T.isRunning?"running":"stopped"});x.length>0&&_(x),y()}}catch(g){console.error("[Standalone WS] Parse error:",g)}},d.onclose=()=>{l.current&&(n("disconnected"),i.current=null,c())},d.onerror=p=>{console.warn("[Standalone WS] Error, will reconnect:",p)}}function c(){if(!l.current)return;clearTimeout(s.current);const d=o.current;console.log(`[Standalone WS] Reconnecting in ${d}ms...`),s.current=setTimeout(()=>{o.current=Math.min(o.current*1.5,Z4),a()},d)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,cn=null)}},[]),h.jsx(h.Fragment,{children:e})}function nD({children:e}){return h.jsx(Ab,{children:h.jsx(rD,{children:e})})}const iD=[{id:"dashboard",path:"/dashboard",icon:h.jsx(jT,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:h.jsx(BT,{}),label:"Burrow"}];function sD({children:e}){const t=gs(),r=$o(),[n,i]=w.useState(!1),[s,o]=w.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:iD.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(FT,{})}),!s&&"About"]}),!s&&h.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.8"]}),h.jsx(j4,{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 oD=[{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."}],lD=[{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."}],aD=[{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}],hu={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 cD(){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.8"]})]}),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:oD.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:hu.ides},{label:"Extension agents",items:hu.agents},{label:"CLI agents",items:hu.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:aD.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:lD.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 g_(){const{ides:e}=Y0(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?h.jsx(Al,{to:`/machines/${t.id}`,replace:!0}):e.length>0?h.jsx(Al,{to:`/machines/${e[0].id}`,replace:!0}):h.jsx(Al,{to:"/dashboard",replace:!0})}function uD(){return h.jsx(Ib,{children:h.jsx(nD,{children:h.jsx(zb,{value:{sendCommand:Vl,sendData:()=>!1},children:h.jsx(sD,{children:h.jsxs(Tb,{children:[h.jsx(Nn,{path:"/dashboard",element:h.jsx(K4,{})}),h.jsx(Nn,{path:"/ide/:id",element:h.jsx(Y4,{})}),h.jsx(Nn,{path:"/machine",element:h.jsx(g_,{})}),h.jsx(Nn,{path:"/machines/:id",element:h.jsx(G4,{})}),h.jsx(Nn,{path:"/machines",element:h.jsx(g_,{})}),h.jsx(Nn,{path:"/about",element:h.jsx(cD,{})}),h.jsx(Nn,{path:"*",element:h.jsx(Al,{to:"/dashboard",replace:!0})})]})})})})})}I0(document.getElementById("root")).render(h.jsx(w.StrictMode,{children:h.jsx(uD,{})}));