coder-config 0.46.3-beta → 0.46.5-beta

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.
@@ -34,10 +34,10 @@ function QE(e,t){for(var s=0;s<t.length;s++){const n=t[s];if(typeof n!="string"&
34
34
  `+$+i}var F=!1;function te(i,a){if(!i||F)return"";F=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(ge){var S=ge}Reflect.construct(i,[],a)}else{try{a.call()}catch(ge){S=ge}i.call(a.prototype)}else{try{throw Error()}catch(ge){S=ge}i()}}catch(ge){if(ge&&S&&typeof ge.stack=="string"){for(var T=ge.stack.split(`
35
35
  `),D=S.stack.split(`
36
36
  `),V=T.length-1,ee=D.length-1;1<=V&&0<=ee&&T[V]!==D[ee];)ee--;for(;1<=V&&0<=ee;V--,ee--)if(T[V]!==D[ee]){if(V!==1||ee!==1)do if(V--,ee--,0>ee||T[V]!==D[ee]){var ie=`
37
- `+T[V].replace(" at new "," at ");return i.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",i.displayName)),ie}while(1<=V&&0<=ee);break}}}finally{F=!1,Error.prepareStackTrace=p}return(i=i?i.displayName||i.name:"")?G(i):""}function ce(i){switch(i.tag){case 5:return G(i.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return i=te(i.type,!1),i;case 11:return i=te(i.type.render,!1),i;case 1:return i=te(i.type,!0),i;default:return""}}function fe(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case P:return"Portal";case M:return"Profiler";case N:return"StrictMode";case z:return"Suspense";case Y:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case L:return(i.displayName||"Context")+".Consumer";case I:return(i._context.displayName||"Context")+".Provider";case B:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case H:return a=i.displayName||null,a!==null?a:fe(i.type)||"Memo";case U:a=i._payload,i=i._init;try{return fe(i(a))}catch{}}return null}function J(i){var a=i.type;switch(i.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=a.render,i=i.displayName||i.name||"",a.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(a);case 8:return a===N?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function W(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ae(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ne(i){var a=ae(i)?"checked":"value",p=Object.getOwnPropertyDescriptor(i.constructor.prototype,a),S=""+i[a];if(!i.hasOwnProperty(a)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var T=p.get,D=p.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return T.call(this)},set:function(V){S=""+V,D.call(this,V)}}),Object.defineProperty(i,a,{enumerable:p.enumerable}),{getValue:function(){return S},setValue:function(V){S=""+V},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function Z(i){i._valueTracker||(i._valueTracker=ne(i))}function le(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var p=a.getValue(),S="";return i&&(S=ae(i)?i.checked?"true":"false":i.value),i=S,i!==p?(a.setValue(i),!0):!1}function Ce(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Le(i,a){var p=a.checked;return R({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??i._wrapperState.initialChecked})}function Ge(i,a){var p=a.defaultValue==null?"":a.defaultValue,S=a.checked!=null?a.checked:a.defaultChecked;p=W(a.value!=null?a.value:p),i._wrapperState={initialChecked:S,initialValue:p,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function me(i,a){a=a.checked,a!=null&&b(i,"checked",a,!1)}function be(i,a){me(i,a);var p=W(a.value),S=a.type;if(p!=null)S==="number"?(p===0&&i.value===""||i.value!=p)&&(i.value=""+p):i.value!==""+p&&(i.value=""+p);else if(S==="submit"||S==="reset"){i.removeAttribute("value");return}a.hasOwnProperty("value")?Ke(i,a.type,p):a.hasOwnProperty("defaultValue")&&Ke(i,a.type,W(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(i.defaultChecked=!!a.defaultChecked)}function Be(i,a,p){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var S=a.type;if(!(S!=="submit"&&S!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+i._wrapperState.initialValue,p||a===i.value||(i.value=a),i.defaultValue=a}p=i.name,p!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,p!==""&&(i.name=p)}function Ke(i,a,p){(a!=="number"||Ce(i.ownerDocument)!==i)&&(p==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+p&&(i.defaultValue=""+p))}var Qe=Array.isArray;function je(i,a,p,S){if(i=i.options,a){a={};for(var T=0;T<p.length;T++)a["$"+p[T]]=!0;for(p=0;p<i.length;p++)T=a.hasOwnProperty("$"+i[p].value),i[p].selected!==T&&(i[p].selected=T),T&&S&&(i[p].defaultSelected=!0)}else{for(p=""+W(p),a=null,T=0;T<i.length;T++){if(i[T].value===p){i[T].selected=!0,S&&(i[T].defaultSelected=!0);return}a!==null||i[T].disabled||(a=i[T])}a!==null&&(a.selected=!0)}}function we(i,a){if(a.dangerouslySetInnerHTML!=null)throw Error(s(91));return R({},a,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function ve(i,a){var p=a.value;if(p==null){if(p=a.children,a=a.defaultValue,p!=null){if(a!=null)throw Error(s(92));if(Qe(p)){if(1<p.length)throw Error(s(93));p=p[0]}a=p}a==null&&(a=""),p=a}i._wrapperState={initialValue:W(p)}}function _e(i,a){var p=W(a.value),S=W(a.defaultValue);p!=null&&(p=""+p,p!==i.value&&(i.value=p),a.defaultValue==null&&i.defaultValue!==p&&(i.defaultValue=p)),S!=null&&(i.defaultValue=""+S)}function Oe(i){var a=i.textContent;a===i._wrapperState.initialValue&&a!==""&&a!==null&&(i.value=a)}function de(i){switch(i){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 ye(i,a){return i==null||i==="http://www.w3.org/1999/xhtml"?de(a):i==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var De,ze=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,p,S,T){MSApp.execUnsafeLocalFunction(function(){return i(a,p,S,T)})}:i})(function(i,a){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=a;else{for(De=De||document.createElement("div"),De.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=De.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;a.firstChild;)i.appendChild(a.firstChild)}});function Je(i,a){if(a){var p=i.firstChild;if(p&&p===i.lastChild&&p.nodeType===3){p.nodeValue=a;return}}i.textContent=a}var Et={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},at=["Webkit","ms","Moz","O"];Object.keys(Et).forEach(function(i){at.forEach(function(a){a=a+i.charAt(0).toUpperCase()+i.substring(1),Et[a]=Et[i]})});function ur(i,a,p){return a==null||typeof a=="boolean"||a===""?"":p||typeof a!="number"||a===0||Et.hasOwnProperty(i)&&Et[i]?(""+a).trim():a+"px"}function Rr(i,a){i=i.style;for(var p in a)if(a.hasOwnProperty(p)){var S=p.indexOf("--")===0,T=ur(p,a[p],S);p==="float"&&(p="cssFloat"),S?i.setProperty(p,T):i[p]=T}}var Wr=R({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 Jt(i,a){if(a){if(Wr[i]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(s(137,i));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(s(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(s(61))}if(a.style!=null&&typeof a.style!="object")throw Error(s(62))}}function Cr(i,a){if(i.indexOf("-")===-1)return typeof a.is=="string";switch(i){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 Wt=null;function yr(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var us=null,Xr=null,Ls=null;function Os(i){if(i=kl(i)){if(typeof us!="function")throw Error(s(280));var a=i.stateNode;a&&(a=nd(a),us(i.stateNode,i.type,a))}}function it(i){Xr?Ls?Ls.push(i):Ls=[i]:Xr=i}function zt(){if(Xr){var i=Xr,a=Ls;if(Ls=Xr=null,Os(i),a)for(i=0;i<a.length;i++)Os(a[i])}}function rr(i,a){return i(a)}function ar(){}var ws=!1;function Vt(i,a,p){if(ws)return i(a,p);ws=!0;try{return rr(i,a,p)}finally{ws=!1,(Xr!==null||Ls!==null)&&(ar(),zt())}}function Ut(i,a){var p=i.stateNode;if(p===null)return null;var S=nd(p);if(S===null)return null;p=S[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(S=!S.disabled)||(i=i.type,S=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!S;break e;default:i=!1}if(i)return null;if(p&&typeof p!="function")throw Error(s(231,a,typeof p));return p}var Vr=!1;if(l)try{var ut={};Object.defineProperty(ut,"passive",{get:function(){Vr=!0}}),window.addEventListener("test",ut,ut),window.removeEventListener("test",ut,ut)}catch{Vr=!1}function hr(i,a,p,S,T,D,V,ee,ie){var ge=Array.prototype.slice.call(arguments,3);try{a.apply(p,ge)}catch(ke){this.onError(ke)}}var hs=!1,Qr=null,Ze=!1,fn=null,al={onError:function(i){hs=!0,Qr=i}};function Zr(i,a,p,S,T,D,V,ee,ie){hs=!1,Qr=null,hr.apply(al,arguments)}function wi(i,a,p,S,T,D,V,ee,ie){if(Zr.apply(this,arguments),hs){if(hs){var ge=Qr;hs=!1,Qr=null}else throw Error(s(198));Ze||(Ze=!0,fn=ge)}}function mn(i){var a=i,p=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(p=a.return),i=a.return;while(i)}return a.tag===3?p:null}function Sr(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function so(i){if(mn(i)!==i)throw Error(s(188))}function Wo(i){var a=i.alternate;if(!a){if(a=mn(i),a===null)throw Error(s(188));return a!==i?null:i}for(var p=i,S=a;;){var T=p.return;if(T===null)break;var D=T.alternate;if(D===null){if(S=T.return,S!==null){p=S;continue}break}if(T.child===D.child){for(D=T.child;D;){if(D===p)return so(T),i;if(D===S)return so(T),a;D=D.sibling}throw Error(s(188))}if(p.return!==S.return)p=T,S=D;else{for(var V=!1,ee=T.child;ee;){if(ee===p){V=!0,p=T,S=D;break}if(ee===S){V=!0,S=T,p=D;break}ee=ee.sibling}if(!V){for(ee=D.child;ee;){if(ee===p){V=!0,p=D,S=T;break}if(ee===S){V=!0,S=D,p=T;break}ee=ee.sibling}if(!V)throw Error(s(189))}}if(p.alternate!==S)throw Error(s(190))}if(p.tag!==3)throw Error(s(188));return p.stateNode.current===p?i:a}function Vo(i){return i=Wo(i),i!==null?_i(i):null}function _i(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var a=_i(i);if(a!==null)return a;i=i.sibling}return null}var Uo=t.unstable_scheduleCallback,Go=t.unstable_cancelCallback,qo=t.unstable_shouldYield,no=t.unstable_requestPaint,Xt=t.unstable_now,ll=t.unstable_getCurrentPriorityLevel,Js=t.unstable_ImmediatePriority,io=t.unstable_UserBlockingPriority,Tn=t.unstable_NormalPriority,Ko=t.unstable_LowPriority,oo=t.unstable_IdlePriority,Zn=null,fs=null;function ao(i){if(fs&&typeof fs.onCommitFiberRoot=="function")try{fs.onCommitFiberRoot(Zn,i,void 0,(i.current.flags&128)===128)}catch{}}var Mr=Math.clz32?Math.clz32:qe,Q=Math.log,Ie=Math.LN2;function qe(i){return i>>>=0,i===0?32:31-(Q(i)/Ie|0)|0}var kt=64,$t=4194304;function jt(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function sr(i,a){var p=i.pendingLanes;if(p===0)return 0;var S=0,T=i.suspendedLanes,D=i.pingedLanes,V=p&268435455;if(V!==0){var ee=V&~T;ee!==0?S=jt(ee):(D&=V,D!==0&&(S=jt(D)))}else V=p&~T,V!==0?S=jt(V):D!==0&&(S=jt(D));if(S===0)return 0;if(a!==0&&a!==S&&(a&T)===0&&(T=S&-S,D=a&-a,T>=D||T===16&&(D&4194240)!==0))return a;if((S&4)!==0&&(S|=p&16),a=i.entangledLanes,a!==0)for(i=i.entanglements,a&=S;0<a;)p=31-Mr(a),T=1<<p,S|=i[p],a&=~T;return S}function br(i,a){switch(i){case 1:case 2:case 4:return a+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 a+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 pr(i,a){for(var p=i.suspendedLanes,S=i.pingedLanes,T=i.expirationTimes,D=i.pendingLanes;0<D;){var V=31-Mr(D),ee=1<<V,ie=T[V];ie===-1?((ee&p)===0||(ee&S)!==0)&&(T[V]=br(ee,a)):ie<=a&&(i.expiredLanes|=ee),D&=~ee}}function es(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function _s(){var i=kt;return kt<<=1,(kt&4194240)===0&&(kt=64),i}function Xs(i){for(var a=[],p=0;31>p;p++)a.push(i);return a}function Rn(i,a,p){i.pendingLanes|=a,a!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,a=31-Mr(a),i[a]=p}function Vc(i,a){var p=i.pendingLanes&~a;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=a,i.mutableReadLanes&=a,i.entangledLanes&=a,a=i.entanglements;var S=i.eventTimes;for(i=i.expirationTimes;0<p;){var T=31-Mr(p),D=1<<T;a[T]=0,S[T]=-1,i[T]=-1,p&=~D}}function Yo(i,a){var p=i.entangledLanes|=a;for(i=i.entanglements;p;){var S=31-Mr(p),T=1<<S;T&a|i[S]&a&&(i[S]|=a),p&=~T}}var Pt=0;function cl(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var dl,Jo,ul,hl,fl,Xo=!1,lo=[],pn=null,gn=null,xn=null,se=new Map,Me=new Map,Rt=[],kr="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 ts(i,a){switch(i){case"focusin":case"focusout":pn=null;break;case"dragenter":case"dragleave":gn=null;break;case"mouseover":case"mouseout":xn=null;break;case"pointerover":case"pointerout":se.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Me.delete(a.pointerId)}}function bt(i,a,p,S,T,D){return i===null||i.nativeEvent!==D?(i={blockedOn:a,domEventName:p,eventSystemFlags:S,nativeEvent:D,targetContainers:[T]},a!==null&&(a=kl(a),a!==null&&Jo(a)),i):(i.eventSystemFlags|=S,a=i.targetContainers,T!==null&&a.indexOf(T)===-1&&a.push(T),i)}function Dr(i,a,p,S,T){switch(a){case"focusin":return pn=bt(pn,i,a,p,S,T),!0;case"dragenter":return gn=bt(gn,i,a,p,S,T),!0;case"mouseover":return xn=bt(xn,i,a,p,S,T),!0;case"pointerover":var D=T.pointerId;return se.set(D,bt(se.get(D)||null,i,a,p,S,T)),!0;case"gotpointercapture":return D=T.pointerId,Me.set(D,bt(Me.get(D)||null,i,a,p,S,T)),!0}return!1}function Ir(i){var a=ho(i.target);if(a!==null){var p=mn(a);if(p!==null){if(a=p.tag,a===13){if(a=Sr(p),a!==null){i.blockedOn=a,fl(i.priority,function(){ul(p)});return}}else if(a===3&&p.stateNode.current.memoizedState.isDehydrated){i.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}i.blockedOn=null}function rs(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var p=Eh(i.domEventName,i.eventSystemFlags,a[0],i.nativeEvent);if(p===null){p=i.nativeEvent;var S=new p.constructor(p.type,p);Wt=S,p.target.dispatchEvent(S),Wt=null}else return a=kl(p),a!==null&&Jo(a),i.blockedOn=p,!1;a.shift()}return!0}function ei(i,a,p){rs(i)&&p.delete(a)}function co(){Xo=!1,pn!==null&&rs(pn)&&(pn=null),gn!==null&&rs(gn)&&(gn=null),xn!==null&&rs(xn)&&(xn=null),se.forEach(ei),Me.forEach(ei)}function Ci(i,a){i.blockedOn===a&&(i.blockedOn=null,Xo||(Xo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,co)))}function Si(i){function a(T){return Ci(T,i)}if(0<lo.length){Ci(lo[0],i);for(var p=1;p<lo.length;p++){var S=lo[p];S.blockedOn===i&&(S.blockedOn=null)}}for(pn!==null&&Ci(pn,i),gn!==null&&Ci(gn,i),xn!==null&&Ci(xn,i),se.forEach(a),Me.forEach(a),p=0;p<Rt.length;p++)S=Rt[p],S.blockedOn===i&&(S.blockedOn=null);for(;0<Rt.length&&(p=Rt[0],p.blockedOn===null);)Ir(p),p.blockedOn===null&&Rt.shift()}var ti=k.ReactCurrentBatchConfig,uo=!0;function Uc(i,a,p,S){var T=Pt,D=ti.transition;ti.transition=null;try{Pt=1,gt(i,a,p,S)}finally{Pt=T,ti.transition=D}}function Gc(i,a,p,S){var T=Pt,D=ti.transition;ti.transition=null;try{Pt=4,gt(i,a,p,S)}finally{Pt=T,ti.transition=D}}function gt(i,a,p,S){if(uo){var T=Eh(i,a,p,S);if(T===null)Uh(i,a,S,Qo,p),ts(i,S);else if(Dr(T,i,a,p,S))S.stopPropagation();else if(ts(i,S),a&4&&-1<kr.indexOf(i)){for(;T!==null;){var D=kl(T);if(D!==null&&dl(D),D=Eh(i,a,p,S),D===null&&Uh(i,a,S,Qo,p),D===T)break;T=D}T!==null&&S.stopPropagation()}else Uh(i,a,S,null,p)}}var Qo=null;function Eh(i,a,p,S){if(Qo=null,i=yr(S),i=ho(i),i!==null)if(a=mn(i),a===null)i=null;else if(p=a.tag,p===13){if(i=Sr(a),i!==null)return i;i=null}else if(p===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null);return Qo=i,null}function Ux(i){switch(i){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(ll()){case Js:return 1;case io:return 4;case Tn:case Ko:return 16;case oo:return 536870912;default:return 16}default:return 16}}var ki=null,Ph=null,qc=null;function Gx(){if(qc)return qc;var i,a=Ph,p=a.length,S,T="value"in ki?ki.value:ki.textContent,D=T.length;for(i=0;i<p&&a[i]===T[i];i++);var V=p-i;for(S=1;S<=V&&a[p-S]===T[D-S];S++);return qc=T.slice(i,1<S?1-S:void 0)}function Kc(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function Yc(){return!0}function qx(){return!1}function Fs(i){function a(p,S,T,D,V){this._reactName=p,this._targetInst=T,this.type=S,this.nativeEvent=D,this.target=V,this.currentTarget=null;for(var ee in i)i.hasOwnProperty(ee)&&(p=i[ee],this[ee]=p?p(D):D[ee]);return this.isDefaultPrevented=(D.defaultPrevented!=null?D.defaultPrevented:D.returnValue===!1)?Yc:qx,this.isPropagationStopped=qx,this}return R(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=Yc)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=Yc)},persist:function(){},isPersistent:Yc}),a}var Zo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ah=Fs(Zo),ml=R({},Zo,{view:0,detail:0}),k2=Fs(ml),Th,Rh,pl,Jc=R({},ml,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dh,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==pl&&(pl&&i.type==="mousemove"?(Th=i.screenX-pl.screenX,Rh=i.screenY-pl.screenY):Rh=Th=0,pl=i),Th)},movementY:function(i){return"movementY"in i?i.movementY:Rh}}),Kx=Fs(Jc),j2=R({},Jc,{dataTransfer:0}),N2=Fs(j2),E2=R({},ml,{relatedTarget:0}),Mh=Fs(E2),P2=R({},Zo,{animationName:0,elapsedTime:0,pseudoElement:0}),A2=Fs(P2),T2=R({},Zo,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),R2=Fs(T2),M2=R({},Zo,{data:0}),Yx=Fs(M2),D2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},I2={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"},L2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function O2(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=L2[i])?!!a[i]:!1}function Dh(){return O2}var F2=R({},ml,{key:function(i){if(i.key){var a=D2[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=Kc(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?I2[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dh,charCode:function(i){return i.type==="keypress"?Kc(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Kc(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),B2=Fs(F2),$2=R({},Jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jx=Fs($2),z2=R({},ml,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dh}),H2=Fs(z2),W2=R({},Zo,{propertyName:0,elapsedTime:0,pseudoElement:0}),V2=Fs(W2),U2=R({},Jc,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),G2=Fs(U2),q2=[9,13,27,32],Ih=l&&"CompositionEvent"in window,gl=null;l&&"documentMode"in document&&(gl=document.documentMode);var K2=l&&"TextEvent"in window&&!gl,Xx=l&&(!Ih||gl&&8<gl&&11>=gl),Qx=" ",Zx=!1;function e0(i,a){switch(i){case"keyup":return q2.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function t0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ea=!1;function Y2(i,a){switch(i){case"compositionend":return t0(a);case"keypress":return a.which!==32?null:(Zx=!0,Qx);case"textInput":return i=a.data,i===Qx&&Zx?null:i;default:return null}}function J2(i,a){if(ea)return i==="compositionend"||!Ih&&e0(i,a)?(i=Gx(),qc=Ph=ki=null,ea=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Xx&&a.locale!=="ko"?null:a.data;default:return null}}var X2={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 r0(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!X2[i.type]:a==="textarea"}function s0(i,a,p,S){it(S),a=td(a,"onChange"),0<a.length&&(p=new Ah("onChange","change",null,p,S),i.push({event:p,listeners:a}))}var xl=null,vl=null;function Q2(i){w0(i,0)}function Xc(i){var a=ia(i);if(le(a))return i}function Z2(i,a){if(i==="change")return a}var n0=!1;if(l){var Lh;if(l){var Oh="oninput"in document;if(!Oh){var i0=document.createElement("div");i0.setAttribute("oninput","return;"),Oh=typeof i0.oninput=="function"}Lh=Oh}else Lh=!1;n0=Lh&&(!document.documentMode||9<document.documentMode)}function o0(){xl&&(xl.detachEvent("onpropertychange",a0),vl=xl=null)}function a0(i){if(i.propertyName==="value"&&Xc(vl)){var a=[];s0(a,vl,i,yr(i)),Vt(Q2,a)}}function eE(i,a,p){i==="focusin"?(o0(),xl=a,vl=p,xl.attachEvent("onpropertychange",a0)):i==="focusout"&&o0()}function tE(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Xc(vl)}function rE(i,a){if(i==="click")return Xc(a)}function sE(i,a){if(i==="input"||i==="change")return Xc(a)}function nE(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var vn=typeof Object.is=="function"?Object.is:nE;function yl(i,a){if(vn(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var p=Object.keys(i),S=Object.keys(a);if(p.length!==S.length)return!1;for(S=0;S<p.length;S++){var T=p[S];if(!d.call(a,T)||!vn(i[T],a[T]))return!1}return!0}function l0(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function c0(i,a){var p=l0(i);i=0;for(var S;p;){if(p.nodeType===3){if(S=i+p.textContent.length,i<=a&&S>=a)return{node:p,offset:a-i};i=S}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=l0(p)}}function d0(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?d0(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function u0(){for(var i=window,a=Ce();a instanceof i.HTMLIFrameElement;){try{var p=typeof a.contentWindow.location.href=="string"}catch{p=!1}if(p)i=a.contentWindow;else break;a=Ce(i.document)}return a}function Fh(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}function iE(i){var a=u0(),p=i.focusedElem,S=i.selectionRange;if(a!==p&&p&&p.ownerDocument&&d0(p.ownerDocument.documentElement,p)){if(S!==null&&Fh(p)){if(a=S.start,i=S.end,i===void 0&&(i=a),"selectionStart"in p)p.selectionStart=a,p.selectionEnd=Math.min(i,p.value.length);else if(i=(a=p.ownerDocument||document)&&a.defaultView||window,i.getSelection){i=i.getSelection();var T=p.textContent.length,D=Math.min(S.start,T);S=S.end===void 0?D:Math.min(S.end,T),!i.extend&&D>S&&(T=S,S=D,D=T),T=c0(p,D);var V=c0(p,S);T&&V&&(i.rangeCount!==1||i.anchorNode!==T.node||i.anchorOffset!==T.offset||i.focusNode!==V.node||i.focusOffset!==V.offset)&&(a=a.createRange(),a.setStart(T.node,T.offset),i.removeAllRanges(),D>S?(i.addRange(a),i.extend(V.node,V.offset)):(a.setEnd(V.node,V.offset),i.addRange(a)))}}for(a=[],i=p;i=i.parentNode;)i.nodeType===1&&a.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<a.length;p++)i=a[p],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var oE=l&&"documentMode"in document&&11>=document.documentMode,ta=null,Bh=null,bl=null,$h=!1;function h0(i,a,p){var S=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;$h||ta==null||ta!==Ce(S)||(S=ta,"selectionStart"in S&&Fh(S)?S={start:S.selectionStart,end:S.selectionEnd}:(S=(S.ownerDocument&&S.ownerDocument.defaultView||window).getSelection(),S={anchorNode:S.anchorNode,anchorOffset:S.anchorOffset,focusNode:S.focusNode,focusOffset:S.focusOffset}),bl&&yl(bl,S)||(bl=S,S=td(Bh,"onSelect"),0<S.length&&(a=new Ah("onSelect","select",null,a,p),i.push({event:a,listeners:S}),a.target=ta)))}function Qc(i,a){var p={};return p[i.toLowerCase()]=a.toLowerCase(),p["Webkit"+i]="webkit"+a,p["Moz"+i]="moz"+a,p}var ra={animationend:Qc("Animation","AnimationEnd"),animationiteration:Qc("Animation","AnimationIteration"),animationstart:Qc("Animation","AnimationStart"),transitionend:Qc("Transition","TransitionEnd")},zh={},f0={};l&&(f0=document.createElement("div").style,"AnimationEvent"in window||(delete ra.animationend.animation,delete ra.animationiteration.animation,delete ra.animationstart.animation),"TransitionEvent"in window||delete ra.transitionend.transition);function Zc(i){if(zh[i])return zh[i];if(!ra[i])return i;var a=ra[i],p;for(p in a)if(a.hasOwnProperty(p)&&p in f0)return zh[i]=a[p];return i}var m0=Zc("animationend"),p0=Zc("animationiteration"),g0=Zc("animationstart"),x0=Zc("transitionend"),v0=new Map,y0="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 ji(i,a){v0.set(i,a),c(a,[i])}for(var Hh=0;Hh<y0.length;Hh++){var Wh=y0[Hh],aE=Wh.toLowerCase(),lE=Wh[0].toUpperCase()+Wh.slice(1);ji(aE,"on"+lE)}ji(m0,"onAnimationEnd"),ji(p0,"onAnimationIteration"),ji(g0,"onAnimationStart"),ji("dblclick","onDoubleClick"),ji("focusin","onFocus"),ji("focusout","onBlur"),ji(x0,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wl="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(" "),cE=new Set("cancel close invalid load scroll toggle".split(" ").concat(wl));function b0(i,a,p){var S=i.type||"unknown-event";i.currentTarget=p,wi(S,a,void 0,i),i.currentTarget=null}function w0(i,a){a=(a&4)!==0;for(var p=0;p<i.length;p++){var S=i[p],T=S.event;S=S.listeners;e:{var D=void 0;if(a)for(var V=S.length-1;0<=V;V--){var ee=S[V],ie=ee.instance,ge=ee.currentTarget;if(ee=ee.listener,ie!==D&&T.isPropagationStopped())break e;b0(T,ee,ge),D=ie}else for(V=0;V<S.length;V++){if(ee=S[V],ie=ee.instance,ge=ee.currentTarget,ee=ee.listener,ie!==D&&T.isPropagationStopped())break e;b0(T,ee,ge),D=ie}}}if(Ze)throw i=fn,Ze=!1,fn=null,i}function Qt(i,a){var p=a[Xh];p===void 0&&(p=a[Xh]=new Set);var S=i+"__bubble";p.has(S)||(_0(a,i,2,!1),p.add(S))}function Vh(i,a,p){var S=0;a&&(S|=4),_0(p,i,S,a)}var ed="_reactListening"+Math.random().toString(36).slice(2);function _l(i){if(!i[ed]){i[ed]=!0,n.forEach(function(p){p!=="selectionchange"&&(cE.has(p)||Vh(p,!1,i),Vh(p,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[ed]||(a[ed]=!0,Vh("selectionchange",!1,a))}}function _0(i,a,p,S){switch(Ux(a)){case 1:var T=Uc;break;case 4:T=Gc;break;default:T=gt}p=T.bind(null,a,p,i),T=void 0,!Vr||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(T=!0),S?T!==void 0?i.addEventListener(a,p,{capture:!0,passive:T}):i.addEventListener(a,p,!0):T!==void 0?i.addEventListener(a,p,{passive:T}):i.addEventListener(a,p,!1)}function Uh(i,a,p,S,T){var D=S;if((a&1)===0&&(a&2)===0&&S!==null)e:for(;;){if(S===null)return;var V=S.tag;if(V===3||V===4){var ee=S.stateNode.containerInfo;if(ee===T||ee.nodeType===8&&ee.parentNode===T)break;if(V===4)for(V=S.return;V!==null;){var ie=V.tag;if((ie===3||ie===4)&&(ie=V.stateNode.containerInfo,ie===T||ie.nodeType===8&&ie.parentNode===T))return;V=V.return}for(;ee!==null;){if(V=ho(ee),V===null)return;if(ie=V.tag,ie===5||ie===6){S=D=V;continue e}ee=ee.parentNode}}S=S.return}Vt(function(){var ge=D,ke=yr(p),Ne=[];e:{var Se=v0.get(i);if(Se!==void 0){var $e=Ah,We=i;switch(i){case"keypress":if(Kc(p)===0)break e;case"keydown":case"keyup":$e=B2;break;case"focusin":We="focus",$e=Mh;break;case"focusout":We="blur",$e=Mh;break;case"beforeblur":case"afterblur":$e=Mh;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":$e=Kx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$e=N2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$e=H2;break;case m0:case p0:case g0:$e=A2;break;case x0:$e=V2;break;case"scroll":$e=k2;break;case"wheel":$e=G2;break;case"copy":case"cut":case"paste":$e=R2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$e=Jx}var Ye=(a&4)!==0,gr=!Ye&&i==="scroll",he=Ye?Se!==null?Se+"Capture":null:Se;Ye=[];for(var oe=ge,pe;oe!==null;){pe=oe;var Re=pe.stateNode;if(pe.tag===5&&Re!==null&&(pe=Re,he!==null&&(Re=Ut(oe,he),Re!=null&&Ye.push(Cl(oe,Re,pe)))),gr)break;oe=oe.return}0<Ye.length&&(Se=new $e(Se,We,null,p,ke),Ne.push({event:Se,listeners:Ye}))}}if((a&7)===0){e:{if(Se=i==="mouseover"||i==="pointerover",$e=i==="mouseout"||i==="pointerout",Se&&p!==Wt&&(We=p.relatedTarget||p.fromElement)&&(ho(We)||We[ri]))break e;if(($e||Se)&&(Se=ke.window===ke?ke:(Se=ke.ownerDocument)?Se.defaultView||Se.parentWindow:window,$e?(We=p.relatedTarget||p.toElement,$e=ge,We=We?ho(We):null,We!==null&&(gr=mn(We),We!==gr||We.tag!==5&&We.tag!==6)&&(We=null)):($e=null,We=ge),$e!==We)){if(Ye=Kx,Re="onMouseLeave",he="onMouseEnter",oe="mouse",(i==="pointerout"||i==="pointerover")&&(Ye=Jx,Re="onPointerLeave",he="onPointerEnter",oe="pointer"),gr=$e==null?Se:ia($e),pe=We==null?Se:ia(We),Se=new Ye(Re,oe+"leave",$e,p,ke),Se.target=gr,Se.relatedTarget=pe,Re=null,ho(ke)===ge&&(Ye=new Ye(he,oe+"enter",We,p,ke),Ye.target=pe,Ye.relatedTarget=gr,Re=Ye),gr=Re,$e&&We)t:{for(Ye=$e,he=We,oe=0,pe=Ye;pe;pe=sa(pe))oe++;for(pe=0,Re=he;Re;Re=sa(Re))pe++;for(;0<oe-pe;)Ye=sa(Ye),oe--;for(;0<pe-oe;)he=sa(he),pe--;for(;oe--;){if(Ye===he||he!==null&&Ye===he.alternate)break t;Ye=sa(Ye),he=sa(he)}Ye=null}else Ye=null;$e!==null&&C0(Ne,Se,$e,Ye,!1),We!==null&&gr!==null&&C0(Ne,gr,We,Ye,!0)}}e:{if(Se=ge?ia(ge):window,$e=Se.nodeName&&Se.nodeName.toLowerCase(),$e==="select"||$e==="input"&&Se.type==="file")var Xe=Z2;else if(r0(Se))if(n0)Xe=sE;else{Xe=tE;var rt=eE}else($e=Se.nodeName)&&$e.toLowerCase()==="input"&&(Se.type==="checkbox"||Se.type==="radio")&&(Xe=rE);if(Xe&&(Xe=Xe(i,ge))){s0(Ne,Xe,p,ke);break e}rt&&rt(i,Se,ge),i==="focusout"&&(rt=Se._wrapperState)&&rt.controlled&&Se.type==="number"&&Ke(Se,"number",Se.value)}switch(rt=ge?ia(ge):window,i){case"focusin":(r0(rt)||rt.contentEditable==="true")&&(ta=rt,Bh=ge,bl=null);break;case"focusout":bl=Bh=ta=null;break;case"mousedown":$h=!0;break;case"contextmenu":case"mouseup":case"dragend":$h=!1,h0(Ne,p,ke);break;case"selectionchange":if(oE)break;case"keydown":case"keyup":h0(Ne,p,ke)}var st;if(Ih)e:{switch(i){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else ea?e0(i,p)&&(ct="onCompositionEnd"):i==="keydown"&&p.keyCode===229&&(ct="onCompositionStart");ct&&(Xx&&p.locale!=="ko"&&(ea||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&ea&&(st=Gx()):(ki=ke,Ph="value"in ki?ki.value:ki.textContent,ea=!0)),rt=td(ge,ct),0<rt.length&&(ct=new Yx(ct,i,null,p,ke),Ne.push({event:ct,listeners:rt}),st?ct.data=st:(st=t0(p),st!==null&&(ct.data=st)))),(st=K2?Y2(i,p):J2(i,p))&&(ge=td(ge,"onBeforeInput"),0<ge.length&&(ke=new Yx("onBeforeInput","beforeinput",null,p,ke),Ne.push({event:ke,listeners:ge}),ke.data=st))}w0(Ne,a)})}function Cl(i,a,p){return{instance:i,listener:a,currentTarget:p}}function td(i,a){for(var p=a+"Capture",S=[];i!==null;){var T=i,D=T.stateNode;T.tag===5&&D!==null&&(T=D,D=Ut(i,p),D!=null&&S.unshift(Cl(i,D,T)),D=Ut(i,a),D!=null&&S.push(Cl(i,D,T))),i=i.return}return S}function sa(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function C0(i,a,p,S,T){for(var D=a._reactName,V=[];p!==null&&p!==S;){var ee=p,ie=ee.alternate,ge=ee.stateNode;if(ie!==null&&ie===S)break;ee.tag===5&&ge!==null&&(ee=ge,T?(ie=Ut(p,D),ie!=null&&V.unshift(Cl(p,ie,ee))):T||(ie=Ut(p,D),ie!=null&&V.push(Cl(p,ie,ee)))),p=p.return}V.length!==0&&i.push({event:a,listeners:V})}var dE=/\r\n?/g,uE=/\u0000|\uFFFD/g;function S0(i){return(typeof i=="string"?i:""+i).replace(dE,`
38
- `).replace(uE,"")}function rd(i,a,p){if(a=S0(a),S0(i)!==a&&p)throw Error(s(425))}function sd(){}var Gh=null,qh=null;function Kh(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Yh=typeof setTimeout=="function"?setTimeout:void 0,hE=typeof clearTimeout=="function"?clearTimeout:void 0,k0=typeof Promise=="function"?Promise:void 0,fE=typeof queueMicrotask=="function"?queueMicrotask:typeof k0<"u"?function(i){return k0.resolve(null).then(i).catch(mE)}:Yh;function mE(i){setTimeout(function(){throw i})}function Jh(i,a){var p=a,S=0;do{var T=p.nextSibling;if(i.removeChild(p),T&&T.nodeType===8)if(p=T.data,p==="/$"){if(S===0){i.removeChild(T),Si(a);return}S--}else p!=="$"&&p!=="$?"&&p!=="$!"||S++;p=T}while(p);Si(a)}function Ni(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return i}function j0(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var p=i.data;if(p==="$"||p==="$!"||p==="$?"){if(a===0)return i;a--}else p==="/$"&&a++}i=i.previousSibling}return null}var na=Math.random().toString(36).slice(2),Mn="__reactFiber$"+na,Sl="__reactProps$"+na,ri="__reactContainer$"+na,Xh="__reactEvents$"+na,pE="__reactListeners$"+na,gE="__reactHandles$"+na;function ho(i){var a=i[Mn];if(a)return a;for(var p=i.parentNode;p;){if(a=p[ri]||p[Mn]){if(p=a.alternate,a.child!==null||p!==null&&p.child!==null)for(i=j0(i);i!==null;){if(p=i[Mn])return p;i=j0(i)}return a}i=p,p=i.parentNode}return null}function kl(i){return i=i[Mn]||i[ri],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function ia(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(s(33))}function nd(i){return i[Sl]||null}var Qh=[],oa=-1;function Ei(i){return{current:i}}function Zt(i){0>oa||(i.current=Qh[oa],Qh[oa]=null,oa--)}function Gt(i,a){oa++,Qh[oa]=i.current,i.current=a}var Pi={},ss=Ei(Pi),Cs=Ei(!1),fo=Pi;function aa(i,a){var p=i.type.contextTypes;if(!p)return Pi;var S=i.stateNode;if(S&&S.__reactInternalMemoizedUnmaskedChildContext===a)return S.__reactInternalMemoizedMaskedChildContext;var T={},D;for(D in p)T[D]=a[D];return S&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=a,i.__reactInternalMemoizedMaskedChildContext=T),T}function Ss(i){return i=i.childContextTypes,i!=null}function id(){Zt(Cs),Zt(ss)}function N0(i,a,p){if(ss.current!==Pi)throw Error(s(168));Gt(ss,a),Gt(Cs,p)}function E0(i,a,p){var S=i.stateNode;if(a=a.childContextTypes,typeof S.getChildContext!="function")return p;S=S.getChildContext();for(var T in S)if(!(T in a))throw Error(s(108,J(i)||"Unknown",T));return R({},p,S)}function od(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Pi,fo=ss.current,Gt(ss,i),Gt(Cs,Cs.current),!0}function P0(i,a,p){var S=i.stateNode;if(!S)throw Error(s(169));p?(i=E0(i,a,fo),S.__reactInternalMemoizedMergedChildContext=i,Zt(Cs),Zt(ss),Gt(ss,i)):Zt(Cs),Gt(Cs,p)}var si=null,ad=!1,Zh=!1;function A0(i){si===null?si=[i]:si.push(i)}function xE(i){ad=!0,A0(i)}function Ai(){if(!Zh&&si!==null){Zh=!0;var i=0,a=Pt;try{var p=si;for(Pt=1;i<p.length;i++){var S=p[i];do S=S(!0);while(S!==null)}si=null,ad=!1}catch(T){throw si!==null&&(si=si.slice(i+1)),Uo(Js,Ai),T}finally{Pt=a,Zh=!1}}return null}var la=[],ca=0,ld=null,cd=0,Qs=[],Zs=0,mo=null,ni=1,ii="";function po(i,a){la[ca++]=cd,la[ca++]=ld,ld=i,cd=a}function T0(i,a,p){Qs[Zs++]=ni,Qs[Zs++]=ii,Qs[Zs++]=mo,mo=i;var S=ni;i=ii;var T=32-Mr(S)-1;S&=~(1<<T),p+=1;var D=32-Mr(a)+T;if(30<D){var V=T-T%5;D=(S&(1<<V)-1).toString(32),S>>=V,T-=V,ni=1<<32-Mr(a)+T|p<<T|S,ii=D+i}else ni=1<<D|p<<T|S,ii=i}function ef(i){i.return!==null&&(po(i,1),T0(i,1,0))}function tf(i){for(;i===ld;)ld=la[--ca],la[ca]=null,cd=la[--ca],la[ca]=null;for(;i===mo;)mo=Qs[--Zs],Qs[Zs]=null,ii=Qs[--Zs],Qs[Zs]=null,ni=Qs[--Zs],Qs[Zs]=null}var Bs=null,$s=null,nr=!1,yn=null;function R0(i,a){var p=sn(5,null,null,0);p.elementType="DELETED",p.stateNode=a,p.return=i,a=i.deletions,a===null?(i.deletions=[p],i.flags|=16):a.push(p)}function M0(i,a){switch(i.tag){case 5:var p=i.type;return a=a.nodeType!==1||p.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(i.stateNode=a,Bs=i,$s=Ni(a.firstChild),!0):!1;case 6:return a=i.pendingProps===""||a.nodeType!==3?null:a,a!==null?(i.stateNode=a,Bs=i,$s=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(p=mo!==null?{id:ni,overflow:ii}:null,i.memoizedState={dehydrated:a,treeContext:p,retryLane:1073741824},p=sn(18,null,null,0),p.stateNode=a,p.return=i,i.child=p,Bs=i,$s=null,!0):!1;default:return!1}}function rf(i){return(i.mode&1)!==0&&(i.flags&128)===0}function sf(i){if(nr){var a=$s;if(a){var p=a;if(!M0(i,a)){if(rf(i))throw Error(s(418));a=Ni(p.nextSibling);var S=Bs;a&&M0(i,a)?R0(S,p):(i.flags=i.flags&-4097|2,nr=!1,Bs=i)}}else{if(rf(i))throw Error(s(418));i.flags=i.flags&-4097|2,nr=!1,Bs=i}}}function D0(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Bs=i}function dd(i){if(i!==Bs)return!1;if(!nr)return D0(i),nr=!0,!1;var a;if((a=i.tag!==3)&&!(a=i.tag!==5)&&(a=i.type,a=a!=="head"&&a!=="body"&&!Kh(i.type,i.memoizedProps)),a&&(a=$s)){if(rf(i))throw I0(),Error(s(418));for(;a;)R0(i,a),a=Ni(a.nextSibling)}if(D0(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));e:{for(i=i.nextSibling,a=0;i;){if(i.nodeType===8){var p=i.data;if(p==="/$"){if(a===0){$s=Ni(i.nextSibling);break e}a--}else p!=="$"&&p!=="$!"&&p!=="$?"||a++}i=i.nextSibling}$s=null}}else $s=Bs?Ni(i.stateNode.nextSibling):null;return!0}function I0(){for(var i=$s;i;)i=Ni(i.nextSibling)}function da(){$s=Bs=null,nr=!1}function nf(i){yn===null?yn=[i]:yn.push(i)}var vE=k.ReactCurrentBatchConfig;function jl(i,a,p){if(i=p.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(s(309));var S=p.stateNode}if(!S)throw Error(s(147,i));var T=S,D=""+i;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===D?a.ref:(a=function(V){var ee=T.refs;V===null?delete ee[D]:ee[D]=V},a._stringRef=D,a)}if(typeof i!="string")throw Error(s(284));if(!p._owner)throw Error(s(290,i))}return i}function ud(i,a){throw i=Object.prototype.toString.call(a),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i))}function L0(i){var a=i._init;return a(i._payload)}function O0(i){function a(he,oe){if(i){var pe=he.deletions;pe===null?(he.deletions=[oe],he.flags|=16):pe.push(oe)}}function p(he,oe){if(!i)return null;for(;oe!==null;)a(he,oe),oe=oe.sibling;return null}function S(he,oe){for(he=new Map;oe!==null;)oe.key!==null?he.set(oe.key,oe):he.set(oe.index,oe),oe=oe.sibling;return he}function T(he,oe){return he=Fi(he,oe),he.index=0,he.sibling=null,he}function D(he,oe,pe){return he.index=pe,i?(pe=he.alternate,pe!==null?(pe=pe.index,pe<oe?(he.flags|=2,oe):pe):(he.flags|=2,oe)):(he.flags|=1048576,oe)}function V(he){return i&&he.alternate===null&&(he.flags|=2),he}function ee(he,oe,pe,Re){return oe===null||oe.tag!==6?(oe=Jf(pe,he.mode,Re),oe.return=he,oe):(oe=T(oe,pe),oe.return=he,oe)}function ie(he,oe,pe,Re){var Xe=pe.type;return Xe===A?ke(he,oe,pe.props.children,Re,pe.key):oe!==null&&(oe.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===U&&L0(Xe)===oe.type)?(Re=T(oe,pe.props),Re.ref=jl(he,oe,pe),Re.return=he,Re):(Re=Id(pe.type,pe.key,pe.props,null,he.mode,Re),Re.ref=jl(he,oe,pe),Re.return=he,Re)}function ge(he,oe,pe,Re){return oe===null||oe.tag!==4||oe.stateNode.containerInfo!==pe.containerInfo||oe.stateNode.implementation!==pe.implementation?(oe=Xf(pe,he.mode,Re),oe.return=he,oe):(oe=T(oe,pe.children||[]),oe.return=he,oe)}function ke(he,oe,pe,Re,Xe){return oe===null||oe.tag!==7?(oe=Co(pe,he.mode,Re,Xe),oe.return=he,oe):(oe=T(oe,pe),oe.return=he,oe)}function Ne(he,oe,pe){if(typeof oe=="string"&&oe!==""||typeof oe=="number")return oe=Jf(""+oe,he.mode,pe),oe.return=he,oe;if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case E:return pe=Id(oe.type,oe.key,oe.props,null,he.mode,pe),pe.ref=jl(he,null,oe),pe.return=he,pe;case P:return oe=Xf(oe,he.mode,pe),oe.return=he,oe;case U:var Re=oe._init;return Ne(he,Re(oe._payload),pe)}if(Qe(oe)||O(oe))return oe=Co(oe,he.mode,pe,null),oe.return=he,oe;ud(he,oe)}return null}function Se(he,oe,pe,Re){var Xe=oe!==null?oe.key:null;if(typeof pe=="string"&&pe!==""||typeof pe=="number")return Xe!==null?null:ee(he,oe,""+pe,Re);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case E:return pe.key===Xe?ie(he,oe,pe,Re):null;case P:return pe.key===Xe?ge(he,oe,pe,Re):null;case U:return Xe=pe._init,Se(he,oe,Xe(pe._payload),Re)}if(Qe(pe)||O(pe))return Xe!==null?null:ke(he,oe,pe,Re,null);ud(he,pe)}return null}function $e(he,oe,pe,Re,Xe){if(typeof Re=="string"&&Re!==""||typeof Re=="number")return he=he.get(pe)||null,ee(oe,he,""+Re,Xe);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case E:return he=he.get(Re.key===null?pe:Re.key)||null,ie(oe,he,Re,Xe);case P:return he=he.get(Re.key===null?pe:Re.key)||null,ge(oe,he,Re,Xe);case U:var rt=Re._init;return $e(he,oe,pe,rt(Re._payload),Xe)}if(Qe(Re)||O(Re))return he=he.get(pe)||null,ke(oe,he,Re,Xe,null);ud(oe,Re)}return null}function We(he,oe,pe,Re){for(var Xe=null,rt=null,st=oe,ct=oe=0,Fr=null;st!==null&&ct<pe.length;ct++){st.index>ct?(Fr=st,st=null):Fr=st.sibling;var Mt=Se(he,st,pe[ct],Re);if(Mt===null){st===null&&(st=Fr);break}i&&st&&Mt.alternate===null&&a(he,st),oe=D(Mt,oe,ct),rt===null?Xe=Mt:rt.sibling=Mt,rt=Mt,st=Fr}if(ct===pe.length)return p(he,st),nr&&po(he,ct),Xe;if(st===null){for(;ct<pe.length;ct++)st=Ne(he,pe[ct],Re),st!==null&&(oe=D(st,oe,ct),rt===null?Xe=st:rt.sibling=st,rt=st);return nr&&po(he,ct),Xe}for(st=S(he,st);ct<pe.length;ct++)Fr=$e(st,he,ct,pe[ct],Re),Fr!==null&&(i&&Fr.alternate!==null&&st.delete(Fr.key===null?ct:Fr.key),oe=D(Fr,oe,ct),rt===null?Xe=Fr:rt.sibling=Fr,rt=Fr);return i&&st.forEach(function(Bi){return a(he,Bi)}),nr&&po(he,ct),Xe}function Ye(he,oe,pe,Re){var Xe=O(pe);if(typeof Xe!="function")throw Error(s(150));if(pe=Xe.call(pe),pe==null)throw Error(s(151));for(var rt=Xe=null,st=oe,ct=oe=0,Fr=null,Mt=pe.next();st!==null&&!Mt.done;ct++,Mt=pe.next()){st.index>ct?(Fr=st,st=null):Fr=st.sibling;var Bi=Se(he,st,Mt.value,Re);if(Bi===null){st===null&&(st=Fr);break}i&&st&&Bi.alternate===null&&a(he,st),oe=D(Bi,oe,ct),rt===null?Xe=Bi:rt.sibling=Bi,rt=Bi,st=Fr}if(Mt.done)return p(he,st),nr&&po(he,ct),Xe;if(st===null){for(;!Mt.done;ct++,Mt=pe.next())Mt=Ne(he,Mt.value,Re),Mt!==null&&(oe=D(Mt,oe,ct),rt===null?Xe=Mt:rt.sibling=Mt,rt=Mt);return nr&&po(he,ct),Xe}for(st=S(he,st);!Mt.done;ct++,Mt=pe.next())Mt=$e(st,he,ct,Mt.value,Re),Mt!==null&&(i&&Mt.alternate!==null&&st.delete(Mt.key===null?ct:Mt.key),oe=D(Mt,oe,ct),rt===null?Xe=Mt:rt.sibling=Mt,rt=Mt);return i&&st.forEach(function(XE){return a(he,XE)}),nr&&po(he,ct),Xe}function gr(he,oe,pe,Re){if(typeof pe=="object"&&pe!==null&&pe.type===A&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case E:e:{for(var Xe=pe.key,rt=oe;rt!==null;){if(rt.key===Xe){if(Xe=pe.type,Xe===A){if(rt.tag===7){p(he,rt.sibling),oe=T(rt,pe.props.children),oe.return=he,he=oe;break e}}else if(rt.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===U&&L0(Xe)===rt.type){p(he,rt.sibling),oe=T(rt,pe.props),oe.ref=jl(he,rt,pe),oe.return=he,he=oe;break e}p(he,rt);break}else a(he,rt);rt=rt.sibling}pe.type===A?(oe=Co(pe.props.children,he.mode,Re,pe.key),oe.return=he,he=oe):(Re=Id(pe.type,pe.key,pe.props,null,he.mode,Re),Re.ref=jl(he,oe,pe),Re.return=he,he=Re)}return V(he);case P:e:{for(rt=pe.key;oe!==null;){if(oe.key===rt)if(oe.tag===4&&oe.stateNode.containerInfo===pe.containerInfo&&oe.stateNode.implementation===pe.implementation){p(he,oe.sibling),oe=T(oe,pe.children||[]),oe.return=he,he=oe;break e}else{p(he,oe);break}else a(he,oe);oe=oe.sibling}oe=Xf(pe,he.mode,Re),oe.return=he,he=oe}return V(he);case U:return rt=pe._init,gr(he,oe,rt(pe._payload),Re)}if(Qe(pe))return We(he,oe,pe,Re);if(O(pe))return Ye(he,oe,pe,Re);ud(he,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"?(pe=""+pe,oe!==null&&oe.tag===6?(p(he,oe.sibling),oe=T(oe,pe),oe.return=he,he=oe):(p(he,oe),oe=Jf(pe,he.mode,Re),oe.return=he,he=oe),V(he)):p(he,oe)}return gr}var ua=O0(!0),F0=O0(!1),hd=Ei(null),fd=null,ha=null,of=null;function af(){of=ha=fd=null}function lf(i){var a=hd.current;Zt(hd),i._currentValue=a}function cf(i,a,p){for(;i!==null;){var S=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,S!==null&&(S.childLanes|=a)):S!==null&&(S.childLanes&a)!==a&&(S.childLanes|=a),i===p)break;i=i.return}}function fa(i,a){fd=i,of=ha=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&a)!==0&&(ks=!0),i.firstContext=null)}function en(i){var a=i._currentValue;if(of!==i)if(i={context:i,memoizedValue:a,next:null},ha===null){if(fd===null)throw Error(s(308));ha=i,fd.dependencies={lanes:0,firstContext:i}}else ha=ha.next=i;return a}var go=null;function df(i){go===null?go=[i]:go.push(i)}function B0(i,a,p,S){var T=a.interleaved;return T===null?(p.next=p,df(a)):(p.next=T.next,T.next=p),a.interleaved=p,oi(i,S)}function oi(i,a){i.lanes|=a;var p=i.alternate;for(p!==null&&(p.lanes|=a),p=i,i=i.return;i!==null;)i.childLanes|=a,p=i.alternate,p!==null&&(p.childLanes|=a),p=i,i=i.return;return p.tag===3?p.stateNode:null}var Ti=!1;function uf(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $0(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function ai(i,a){return{eventTime:i,lane:a,tag:0,payload:null,callback:null,next:null}}function Ri(i,a,p){var S=i.updateQueue;if(S===null)return null;if(S=S.shared,(At&2)!==0){var T=S.pending;return T===null?a.next=a:(a.next=T.next,T.next=a),S.pending=a,oi(i,p)}return T=S.interleaved,T===null?(a.next=a,df(S)):(a.next=T.next,T.next=a),S.interleaved=a,oi(i,p)}function md(i,a,p){if(a=a.updateQueue,a!==null&&(a=a.shared,(p&4194240)!==0)){var S=a.lanes;S&=i.pendingLanes,p|=S,a.lanes=p,Yo(i,p)}}function z0(i,a){var p=i.updateQueue,S=i.alternate;if(S!==null&&(S=S.updateQueue,p===S)){var T=null,D=null;if(p=p.firstBaseUpdate,p!==null){do{var V={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};D===null?T=D=V:D=D.next=V,p=p.next}while(p!==null);D===null?T=D=a:D=D.next=a}else T=D=a;p={baseState:S.baseState,firstBaseUpdate:T,lastBaseUpdate:D,shared:S.shared,effects:S.effects},i.updateQueue=p;return}i=p.lastBaseUpdate,i===null?p.firstBaseUpdate=a:i.next=a,p.lastBaseUpdate=a}function pd(i,a,p,S){var T=i.updateQueue;Ti=!1;var D=T.firstBaseUpdate,V=T.lastBaseUpdate,ee=T.shared.pending;if(ee!==null){T.shared.pending=null;var ie=ee,ge=ie.next;ie.next=null,V===null?D=ge:V.next=ge,V=ie;var ke=i.alternate;ke!==null&&(ke=ke.updateQueue,ee=ke.lastBaseUpdate,ee!==V&&(ee===null?ke.firstBaseUpdate=ge:ee.next=ge,ke.lastBaseUpdate=ie))}if(D!==null){var Ne=T.baseState;V=0,ke=ge=ie=null,ee=D;do{var Se=ee.lane,$e=ee.eventTime;if((S&Se)===Se){ke!==null&&(ke=ke.next={eventTime:$e,lane:0,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null});e:{var We=i,Ye=ee;switch(Se=a,$e=p,Ye.tag){case 1:if(We=Ye.payload,typeof We=="function"){Ne=We.call($e,Ne,Se);break e}Ne=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=Ye.payload,Se=typeof We=="function"?We.call($e,Ne,Se):We,Se==null)break e;Ne=R({},Ne,Se);break e;case 2:Ti=!0}}ee.callback!==null&&ee.lane!==0&&(i.flags|=64,Se=T.effects,Se===null?T.effects=[ee]:Se.push(ee))}else $e={eventTime:$e,lane:Se,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},ke===null?(ge=ke=$e,ie=Ne):ke=ke.next=$e,V|=Se;if(ee=ee.next,ee===null){if(ee=T.shared.pending,ee===null)break;Se=ee,ee=Se.next,Se.next=null,T.lastBaseUpdate=Se,T.shared.pending=null}}while(!0);if(ke===null&&(ie=Ne),T.baseState=ie,T.firstBaseUpdate=ge,T.lastBaseUpdate=ke,a=T.shared.interleaved,a!==null){T=a;do V|=T.lane,T=T.next;while(T!==a)}else D===null&&(T.shared.lanes=0);yo|=V,i.lanes=V,i.memoizedState=Ne}}function H0(i,a,p){if(i=a.effects,a.effects=null,i!==null)for(a=0;a<i.length;a++){var S=i[a],T=S.callback;if(T!==null){if(S.callback=null,S=p,typeof T!="function")throw Error(s(191,T));T.call(S)}}}var Nl={},Dn=Ei(Nl),El=Ei(Nl),Pl=Ei(Nl);function xo(i){if(i===Nl)throw Error(s(174));return i}function hf(i,a){switch(Gt(Pl,a),Gt(El,i),Gt(Dn,Nl),i=a.nodeType,i){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:ye(null,"");break;default:i=i===8?a.parentNode:a,a=i.namespaceURI||null,i=i.tagName,a=ye(a,i)}Zt(Dn),Gt(Dn,a)}function ma(){Zt(Dn),Zt(El),Zt(Pl)}function W0(i){xo(Pl.current);var a=xo(Dn.current),p=ye(a,i.type);a!==p&&(Gt(El,i),Gt(Dn,p))}function ff(i){El.current===i&&(Zt(Dn),Zt(El))}var lr=Ei(0);function gd(i){for(var a=i;a!==null;){if(a.tag===13){var p=a.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||p.data==="$?"||p.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var mf=[];function pf(){for(var i=0;i<mf.length;i++)mf[i]._workInProgressVersionPrimary=null;mf.length=0}var xd=k.ReactCurrentDispatcher,gf=k.ReactCurrentBatchConfig,vo=0,cr=null,jr=null,Lr=null,vd=!1,Al=!1,Tl=0,yE=0;function ns(){throw Error(s(321))}function xf(i,a){if(a===null)return!1;for(var p=0;p<a.length&&p<i.length;p++)if(!vn(i[p],a[p]))return!1;return!0}function vf(i,a,p,S,T,D){if(vo=D,cr=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,xd.current=i===null||i.memoizedState===null?CE:SE,i=p(S,T),Al){D=0;do{if(Al=!1,Tl=0,25<=D)throw Error(s(301));D+=1,Lr=jr=null,a.updateQueue=null,xd.current=kE,i=p(S,T)}while(Al)}if(xd.current=wd,a=jr!==null&&jr.next!==null,vo=0,Lr=jr=cr=null,vd=!1,a)throw Error(s(300));return i}function yf(){var i=Tl!==0;return Tl=0,i}function In(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lr===null?cr.memoizedState=Lr=i:Lr=Lr.next=i,Lr}function tn(){if(jr===null){var i=cr.alternate;i=i!==null?i.memoizedState:null}else i=jr.next;var a=Lr===null?cr.memoizedState:Lr.next;if(a!==null)Lr=a,jr=i;else{if(i===null)throw Error(s(310));jr=i,i={memoizedState:jr.memoizedState,baseState:jr.baseState,baseQueue:jr.baseQueue,queue:jr.queue,next:null},Lr===null?cr.memoizedState=Lr=i:Lr=Lr.next=i}return Lr}function Rl(i,a){return typeof a=="function"?a(i):a}function bf(i){var a=tn(),p=a.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=i;var S=jr,T=S.baseQueue,D=p.pending;if(D!==null){if(T!==null){var V=T.next;T.next=D.next,D.next=V}S.baseQueue=T=D,p.pending=null}if(T!==null){D=T.next,S=S.baseState;var ee=V=null,ie=null,ge=D;do{var ke=ge.lane;if((vo&ke)===ke)ie!==null&&(ie=ie.next={lane:0,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),S=ge.hasEagerState?ge.eagerState:i(S,ge.action);else{var Ne={lane:ke,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null};ie===null?(ee=ie=Ne,V=S):ie=ie.next=Ne,cr.lanes|=ke,yo|=ke}ge=ge.next}while(ge!==null&&ge!==D);ie===null?V=S:ie.next=ee,vn(S,a.memoizedState)||(ks=!0),a.memoizedState=S,a.baseState=V,a.baseQueue=ie,p.lastRenderedState=S}if(i=p.interleaved,i!==null){T=i;do D=T.lane,cr.lanes|=D,yo|=D,T=T.next;while(T!==i)}else T===null&&(p.lanes=0);return[a.memoizedState,p.dispatch]}function wf(i){var a=tn(),p=a.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=i;var S=p.dispatch,T=p.pending,D=a.memoizedState;if(T!==null){p.pending=null;var V=T=T.next;do D=i(D,V.action),V=V.next;while(V!==T);vn(D,a.memoizedState)||(ks=!0),a.memoizedState=D,a.baseQueue===null&&(a.baseState=D),p.lastRenderedState=D}return[D,S]}function V0(){}function U0(i,a){var p=cr,S=tn(),T=a(),D=!vn(S.memoizedState,T);if(D&&(S.memoizedState=T,ks=!0),S=S.queue,_f(K0.bind(null,p,S,i),[i]),S.getSnapshot!==a||D||Lr!==null&&Lr.memoizedState.tag&1){if(p.flags|=2048,Ml(9,q0.bind(null,p,S,T,a),void 0,null),Or===null)throw Error(s(349));(vo&30)!==0||G0(p,a,T)}return T}function G0(i,a,p){i.flags|=16384,i={getSnapshot:a,value:p},a=cr.updateQueue,a===null?(a={lastEffect:null,stores:null},cr.updateQueue=a,a.stores=[i]):(p=a.stores,p===null?a.stores=[i]:p.push(i))}function q0(i,a,p,S){a.value=p,a.getSnapshot=S,Y0(a)&&J0(i)}function K0(i,a,p){return p(function(){Y0(a)&&J0(i)})}function Y0(i){var a=i.getSnapshot;i=i.value;try{var p=a();return!vn(i,p)}catch{return!0}}function J0(i){var a=oi(i,1);a!==null&&Cn(a,i,1,-1)}function X0(i){var a=In();return typeof i=="function"&&(i=i()),a.memoizedState=a.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Rl,lastRenderedState:i},a.queue=i,i=i.dispatch=_E.bind(null,cr,i),[a.memoizedState,i]}function Ml(i,a,p,S){return i={tag:i,create:a,destroy:p,deps:S,next:null},a=cr.updateQueue,a===null?(a={lastEffect:null,stores:null},cr.updateQueue=a,a.lastEffect=i.next=i):(p=a.lastEffect,p===null?a.lastEffect=i.next=i:(S=p.next,p.next=i,i.next=S,a.lastEffect=i)),i}function Q0(){return tn().memoizedState}function yd(i,a,p,S){var T=In();cr.flags|=i,T.memoizedState=Ml(1|a,p,void 0,S===void 0?null:S)}function bd(i,a,p,S){var T=tn();S=S===void 0?null:S;var D=void 0;if(jr!==null){var V=jr.memoizedState;if(D=V.destroy,S!==null&&xf(S,V.deps)){T.memoizedState=Ml(a,p,D,S);return}}cr.flags|=i,T.memoizedState=Ml(1|a,p,D,S)}function Z0(i,a){return yd(8390656,8,i,a)}function _f(i,a){return bd(2048,8,i,a)}function ev(i,a){return bd(4,2,i,a)}function tv(i,a){return bd(4,4,i,a)}function rv(i,a){if(typeof a=="function")return i=i(),a(i),function(){a(null)};if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function sv(i,a,p){return p=p!=null?p.concat([i]):null,bd(4,4,rv.bind(null,a,i),p)}function Cf(){}function nv(i,a){var p=tn();a=a===void 0?null:a;var S=p.memoizedState;return S!==null&&a!==null&&xf(a,S[1])?S[0]:(p.memoizedState=[i,a],i)}function iv(i,a){var p=tn();a=a===void 0?null:a;var S=p.memoizedState;return S!==null&&a!==null&&xf(a,S[1])?S[0]:(i=i(),p.memoizedState=[i,a],i)}function ov(i,a,p){return(vo&21)===0?(i.baseState&&(i.baseState=!1,ks=!0),i.memoizedState=p):(vn(p,a)||(p=_s(),cr.lanes|=p,yo|=p,i.baseState=!0),a)}function bE(i,a){var p=Pt;Pt=p!==0&&4>p?p:4,i(!0);var S=gf.transition;gf.transition={};try{i(!1),a()}finally{Pt=p,gf.transition=S}}function av(){return tn().memoizedState}function wE(i,a,p){var S=Li(i);if(p={lane:S,action:p,hasEagerState:!1,eagerState:null,next:null},lv(i))cv(a,p);else if(p=B0(i,a,p,S),p!==null){var T=ps();Cn(p,i,S,T),dv(p,a,S)}}function _E(i,a,p){var S=Li(i),T={lane:S,action:p,hasEagerState:!1,eagerState:null,next:null};if(lv(i))cv(a,T);else{var D=i.alternate;if(i.lanes===0&&(D===null||D.lanes===0)&&(D=a.lastRenderedReducer,D!==null))try{var V=a.lastRenderedState,ee=D(V,p);if(T.hasEagerState=!0,T.eagerState=ee,vn(ee,V)){var ie=a.interleaved;ie===null?(T.next=T,df(a)):(T.next=ie.next,ie.next=T),a.interleaved=T;return}}catch{}finally{}p=B0(i,a,T,S),p!==null&&(T=ps(),Cn(p,i,S,T),dv(p,a,S))}}function lv(i){var a=i.alternate;return i===cr||a!==null&&a===cr}function cv(i,a){Al=vd=!0;var p=i.pending;p===null?a.next=a:(a.next=p.next,p.next=a),i.pending=a}function dv(i,a,p){if((p&4194240)!==0){var S=a.lanes;S&=i.pendingLanes,p|=S,a.lanes=p,Yo(i,p)}}var wd={readContext:en,useCallback:ns,useContext:ns,useEffect:ns,useImperativeHandle:ns,useInsertionEffect:ns,useLayoutEffect:ns,useMemo:ns,useReducer:ns,useRef:ns,useState:ns,useDebugValue:ns,useDeferredValue:ns,useTransition:ns,useMutableSource:ns,useSyncExternalStore:ns,useId:ns,unstable_isNewReconciler:!1},CE={readContext:en,useCallback:function(i,a){return In().memoizedState=[i,a===void 0?null:a],i},useContext:en,useEffect:Z0,useImperativeHandle:function(i,a,p){return p=p!=null?p.concat([i]):null,yd(4194308,4,rv.bind(null,a,i),p)},useLayoutEffect:function(i,a){return yd(4194308,4,i,a)},useInsertionEffect:function(i,a){return yd(4,2,i,a)},useMemo:function(i,a){var p=In();return a=a===void 0?null:a,i=i(),p.memoizedState=[i,a],i},useReducer:function(i,a,p){var S=In();return a=p!==void 0?p(a):a,S.memoizedState=S.baseState=a,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:a},S.queue=i,i=i.dispatch=wE.bind(null,cr,i),[S.memoizedState,i]},useRef:function(i){var a=In();return i={current:i},a.memoizedState=i},useState:X0,useDebugValue:Cf,useDeferredValue:function(i){return In().memoizedState=i},useTransition:function(){var i=X0(!1),a=i[0];return i=bE.bind(null,i[1]),In().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,p){var S=cr,T=In();if(nr){if(p===void 0)throw Error(s(407));p=p()}else{if(p=a(),Or===null)throw Error(s(349));(vo&30)!==0||G0(S,a,p)}T.memoizedState=p;var D={value:p,getSnapshot:a};return T.queue=D,Z0(K0.bind(null,S,D,i),[i]),S.flags|=2048,Ml(9,q0.bind(null,S,D,p,a),void 0,null),p},useId:function(){var i=In(),a=Or.identifierPrefix;if(nr){var p=ii,S=ni;p=(S&~(1<<32-Mr(S)-1)).toString(32)+p,a=":"+a+"R"+p,p=Tl++,0<p&&(a+="H"+p.toString(32)),a+=":"}else p=yE++,a=":"+a+"r"+p.toString(32)+":";return i.memoizedState=a},unstable_isNewReconciler:!1},SE={readContext:en,useCallback:nv,useContext:en,useEffect:_f,useImperativeHandle:sv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:iv,useReducer:bf,useRef:Q0,useState:function(){return bf(Rl)},useDebugValue:Cf,useDeferredValue:function(i){var a=tn();return ov(a,jr.memoizedState,i)},useTransition:function(){var i=bf(Rl)[0],a=tn().memoizedState;return[i,a]},useMutableSource:V0,useSyncExternalStore:U0,useId:av,unstable_isNewReconciler:!1},kE={readContext:en,useCallback:nv,useContext:en,useEffect:_f,useImperativeHandle:sv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:iv,useReducer:wf,useRef:Q0,useState:function(){return wf(Rl)},useDebugValue:Cf,useDeferredValue:function(i){var a=tn();return jr===null?a.memoizedState=i:ov(a,jr.memoizedState,i)},useTransition:function(){var i=wf(Rl)[0],a=tn().memoizedState;return[i,a]},useMutableSource:V0,useSyncExternalStore:U0,useId:av,unstable_isNewReconciler:!1};function bn(i,a){if(i&&i.defaultProps){a=R({},a),i=i.defaultProps;for(var p in i)a[p]===void 0&&(a[p]=i[p]);return a}return a}function Sf(i,a,p,S){a=i.memoizedState,p=p(S,a),p=p==null?a:R({},a,p),i.memoizedState=p,i.lanes===0&&(i.updateQueue.baseState=p)}var _d={isMounted:function(i){return(i=i._reactInternals)?mn(i)===i:!1},enqueueSetState:function(i,a,p){i=i._reactInternals;var S=ps(),T=Li(i),D=ai(S,T);D.payload=a,p!=null&&(D.callback=p),a=Ri(i,D,T),a!==null&&(Cn(a,i,T,S),md(a,i,T))},enqueueReplaceState:function(i,a,p){i=i._reactInternals;var S=ps(),T=Li(i),D=ai(S,T);D.tag=1,D.payload=a,p!=null&&(D.callback=p),a=Ri(i,D,T),a!==null&&(Cn(a,i,T,S),md(a,i,T))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var p=ps(),S=Li(i),T=ai(p,S);T.tag=2,a!=null&&(T.callback=a),a=Ri(i,T,S),a!==null&&(Cn(a,i,S,p),md(a,i,S))}};function uv(i,a,p,S,T,D,V){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(S,D,V):a.prototype&&a.prototype.isPureReactComponent?!yl(p,S)||!yl(T,D):!0}function hv(i,a,p){var S=!1,T=Pi,D=a.contextType;return typeof D=="object"&&D!==null?D=en(D):(T=Ss(a)?fo:ss.current,S=a.contextTypes,D=(S=S!=null)?aa(i,T):Pi),a=new a(p,D),i.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=_d,i.stateNode=a,a._reactInternals=i,S&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=T,i.__reactInternalMemoizedMaskedChildContext=D),a}function fv(i,a,p,S){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(p,S),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(p,S),a.state!==i&&_d.enqueueReplaceState(a,a.state,null)}function kf(i,a,p,S){var T=i.stateNode;T.props=p,T.state=i.memoizedState,T.refs={},uf(i);var D=a.contextType;typeof D=="object"&&D!==null?T.context=en(D):(D=Ss(a)?fo:ss.current,T.context=aa(i,D)),T.state=i.memoizedState,D=a.getDerivedStateFromProps,typeof D=="function"&&(Sf(i,a,D,p),T.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof T.getSnapshotBeforeUpdate=="function"||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(a=T.state,typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount(),a!==T.state&&_d.enqueueReplaceState(T,T.state,null),pd(i,p,T,S),T.state=i.memoizedState),typeof T.componentDidMount=="function"&&(i.flags|=4194308)}function pa(i,a){try{var p="",S=a;do p+=ce(S),S=S.return;while(S);var T=p}catch(D){T=`
37
+ `+T[V].replace(" at new "," at ");return i.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",i.displayName)),ie}while(1<=V&&0<=ee);break}}}finally{F=!1,Error.prepareStackTrace=p}return(i=i?i.displayName||i.name:"")?G(i):""}function ce(i){switch(i.tag){case 5:return G(i.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return i=te(i.type,!1),i;case 11:return i=te(i.type.render,!1),i;case 1:return i=te(i.type,!0),i;default:return""}}function fe(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case P:return"Portal";case M:return"Profiler";case N:return"StrictMode";case z:return"Suspense";case Y:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case L:return(i.displayName||"Context")+".Consumer";case I:return(i._context.displayName||"Context")+".Provider";case B:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case H:return a=i.displayName||null,a!==null?a:fe(i.type)||"Memo";case U:a=i._payload,i=i._init;try{return fe(i(a))}catch{}}return null}function J(i){var a=i.type;switch(i.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=a.render,i=i.displayName||i.name||"",a.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(a);case 8:return a===N?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function W(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ae(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ne(i){var a=ae(i)?"checked":"value",p=Object.getOwnPropertyDescriptor(i.constructor.prototype,a),S=""+i[a];if(!i.hasOwnProperty(a)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var T=p.get,D=p.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return T.call(this)},set:function(V){S=""+V,D.call(this,V)}}),Object.defineProperty(i,a,{enumerable:p.enumerable}),{getValue:function(){return S},setValue:function(V){S=""+V},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function Z(i){i._valueTracker||(i._valueTracker=ne(i))}function le(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var p=a.getValue(),S="";return i&&(S=ae(i)?i.checked?"true":"false":i.value),i=S,i!==p?(a.setValue(i),!0):!1}function Ce(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Le(i,a){var p=a.checked;return R({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??i._wrapperState.initialChecked})}function Ge(i,a){var p=a.defaultValue==null?"":a.defaultValue,S=a.checked!=null?a.checked:a.defaultChecked;p=W(a.value!=null?a.value:p),i._wrapperState={initialChecked:S,initialValue:p,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function me(i,a){a=a.checked,a!=null&&b(i,"checked",a,!1)}function be(i,a){me(i,a);var p=W(a.value),S=a.type;if(p!=null)S==="number"?(p===0&&i.value===""||i.value!=p)&&(i.value=""+p):i.value!==""+p&&(i.value=""+p);else if(S==="submit"||S==="reset"){i.removeAttribute("value");return}a.hasOwnProperty("value")?Ke(i,a.type,p):a.hasOwnProperty("defaultValue")&&Ke(i,a.type,W(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(i.defaultChecked=!!a.defaultChecked)}function Be(i,a,p){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var S=a.type;if(!(S!=="submit"&&S!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+i._wrapperState.initialValue,p||a===i.value||(i.value=a),i.defaultValue=a}p=i.name,p!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,p!==""&&(i.name=p)}function Ke(i,a,p){(a!=="number"||Ce(i.ownerDocument)!==i)&&(p==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+p&&(i.defaultValue=""+p))}var Qe=Array.isArray;function je(i,a,p,S){if(i=i.options,a){a={};for(var T=0;T<p.length;T++)a["$"+p[T]]=!0;for(p=0;p<i.length;p++)T=a.hasOwnProperty("$"+i[p].value),i[p].selected!==T&&(i[p].selected=T),T&&S&&(i[p].defaultSelected=!0)}else{for(p=""+W(p),a=null,T=0;T<i.length;T++){if(i[T].value===p){i[T].selected=!0,S&&(i[T].defaultSelected=!0);return}a!==null||i[T].disabled||(a=i[T])}a!==null&&(a.selected=!0)}}function we(i,a){if(a.dangerouslySetInnerHTML!=null)throw Error(s(91));return R({},a,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function ve(i,a){var p=a.value;if(p==null){if(p=a.children,a=a.defaultValue,p!=null){if(a!=null)throw Error(s(92));if(Qe(p)){if(1<p.length)throw Error(s(93));p=p[0]}a=p}a==null&&(a=""),p=a}i._wrapperState={initialValue:W(p)}}function _e(i,a){var p=W(a.value),S=W(a.defaultValue);p!=null&&(p=""+p,p!==i.value&&(i.value=p),a.defaultValue==null&&i.defaultValue!==p&&(i.defaultValue=p)),S!=null&&(i.defaultValue=""+S)}function Oe(i){var a=i.textContent;a===i._wrapperState.initialValue&&a!==""&&a!==null&&(i.value=a)}function de(i){switch(i){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 ye(i,a){return i==null||i==="http://www.w3.org/1999/xhtml"?de(a):i==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var Re,ze=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,p,S,T){MSApp.execUnsafeLocalFunction(function(){return i(a,p,S,T)})}:i})(function(i,a){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=a;else{for(Re=Re||document.createElement("div"),Re.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Re.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;a.firstChild;)i.appendChild(a.firstChild)}});function Je(i,a){if(a){var p=i.firstChild;if(p&&p===i.lastChild&&p.nodeType===3){p.nodeValue=a;return}}i.textContent=a}var Et={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},at=["Webkit","ms","Moz","O"];Object.keys(Et).forEach(function(i){at.forEach(function(a){a=a+i.charAt(0).toUpperCase()+i.substring(1),Et[a]=Et[i]})});function ur(i,a,p){return a==null||typeof a=="boolean"||a===""?"":p||typeof a!="number"||a===0||Et.hasOwnProperty(i)&&Et[i]?(""+a).trim():a+"px"}function Rr(i,a){i=i.style;for(var p in a)if(a.hasOwnProperty(p)){var S=p.indexOf("--")===0,T=ur(p,a[p],S);p==="float"&&(p="cssFloat"),S?i.setProperty(p,T):i[p]=T}}var Wr=R({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 Jt(i,a){if(a){if(Wr[i]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(s(137,i));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(s(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(s(61))}if(a.style!=null&&typeof a.style!="object")throw Error(s(62))}}function Cr(i,a){if(i.indexOf("-")===-1)return typeof a.is=="string";switch(i){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 Wt=null;function yr(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var us=null,Xr=null,Ls=null;function Os(i){if(i=kl(i)){if(typeof us!="function")throw Error(s(280));var a=i.stateNode;a&&(a=nd(a),us(i.stateNode,i.type,a))}}function it(i){Xr?Ls?Ls.push(i):Ls=[i]:Xr=i}function zt(){if(Xr){var i=Xr,a=Ls;if(Ls=Xr=null,Os(i),a)for(i=0;i<a.length;i++)Os(a[i])}}function rr(i,a){return i(a)}function ar(){}var ws=!1;function Vt(i,a,p){if(ws)return i(a,p);ws=!0;try{return rr(i,a,p)}finally{ws=!1,(Xr!==null||Ls!==null)&&(ar(),zt())}}function Ut(i,a){var p=i.stateNode;if(p===null)return null;var S=nd(p);if(S===null)return null;p=S[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(S=!S.disabled)||(i=i.type,S=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!S;break e;default:i=!1}if(i)return null;if(p&&typeof p!="function")throw Error(s(231,a,typeof p));return p}var Vr=!1;if(l)try{var ut={};Object.defineProperty(ut,"passive",{get:function(){Vr=!0}}),window.addEventListener("test",ut,ut),window.removeEventListener("test",ut,ut)}catch{Vr=!1}function hr(i,a,p,S,T,D,V,ee,ie){var ge=Array.prototype.slice.call(arguments,3);try{a.apply(p,ge)}catch(ke){this.onError(ke)}}var hs=!1,Qr=null,Ze=!1,fn=null,al={onError:function(i){hs=!0,Qr=i}};function Zr(i,a,p,S,T,D,V,ee,ie){hs=!1,Qr=null,hr.apply(al,arguments)}function wi(i,a,p,S,T,D,V,ee,ie){if(Zr.apply(this,arguments),hs){if(hs){var ge=Qr;hs=!1,Qr=null}else throw Error(s(198));Ze||(Ze=!0,fn=ge)}}function mn(i){var a=i,p=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(p=a.return),i=a.return;while(i)}return a.tag===3?p:null}function Sr(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function so(i){if(mn(i)!==i)throw Error(s(188))}function Wo(i){var a=i.alternate;if(!a){if(a=mn(i),a===null)throw Error(s(188));return a!==i?null:i}for(var p=i,S=a;;){var T=p.return;if(T===null)break;var D=T.alternate;if(D===null){if(S=T.return,S!==null){p=S;continue}break}if(T.child===D.child){for(D=T.child;D;){if(D===p)return so(T),i;if(D===S)return so(T),a;D=D.sibling}throw Error(s(188))}if(p.return!==S.return)p=T,S=D;else{for(var V=!1,ee=T.child;ee;){if(ee===p){V=!0,p=T,S=D;break}if(ee===S){V=!0,S=T,p=D;break}ee=ee.sibling}if(!V){for(ee=D.child;ee;){if(ee===p){V=!0,p=D,S=T;break}if(ee===S){V=!0,S=D,p=T;break}ee=ee.sibling}if(!V)throw Error(s(189))}}if(p.alternate!==S)throw Error(s(190))}if(p.tag!==3)throw Error(s(188));return p.stateNode.current===p?i:a}function Vo(i){return i=Wo(i),i!==null?_i(i):null}function _i(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var a=_i(i);if(a!==null)return a;i=i.sibling}return null}var Uo=t.unstable_scheduleCallback,Go=t.unstable_cancelCallback,qo=t.unstable_shouldYield,no=t.unstable_requestPaint,Xt=t.unstable_now,ll=t.unstable_getCurrentPriorityLevel,Js=t.unstable_ImmediatePriority,io=t.unstable_UserBlockingPriority,Tn=t.unstable_NormalPriority,Ko=t.unstable_LowPriority,oo=t.unstable_IdlePriority,Zn=null,fs=null;function ao(i){if(fs&&typeof fs.onCommitFiberRoot=="function")try{fs.onCommitFiberRoot(Zn,i,void 0,(i.current.flags&128)===128)}catch{}}var Mr=Math.clz32?Math.clz32:qe,Q=Math.log,Ie=Math.LN2;function qe(i){return i>>>=0,i===0?32:31-(Q(i)/Ie|0)|0}var kt=64,$t=4194304;function jt(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function sr(i,a){var p=i.pendingLanes;if(p===0)return 0;var S=0,T=i.suspendedLanes,D=i.pingedLanes,V=p&268435455;if(V!==0){var ee=V&~T;ee!==0?S=jt(ee):(D&=V,D!==0&&(S=jt(D)))}else V=p&~T,V!==0?S=jt(V):D!==0&&(S=jt(D));if(S===0)return 0;if(a!==0&&a!==S&&(a&T)===0&&(T=S&-S,D=a&-a,T>=D||T===16&&(D&4194240)!==0))return a;if((S&4)!==0&&(S|=p&16),a=i.entangledLanes,a!==0)for(i=i.entanglements,a&=S;0<a;)p=31-Mr(a),T=1<<p,S|=i[p],a&=~T;return S}function br(i,a){switch(i){case 1:case 2:case 4:return a+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 a+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 pr(i,a){for(var p=i.suspendedLanes,S=i.pingedLanes,T=i.expirationTimes,D=i.pendingLanes;0<D;){var V=31-Mr(D),ee=1<<V,ie=T[V];ie===-1?((ee&p)===0||(ee&S)!==0)&&(T[V]=br(ee,a)):ie<=a&&(i.expiredLanes|=ee),D&=~ee}}function es(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function _s(){var i=kt;return kt<<=1,(kt&4194240)===0&&(kt=64),i}function Xs(i){for(var a=[],p=0;31>p;p++)a.push(i);return a}function Rn(i,a,p){i.pendingLanes|=a,a!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,a=31-Mr(a),i[a]=p}function Vc(i,a){var p=i.pendingLanes&~a;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=a,i.mutableReadLanes&=a,i.entangledLanes&=a,a=i.entanglements;var S=i.eventTimes;for(i=i.expirationTimes;0<p;){var T=31-Mr(p),D=1<<T;a[T]=0,S[T]=-1,i[T]=-1,p&=~D}}function Yo(i,a){var p=i.entangledLanes|=a;for(i=i.entanglements;p;){var S=31-Mr(p),T=1<<S;T&a|i[S]&a&&(i[S]|=a),p&=~T}}var Pt=0;function cl(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var dl,Jo,ul,hl,fl,Xo=!1,lo=[],pn=null,gn=null,xn=null,se=new Map,De=new Map,Rt=[],kr="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 ts(i,a){switch(i){case"focusin":case"focusout":pn=null;break;case"dragenter":case"dragleave":gn=null;break;case"mouseover":case"mouseout":xn=null;break;case"pointerover":case"pointerout":se.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":De.delete(a.pointerId)}}function bt(i,a,p,S,T,D){return i===null||i.nativeEvent!==D?(i={blockedOn:a,domEventName:p,eventSystemFlags:S,nativeEvent:D,targetContainers:[T]},a!==null&&(a=kl(a),a!==null&&Jo(a)),i):(i.eventSystemFlags|=S,a=i.targetContainers,T!==null&&a.indexOf(T)===-1&&a.push(T),i)}function Dr(i,a,p,S,T){switch(a){case"focusin":return pn=bt(pn,i,a,p,S,T),!0;case"dragenter":return gn=bt(gn,i,a,p,S,T),!0;case"mouseover":return xn=bt(xn,i,a,p,S,T),!0;case"pointerover":var D=T.pointerId;return se.set(D,bt(se.get(D)||null,i,a,p,S,T)),!0;case"gotpointercapture":return D=T.pointerId,De.set(D,bt(De.get(D)||null,i,a,p,S,T)),!0}return!1}function Ir(i){var a=ho(i.target);if(a!==null){var p=mn(a);if(p!==null){if(a=p.tag,a===13){if(a=Sr(p),a!==null){i.blockedOn=a,fl(i.priority,function(){ul(p)});return}}else if(a===3&&p.stateNode.current.memoizedState.isDehydrated){i.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}i.blockedOn=null}function rs(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var p=Eh(i.domEventName,i.eventSystemFlags,a[0],i.nativeEvent);if(p===null){p=i.nativeEvent;var S=new p.constructor(p.type,p);Wt=S,p.target.dispatchEvent(S),Wt=null}else return a=kl(p),a!==null&&Jo(a),i.blockedOn=p,!1;a.shift()}return!0}function ei(i,a,p){rs(i)&&p.delete(a)}function co(){Xo=!1,pn!==null&&rs(pn)&&(pn=null),gn!==null&&rs(gn)&&(gn=null),xn!==null&&rs(xn)&&(xn=null),se.forEach(ei),De.forEach(ei)}function Ci(i,a){i.blockedOn===a&&(i.blockedOn=null,Xo||(Xo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,co)))}function Si(i){function a(T){return Ci(T,i)}if(0<lo.length){Ci(lo[0],i);for(var p=1;p<lo.length;p++){var S=lo[p];S.blockedOn===i&&(S.blockedOn=null)}}for(pn!==null&&Ci(pn,i),gn!==null&&Ci(gn,i),xn!==null&&Ci(xn,i),se.forEach(a),De.forEach(a),p=0;p<Rt.length;p++)S=Rt[p],S.blockedOn===i&&(S.blockedOn=null);for(;0<Rt.length&&(p=Rt[0],p.blockedOn===null);)Ir(p),p.blockedOn===null&&Rt.shift()}var ti=k.ReactCurrentBatchConfig,uo=!0;function Uc(i,a,p,S){var T=Pt,D=ti.transition;ti.transition=null;try{Pt=1,gt(i,a,p,S)}finally{Pt=T,ti.transition=D}}function Gc(i,a,p,S){var T=Pt,D=ti.transition;ti.transition=null;try{Pt=4,gt(i,a,p,S)}finally{Pt=T,ti.transition=D}}function gt(i,a,p,S){if(uo){var T=Eh(i,a,p,S);if(T===null)Uh(i,a,S,Qo,p),ts(i,S);else if(Dr(T,i,a,p,S))S.stopPropagation();else if(ts(i,S),a&4&&-1<kr.indexOf(i)){for(;T!==null;){var D=kl(T);if(D!==null&&dl(D),D=Eh(i,a,p,S),D===null&&Uh(i,a,S,Qo,p),D===T)break;T=D}T!==null&&S.stopPropagation()}else Uh(i,a,S,null,p)}}var Qo=null;function Eh(i,a,p,S){if(Qo=null,i=yr(S),i=ho(i),i!==null)if(a=mn(i),a===null)i=null;else if(p=a.tag,p===13){if(i=Sr(a),i!==null)return i;i=null}else if(p===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null);return Qo=i,null}function Ux(i){switch(i){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(ll()){case Js:return 1;case io:return 4;case Tn:case Ko:return 16;case oo:return 536870912;default:return 16}default:return 16}}var ki=null,Ph=null,qc=null;function Gx(){if(qc)return qc;var i,a=Ph,p=a.length,S,T="value"in ki?ki.value:ki.textContent,D=T.length;for(i=0;i<p&&a[i]===T[i];i++);var V=p-i;for(S=1;S<=V&&a[p-S]===T[D-S];S++);return qc=T.slice(i,1<S?1-S:void 0)}function Kc(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function Yc(){return!0}function qx(){return!1}function Fs(i){function a(p,S,T,D,V){this._reactName=p,this._targetInst=T,this.type=S,this.nativeEvent=D,this.target=V,this.currentTarget=null;for(var ee in i)i.hasOwnProperty(ee)&&(p=i[ee],this[ee]=p?p(D):D[ee]);return this.isDefaultPrevented=(D.defaultPrevented!=null?D.defaultPrevented:D.returnValue===!1)?Yc:qx,this.isPropagationStopped=qx,this}return R(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=Yc)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=Yc)},persist:function(){},isPersistent:Yc}),a}var Zo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ah=Fs(Zo),ml=R({},Zo,{view:0,detail:0}),k2=Fs(ml),Th,Rh,pl,Jc=R({},ml,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dh,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==pl&&(pl&&i.type==="mousemove"?(Th=i.screenX-pl.screenX,Rh=i.screenY-pl.screenY):Rh=Th=0,pl=i),Th)},movementY:function(i){return"movementY"in i?i.movementY:Rh}}),Kx=Fs(Jc),j2=R({},Jc,{dataTransfer:0}),N2=Fs(j2),E2=R({},ml,{relatedTarget:0}),Mh=Fs(E2),P2=R({},Zo,{animationName:0,elapsedTime:0,pseudoElement:0}),A2=Fs(P2),T2=R({},Zo,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),R2=Fs(T2),M2=R({},Zo,{data:0}),Yx=Fs(M2),D2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},I2={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"},L2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function O2(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=L2[i])?!!a[i]:!1}function Dh(){return O2}var F2=R({},ml,{key:function(i){if(i.key){var a=D2[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=Kc(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?I2[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dh,charCode:function(i){return i.type==="keypress"?Kc(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Kc(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),B2=Fs(F2),$2=R({},Jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jx=Fs($2),z2=R({},ml,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dh}),H2=Fs(z2),W2=R({},Zo,{propertyName:0,elapsedTime:0,pseudoElement:0}),V2=Fs(W2),U2=R({},Jc,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),G2=Fs(U2),q2=[9,13,27,32],Ih=l&&"CompositionEvent"in window,gl=null;l&&"documentMode"in document&&(gl=document.documentMode);var K2=l&&"TextEvent"in window&&!gl,Xx=l&&(!Ih||gl&&8<gl&&11>=gl),Qx=" ",Zx=!1;function e0(i,a){switch(i){case"keyup":return q2.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function t0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ea=!1;function Y2(i,a){switch(i){case"compositionend":return t0(a);case"keypress":return a.which!==32?null:(Zx=!0,Qx);case"textInput":return i=a.data,i===Qx&&Zx?null:i;default:return null}}function J2(i,a){if(ea)return i==="compositionend"||!Ih&&e0(i,a)?(i=Gx(),qc=Ph=ki=null,ea=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Xx&&a.locale!=="ko"?null:a.data;default:return null}}var X2={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 r0(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!X2[i.type]:a==="textarea"}function s0(i,a,p,S){it(S),a=td(a,"onChange"),0<a.length&&(p=new Ah("onChange","change",null,p,S),i.push({event:p,listeners:a}))}var xl=null,vl=null;function Q2(i){w0(i,0)}function Xc(i){var a=ia(i);if(le(a))return i}function Z2(i,a){if(i==="change")return a}var n0=!1;if(l){var Lh;if(l){var Oh="oninput"in document;if(!Oh){var i0=document.createElement("div");i0.setAttribute("oninput","return;"),Oh=typeof i0.oninput=="function"}Lh=Oh}else Lh=!1;n0=Lh&&(!document.documentMode||9<document.documentMode)}function o0(){xl&&(xl.detachEvent("onpropertychange",a0),vl=xl=null)}function a0(i){if(i.propertyName==="value"&&Xc(vl)){var a=[];s0(a,vl,i,yr(i)),Vt(Q2,a)}}function eE(i,a,p){i==="focusin"?(o0(),xl=a,vl=p,xl.attachEvent("onpropertychange",a0)):i==="focusout"&&o0()}function tE(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Xc(vl)}function rE(i,a){if(i==="click")return Xc(a)}function sE(i,a){if(i==="input"||i==="change")return Xc(a)}function nE(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var vn=typeof Object.is=="function"?Object.is:nE;function yl(i,a){if(vn(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var p=Object.keys(i),S=Object.keys(a);if(p.length!==S.length)return!1;for(S=0;S<p.length;S++){var T=p[S];if(!d.call(a,T)||!vn(i[T],a[T]))return!1}return!0}function l0(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function c0(i,a){var p=l0(i);i=0;for(var S;p;){if(p.nodeType===3){if(S=i+p.textContent.length,i<=a&&S>=a)return{node:p,offset:a-i};i=S}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=l0(p)}}function d0(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?d0(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function u0(){for(var i=window,a=Ce();a instanceof i.HTMLIFrameElement;){try{var p=typeof a.contentWindow.location.href=="string"}catch{p=!1}if(p)i=a.contentWindow;else break;a=Ce(i.document)}return a}function Fh(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}function iE(i){var a=u0(),p=i.focusedElem,S=i.selectionRange;if(a!==p&&p&&p.ownerDocument&&d0(p.ownerDocument.documentElement,p)){if(S!==null&&Fh(p)){if(a=S.start,i=S.end,i===void 0&&(i=a),"selectionStart"in p)p.selectionStart=a,p.selectionEnd=Math.min(i,p.value.length);else if(i=(a=p.ownerDocument||document)&&a.defaultView||window,i.getSelection){i=i.getSelection();var T=p.textContent.length,D=Math.min(S.start,T);S=S.end===void 0?D:Math.min(S.end,T),!i.extend&&D>S&&(T=S,S=D,D=T),T=c0(p,D);var V=c0(p,S);T&&V&&(i.rangeCount!==1||i.anchorNode!==T.node||i.anchorOffset!==T.offset||i.focusNode!==V.node||i.focusOffset!==V.offset)&&(a=a.createRange(),a.setStart(T.node,T.offset),i.removeAllRanges(),D>S?(i.addRange(a),i.extend(V.node,V.offset)):(a.setEnd(V.node,V.offset),i.addRange(a)))}}for(a=[],i=p;i=i.parentNode;)i.nodeType===1&&a.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<a.length;p++)i=a[p],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var oE=l&&"documentMode"in document&&11>=document.documentMode,ta=null,Bh=null,bl=null,$h=!1;function h0(i,a,p){var S=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;$h||ta==null||ta!==Ce(S)||(S=ta,"selectionStart"in S&&Fh(S)?S={start:S.selectionStart,end:S.selectionEnd}:(S=(S.ownerDocument&&S.ownerDocument.defaultView||window).getSelection(),S={anchorNode:S.anchorNode,anchorOffset:S.anchorOffset,focusNode:S.focusNode,focusOffset:S.focusOffset}),bl&&yl(bl,S)||(bl=S,S=td(Bh,"onSelect"),0<S.length&&(a=new Ah("onSelect","select",null,a,p),i.push({event:a,listeners:S}),a.target=ta)))}function Qc(i,a){var p={};return p[i.toLowerCase()]=a.toLowerCase(),p["Webkit"+i]="webkit"+a,p["Moz"+i]="moz"+a,p}var ra={animationend:Qc("Animation","AnimationEnd"),animationiteration:Qc("Animation","AnimationIteration"),animationstart:Qc("Animation","AnimationStart"),transitionend:Qc("Transition","TransitionEnd")},zh={},f0={};l&&(f0=document.createElement("div").style,"AnimationEvent"in window||(delete ra.animationend.animation,delete ra.animationiteration.animation,delete ra.animationstart.animation),"TransitionEvent"in window||delete ra.transitionend.transition);function Zc(i){if(zh[i])return zh[i];if(!ra[i])return i;var a=ra[i],p;for(p in a)if(a.hasOwnProperty(p)&&p in f0)return zh[i]=a[p];return i}var m0=Zc("animationend"),p0=Zc("animationiteration"),g0=Zc("animationstart"),x0=Zc("transitionend"),v0=new Map,y0="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 ji(i,a){v0.set(i,a),c(a,[i])}for(var Hh=0;Hh<y0.length;Hh++){var Wh=y0[Hh],aE=Wh.toLowerCase(),lE=Wh[0].toUpperCase()+Wh.slice(1);ji(aE,"on"+lE)}ji(m0,"onAnimationEnd"),ji(p0,"onAnimationIteration"),ji(g0,"onAnimationStart"),ji("dblclick","onDoubleClick"),ji("focusin","onFocus"),ji("focusout","onBlur"),ji(x0,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wl="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(" "),cE=new Set("cancel close invalid load scroll toggle".split(" ").concat(wl));function b0(i,a,p){var S=i.type||"unknown-event";i.currentTarget=p,wi(S,a,void 0,i),i.currentTarget=null}function w0(i,a){a=(a&4)!==0;for(var p=0;p<i.length;p++){var S=i[p],T=S.event;S=S.listeners;e:{var D=void 0;if(a)for(var V=S.length-1;0<=V;V--){var ee=S[V],ie=ee.instance,ge=ee.currentTarget;if(ee=ee.listener,ie!==D&&T.isPropagationStopped())break e;b0(T,ee,ge),D=ie}else for(V=0;V<S.length;V++){if(ee=S[V],ie=ee.instance,ge=ee.currentTarget,ee=ee.listener,ie!==D&&T.isPropagationStopped())break e;b0(T,ee,ge),D=ie}}}if(Ze)throw i=fn,Ze=!1,fn=null,i}function Qt(i,a){var p=a[Xh];p===void 0&&(p=a[Xh]=new Set);var S=i+"__bubble";p.has(S)||(_0(a,i,2,!1),p.add(S))}function Vh(i,a,p){var S=0;a&&(S|=4),_0(p,i,S,a)}var ed="_reactListening"+Math.random().toString(36).slice(2);function _l(i){if(!i[ed]){i[ed]=!0,n.forEach(function(p){p!=="selectionchange"&&(cE.has(p)||Vh(p,!1,i),Vh(p,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[ed]||(a[ed]=!0,Vh("selectionchange",!1,a))}}function _0(i,a,p,S){switch(Ux(a)){case 1:var T=Uc;break;case 4:T=Gc;break;default:T=gt}p=T.bind(null,a,p,i),T=void 0,!Vr||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(T=!0),S?T!==void 0?i.addEventListener(a,p,{capture:!0,passive:T}):i.addEventListener(a,p,!0):T!==void 0?i.addEventListener(a,p,{passive:T}):i.addEventListener(a,p,!1)}function Uh(i,a,p,S,T){var D=S;if((a&1)===0&&(a&2)===0&&S!==null)e:for(;;){if(S===null)return;var V=S.tag;if(V===3||V===4){var ee=S.stateNode.containerInfo;if(ee===T||ee.nodeType===8&&ee.parentNode===T)break;if(V===4)for(V=S.return;V!==null;){var ie=V.tag;if((ie===3||ie===4)&&(ie=V.stateNode.containerInfo,ie===T||ie.nodeType===8&&ie.parentNode===T))return;V=V.return}for(;ee!==null;){if(V=ho(ee),V===null)return;if(ie=V.tag,ie===5||ie===6){S=D=V;continue e}ee=ee.parentNode}}S=S.return}Vt(function(){var ge=D,ke=yr(p),Ne=[];e:{var Se=v0.get(i);if(Se!==void 0){var $e=Ah,We=i;switch(i){case"keypress":if(Kc(p)===0)break e;case"keydown":case"keyup":$e=B2;break;case"focusin":We="focus",$e=Mh;break;case"focusout":We="blur",$e=Mh;break;case"beforeblur":case"afterblur":$e=Mh;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":$e=Kx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$e=N2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$e=H2;break;case m0:case p0:case g0:$e=A2;break;case x0:$e=V2;break;case"scroll":$e=k2;break;case"wheel":$e=G2;break;case"copy":case"cut":case"paste":$e=R2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$e=Jx}var Ye=(a&4)!==0,gr=!Ye&&i==="scroll",he=Ye?Se!==null?Se+"Capture":null:Se;Ye=[];for(var oe=ge,pe;oe!==null;){pe=oe;var Me=pe.stateNode;if(pe.tag===5&&Me!==null&&(pe=Me,he!==null&&(Me=Ut(oe,he),Me!=null&&Ye.push(Cl(oe,Me,pe)))),gr)break;oe=oe.return}0<Ye.length&&(Se=new $e(Se,We,null,p,ke),Ne.push({event:Se,listeners:Ye}))}}if((a&7)===0){e:{if(Se=i==="mouseover"||i==="pointerover",$e=i==="mouseout"||i==="pointerout",Se&&p!==Wt&&(We=p.relatedTarget||p.fromElement)&&(ho(We)||We[ri]))break e;if(($e||Se)&&(Se=ke.window===ke?ke:(Se=ke.ownerDocument)?Se.defaultView||Se.parentWindow:window,$e?(We=p.relatedTarget||p.toElement,$e=ge,We=We?ho(We):null,We!==null&&(gr=mn(We),We!==gr||We.tag!==5&&We.tag!==6)&&(We=null)):($e=null,We=ge),$e!==We)){if(Ye=Kx,Me="onMouseLeave",he="onMouseEnter",oe="mouse",(i==="pointerout"||i==="pointerover")&&(Ye=Jx,Me="onPointerLeave",he="onPointerEnter",oe="pointer"),gr=$e==null?Se:ia($e),pe=We==null?Se:ia(We),Se=new Ye(Me,oe+"leave",$e,p,ke),Se.target=gr,Se.relatedTarget=pe,Me=null,ho(ke)===ge&&(Ye=new Ye(he,oe+"enter",We,p,ke),Ye.target=pe,Ye.relatedTarget=gr,Me=Ye),gr=Me,$e&&We)t:{for(Ye=$e,he=We,oe=0,pe=Ye;pe;pe=sa(pe))oe++;for(pe=0,Me=he;Me;Me=sa(Me))pe++;for(;0<oe-pe;)Ye=sa(Ye),oe--;for(;0<pe-oe;)he=sa(he),pe--;for(;oe--;){if(Ye===he||he!==null&&Ye===he.alternate)break t;Ye=sa(Ye),he=sa(he)}Ye=null}else Ye=null;$e!==null&&C0(Ne,Se,$e,Ye,!1),We!==null&&gr!==null&&C0(Ne,gr,We,Ye,!0)}}e:{if(Se=ge?ia(ge):window,$e=Se.nodeName&&Se.nodeName.toLowerCase(),$e==="select"||$e==="input"&&Se.type==="file")var Xe=Z2;else if(r0(Se))if(n0)Xe=sE;else{Xe=tE;var rt=eE}else($e=Se.nodeName)&&$e.toLowerCase()==="input"&&(Se.type==="checkbox"||Se.type==="radio")&&(Xe=rE);if(Xe&&(Xe=Xe(i,ge))){s0(Ne,Xe,p,ke);break e}rt&&rt(i,Se,ge),i==="focusout"&&(rt=Se._wrapperState)&&rt.controlled&&Se.type==="number"&&Ke(Se,"number",Se.value)}switch(rt=ge?ia(ge):window,i){case"focusin":(r0(rt)||rt.contentEditable==="true")&&(ta=rt,Bh=ge,bl=null);break;case"focusout":bl=Bh=ta=null;break;case"mousedown":$h=!0;break;case"contextmenu":case"mouseup":case"dragend":$h=!1,h0(Ne,p,ke);break;case"selectionchange":if(oE)break;case"keydown":case"keyup":h0(Ne,p,ke)}var st;if(Ih)e:{switch(i){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else ea?e0(i,p)&&(ct="onCompositionEnd"):i==="keydown"&&p.keyCode===229&&(ct="onCompositionStart");ct&&(Xx&&p.locale!=="ko"&&(ea||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&ea&&(st=Gx()):(ki=ke,Ph="value"in ki?ki.value:ki.textContent,ea=!0)),rt=td(ge,ct),0<rt.length&&(ct=new Yx(ct,i,null,p,ke),Ne.push({event:ct,listeners:rt}),st?ct.data=st:(st=t0(p),st!==null&&(ct.data=st)))),(st=K2?Y2(i,p):J2(i,p))&&(ge=td(ge,"onBeforeInput"),0<ge.length&&(ke=new Yx("onBeforeInput","beforeinput",null,p,ke),Ne.push({event:ke,listeners:ge}),ke.data=st))}w0(Ne,a)})}function Cl(i,a,p){return{instance:i,listener:a,currentTarget:p}}function td(i,a){for(var p=a+"Capture",S=[];i!==null;){var T=i,D=T.stateNode;T.tag===5&&D!==null&&(T=D,D=Ut(i,p),D!=null&&S.unshift(Cl(i,D,T)),D=Ut(i,a),D!=null&&S.push(Cl(i,D,T))),i=i.return}return S}function sa(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function C0(i,a,p,S,T){for(var D=a._reactName,V=[];p!==null&&p!==S;){var ee=p,ie=ee.alternate,ge=ee.stateNode;if(ie!==null&&ie===S)break;ee.tag===5&&ge!==null&&(ee=ge,T?(ie=Ut(p,D),ie!=null&&V.unshift(Cl(p,ie,ee))):T||(ie=Ut(p,D),ie!=null&&V.push(Cl(p,ie,ee)))),p=p.return}V.length!==0&&i.push({event:a,listeners:V})}var dE=/\r\n?/g,uE=/\u0000|\uFFFD/g;function S0(i){return(typeof i=="string"?i:""+i).replace(dE,`
38
+ `).replace(uE,"")}function rd(i,a,p){if(a=S0(a),S0(i)!==a&&p)throw Error(s(425))}function sd(){}var Gh=null,qh=null;function Kh(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Yh=typeof setTimeout=="function"?setTimeout:void 0,hE=typeof clearTimeout=="function"?clearTimeout:void 0,k0=typeof Promise=="function"?Promise:void 0,fE=typeof queueMicrotask=="function"?queueMicrotask:typeof k0<"u"?function(i){return k0.resolve(null).then(i).catch(mE)}:Yh;function mE(i){setTimeout(function(){throw i})}function Jh(i,a){var p=a,S=0;do{var T=p.nextSibling;if(i.removeChild(p),T&&T.nodeType===8)if(p=T.data,p==="/$"){if(S===0){i.removeChild(T),Si(a);return}S--}else p!=="$"&&p!=="$?"&&p!=="$!"||S++;p=T}while(p);Si(a)}function Ni(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return i}function j0(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var p=i.data;if(p==="$"||p==="$!"||p==="$?"){if(a===0)return i;a--}else p==="/$"&&a++}i=i.previousSibling}return null}var na=Math.random().toString(36).slice(2),Mn="__reactFiber$"+na,Sl="__reactProps$"+na,ri="__reactContainer$"+na,Xh="__reactEvents$"+na,pE="__reactListeners$"+na,gE="__reactHandles$"+na;function ho(i){var a=i[Mn];if(a)return a;for(var p=i.parentNode;p;){if(a=p[ri]||p[Mn]){if(p=a.alternate,a.child!==null||p!==null&&p.child!==null)for(i=j0(i);i!==null;){if(p=i[Mn])return p;i=j0(i)}return a}i=p,p=i.parentNode}return null}function kl(i){return i=i[Mn]||i[ri],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function ia(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(s(33))}function nd(i){return i[Sl]||null}var Qh=[],oa=-1;function Ei(i){return{current:i}}function Zt(i){0>oa||(i.current=Qh[oa],Qh[oa]=null,oa--)}function Gt(i,a){oa++,Qh[oa]=i.current,i.current=a}var Pi={},ss=Ei(Pi),Cs=Ei(!1),fo=Pi;function aa(i,a){var p=i.type.contextTypes;if(!p)return Pi;var S=i.stateNode;if(S&&S.__reactInternalMemoizedUnmaskedChildContext===a)return S.__reactInternalMemoizedMaskedChildContext;var T={},D;for(D in p)T[D]=a[D];return S&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=a,i.__reactInternalMemoizedMaskedChildContext=T),T}function Ss(i){return i=i.childContextTypes,i!=null}function id(){Zt(Cs),Zt(ss)}function N0(i,a,p){if(ss.current!==Pi)throw Error(s(168));Gt(ss,a),Gt(Cs,p)}function E0(i,a,p){var S=i.stateNode;if(a=a.childContextTypes,typeof S.getChildContext!="function")return p;S=S.getChildContext();for(var T in S)if(!(T in a))throw Error(s(108,J(i)||"Unknown",T));return R({},p,S)}function od(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Pi,fo=ss.current,Gt(ss,i),Gt(Cs,Cs.current),!0}function P0(i,a,p){var S=i.stateNode;if(!S)throw Error(s(169));p?(i=E0(i,a,fo),S.__reactInternalMemoizedMergedChildContext=i,Zt(Cs),Zt(ss),Gt(ss,i)):Zt(Cs),Gt(Cs,p)}var si=null,ad=!1,Zh=!1;function A0(i){si===null?si=[i]:si.push(i)}function xE(i){ad=!0,A0(i)}function Ai(){if(!Zh&&si!==null){Zh=!0;var i=0,a=Pt;try{var p=si;for(Pt=1;i<p.length;i++){var S=p[i];do S=S(!0);while(S!==null)}si=null,ad=!1}catch(T){throw si!==null&&(si=si.slice(i+1)),Uo(Js,Ai),T}finally{Pt=a,Zh=!1}}return null}var la=[],ca=0,ld=null,cd=0,Qs=[],Zs=0,mo=null,ni=1,ii="";function po(i,a){la[ca++]=cd,la[ca++]=ld,ld=i,cd=a}function T0(i,a,p){Qs[Zs++]=ni,Qs[Zs++]=ii,Qs[Zs++]=mo,mo=i;var S=ni;i=ii;var T=32-Mr(S)-1;S&=~(1<<T),p+=1;var D=32-Mr(a)+T;if(30<D){var V=T-T%5;D=(S&(1<<V)-1).toString(32),S>>=V,T-=V,ni=1<<32-Mr(a)+T|p<<T|S,ii=D+i}else ni=1<<D|p<<T|S,ii=i}function ef(i){i.return!==null&&(po(i,1),T0(i,1,0))}function tf(i){for(;i===ld;)ld=la[--ca],la[ca]=null,cd=la[--ca],la[ca]=null;for(;i===mo;)mo=Qs[--Zs],Qs[Zs]=null,ii=Qs[--Zs],Qs[Zs]=null,ni=Qs[--Zs],Qs[Zs]=null}var Bs=null,$s=null,nr=!1,yn=null;function R0(i,a){var p=sn(5,null,null,0);p.elementType="DELETED",p.stateNode=a,p.return=i,a=i.deletions,a===null?(i.deletions=[p],i.flags|=16):a.push(p)}function M0(i,a){switch(i.tag){case 5:var p=i.type;return a=a.nodeType!==1||p.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(i.stateNode=a,Bs=i,$s=Ni(a.firstChild),!0):!1;case 6:return a=i.pendingProps===""||a.nodeType!==3?null:a,a!==null?(i.stateNode=a,Bs=i,$s=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(p=mo!==null?{id:ni,overflow:ii}:null,i.memoizedState={dehydrated:a,treeContext:p,retryLane:1073741824},p=sn(18,null,null,0),p.stateNode=a,p.return=i,i.child=p,Bs=i,$s=null,!0):!1;default:return!1}}function rf(i){return(i.mode&1)!==0&&(i.flags&128)===0}function sf(i){if(nr){var a=$s;if(a){var p=a;if(!M0(i,a)){if(rf(i))throw Error(s(418));a=Ni(p.nextSibling);var S=Bs;a&&M0(i,a)?R0(S,p):(i.flags=i.flags&-4097|2,nr=!1,Bs=i)}}else{if(rf(i))throw Error(s(418));i.flags=i.flags&-4097|2,nr=!1,Bs=i}}}function D0(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Bs=i}function dd(i){if(i!==Bs)return!1;if(!nr)return D0(i),nr=!0,!1;var a;if((a=i.tag!==3)&&!(a=i.tag!==5)&&(a=i.type,a=a!=="head"&&a!=="body"&&!Kh(i.type,i.memoizedProps)),a&&(a=$s)){if(rf(i))throw I0(),Error(s(418));for(;a;)R0(i,a),a=Ni(a.nextSibling)}if(D0(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));e:{for(i=i.nextSibling,a=0;i;){if(i.nodeType===8){var p=i.data;if(p==="/$"){if(a===0){$s=Ni(i.nextSibling);break e}a--}else p!=="$"&&p!=="$!"&&p!=="$?"||a++}i=i.nextSibling}$s=null}}else $s=Bs?Ni(i.stateNode.nextSibling):null;return!0}function I0(){for(var i=$s;i;)i=Ni(i.nextSibling)}function da(){$s=Bs=null,nr=!1}function nf(i){yn===null?yn=[i]:yn.push(i)}var vE=k.ReactCurrentBatchConfig;function jl(i,a,p){if(i=p.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(s(309));var S=p.stateNode}if(!S)throw Error(s(147,i));var T=S,D=""+i;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===D?a.ref:(a=function(V){var ee=T.refs;V===null?delete ee[D]:ee[D]=V},a._stringRef=D,a)}if(typeof i!="string")throw Error(s(284));if(!p._owner)throw Error(s(290,i))}return i}function ud(i,a){throw i=Object.prototype.toString.call(a),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i))}function L0(i){var a=i._init;return a(i._payload)}function O0(i){function a(he,oe){if(i){var pe=he.deletions;pe===null?(he.deletions=[oe],he.flags|=16):pe.push(oe)}}function p(he,oe){if(!i)return null;for(;oe!==null;)a(he,oe),oe=oe.sibling;return null}function S(he,oe){for(he=new Map;oe!==null;)oe.key!==null?he.set(oe.key,oe):he.set(oe.index,oe),oe=oe.sibling;return he}function T(he,oe){return he=Fi(he,oe),he.index=0,he.sibling=null,he}function D(he,oe,pe){return he.index=pe,i?(pe=he.alternate,pe!==null?(pe=pe.index,pe<oe?(he.flags|=2,oe):pe):(he.flags|=2,oe)):(he.flags|=1048576,oe)}function V(he){return i&&he.alternate===null&&(he.flags|=2),he}function ee(he,oe,pe,Me){return oe===null||oe.tag!==6?(oe=Jf(pe,he.mode,Me),oe.return=he,oe):(oe=T(oe,pe),oe.return=he,oe)}function ie(he,oe,pe,Me){var Xe=pe.type;return Xe===A?ke(he,oe,pe.props.children,Me,pe.key):oe!==null&&(oe.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===U&&L0(Xe)===oe.type)?(Me=T(oe,pe.props),Me.ref=jl(he,oe,pe),Me.return=he,Me):(Me=Id(pe.type,pe.key,pe.props,null,he.mode,Me),Me.ref=jl(he,oe,pe),Me.return=he,Me)}function ge(he,oe,pe,Me){return oe===null||oe.tag!==4||oe.stateNode.containerInfo!==pe.containerInfo||oe.stateNode.implementation!==pe.implementation?(oe=Xf(pe,he.mode,Me),oe.return=he,oe):(oe=T(oe,pe.children||[]),oe.return=he,oe)}function ke(he,oe,pe,Me,Xe){return oe===null||oe.tag!==7?(oe=Co(pe,he.mode,Me,Xe),oe.return=he,oe):(oe=T(oe,pe),oe.return=he,oe)}function Ne(he,oe,pe){if(typeof oe=="string"&&oe!==""||typeof oe=="number")return oe=Jf(""+oe,he.mode,pe),oe.return=he,oe;if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case E:return pe=Id(oe.type,oe.key,oe.props,null,he.mode,pe),pe.ref=jl(he,null,oe),pe.return=he,pe;case P:return oe=Xf(oe,he.mode,pe),oe.return=he,oe;case U:var Me=oe._init;return Ne(he,Me(oe._payload),pe)}if(Qe(oe)||O(oe))return oe=Co(oe,he.mode,pe,null),oe.return=he,oe;ud(he,oe)}return null}function Se(he,oe,pe,Me){var Xe=oe!==null?oe.key:null;if(typeof pe=="string"&&pe!==""||typeof pe=="number")return Xe!==null?null:ee(he,oe,""+pe,Me);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case E:return pe.key===Xe?ie(he,oe,pe,Me):null;case P:return pe.key===Xe?ge(he,oe,pe,Me):null;case U:return Xe=pe._init,Se(he,oe,Xe(pe._payload),Me)}if(Qe(pe)||O(pe))return Xe!==null?null:ke(he,oe,pe,Me,null);ud(he,pe)}return null}function $e(he,oe,pe,Me,Xe){if(typeof Me=="string"&&Me!==""||typeof Me=="number")return he=he.get(pe)||null,ee(oe,he,""+Me,Xe);if(typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case E:return he=he.get(Me.key===null?pe:Me.key)||null,ie(oe,he,Me,Xe);case P:return he=he.get(Me.key===null?pe:Me.key)||null,ge(oe,he,Me,Xe);case U:var rt=Me._init;return $e(he,oe,pe,rt(Me._payload),Xe)}if(Qe(Me)||O(Me))return he=he.get(pe)||null,ke(oe,he,Me,Xe,null);ud(oe,Me)}return null}function We(he,oe,pe,Me){for(var Xe=null,rt=null,st=oe,ct=oe=0,Fr=null;st!==null&&ct<pe.length;ct++){st.index>ct?(Fr=st,st=null):Fr=st.sibling;var Mt=Se(he,st,pe[ct],Me);if(Mt===null){st===null&&(st=Fr);break}i&&st&&Mt.alternate===null&&a(he,st),oe=D(Mt,oe,ct),rt===null?Xe=Mt:rt.sibling=Mt,rt=Mt,st=Fr}if(ct===pe.length)return p(he,st),nr&&po(he,ct),Xe;if(st===null){for(;ct<pe.length;ct++)st=Ne(he,pe[ct],Me),st!==null&&(oe=D(st,oe,ct),rt===null?Xe=st:rt.sibling=st,rt=st);return nr&&po(he,ct),Xe}for(st=S(he,st);ct<pe.length;ct++)Fr=$e(st,he,ct,pe[ct],Me),Fr!==null&&(i&&Fr.alternate!==null&&st.delete(Fr.key===null?ct:Fr.key),oe=D(Fr,oe,ct),rt===null?Xe=Fr:rt.sibling=Fr,rt=Fr);return i&&st.forEach(function(Bi){return a(he,Bi)}),nr&&po(he,ct),Xe}function Ye(he,oe,pe,Me){var Xe=O(pe);if(typeof Xe!="function")throw Error(s(150));if(pe=Xe.call(pe),pe==null)throw Error(s(151));for(var rt=Xe=null,st=oe,ct=oe=0,Fr=null,Mt=pe.next();st!==null&&!Mt.done;ct++,Mt=pe.next()){st.index>ct?(Fr=st,st=null):Fr=st.sibling;var Bi=Se(he,st,Mt.value,Me);if(Bi===null){st===null&&(st=Fr);break}i&&st&&Bi.alternate===null&&a(he,st),oe=D(Bi,oe,ct),rt===null?Xe=Bi:rt.sibling=Bi,rt=Bi,st=Fr}if(Mt.done)return p(he,st),nr&&po(he,ct),Xe;if(st===null){for(;!Mt.done;ct++,Mt=pe.next())Mt=Ne(he,Mt.value,Me),Mt!==null&&(oe=D(Mt,oe,ct),rt===null?Xe=Mt:rt.sibling=Mt,rt=Mt);return nr&&po(he,ct),Xe}for(st=S(he,st);!Mt.done;ct++,Mt=pe.next())Mt=$e(st,he,ct,Mt.value,Me),Mt!==null&&(i&&Mt.alternate!==null&&st.delete(Mt.key===null?ct:Mt.key),oe=D(Mt,oe,ct),rt===null?Xe=Mt:rt.sibling=Mt,rt=Mt);return i&&st.forEach(function(XE){return a(he,XE)}),nr&&po(he,ct),Xe}function gr(he,oe,pe,Me){if(typeof pe=="object"&&pe!==null&&pe.type===A&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case E:e:{for(var Xe=pe.key,rt=oe;rt!==null;){if(rt.key===Xe){if(Xe=pe.type,Xe===A){if(rt.tag===7){p(he,rt.sibling),oe=T(rt,pe.props.children),oe.return=he,he=oe;break e}}else if(rt.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===U&&L0(Xe)===rt.type){p(he,rt.sibling),oe=T(rt,pe.props),oe.ref=jl(he,rt,pe),oe.return=he,he=oe;break e}p(he,rt);break}else a(he,rt);rt=rt.sibling}pe.type===A?(oe=Co(pe.props.children,he.mode,Me,pe.key),oe.return=he,he=oe):(Me=Id(pe.type,pe.key,pe.props,null,he.mode,Me),Me.ref=jl(he,oe,pe),Me.return=he,he=Me)}return V(he);case P:e:{for(rt=pe.key;oe!==null;){if(oe.key===rt)if(oe.tag===4&&oe.stateNode.containerInfo===pe.containerInfo&&oe.stateNode.implementation===pe.implementation){p(he,oe.sibling),oe=T(oe,pe.children||[]),oe.return=he,he=oe;break e}else{p(he,oe);break}else a(he,oe);oe=oe.sibling}oe=Xf(pe,he.mode,Me),oe.return=he,he=oe}return V(he);case U:return rt=pe._init,gr(he,oe,rt(pe._payload),Me)}if(Qe(pe))return We(he,oe,pe,Me);if(O(pe))return Ye(he,oe,pe,Me);ud(he,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"?(pe=""+pe,oe!==null&&oe.tag===6?(p(he,oe.sibling),oe=T(oe,pe),oe.return=he,he=oe):(p(he,oe),oe=Jf(pe,he.mode,Me),oe.return=he,he=oe),V(he)):p(he,oe)}return gr}var ua=O0(!0),F0=O0(!1),hd=Ei(null),fd=null,ha=null,of=null;function af(){of=ha=fd=null}function lf(i){var a=hd.current;Zt(hd),i._currentValue=a}function cf(i,a,p){for(;i!==null;){var S=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,S!==null&&(S.childLanes|=a)):S!==null&&(S.childLanes&a)!==a&&(S.childLanes|=a),i===p)break;i=i.return}}function fa(i,a){fd=i,of=ha=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&a)!==0&&(ks=!0),i.firstContext=null)}function en(i){var a=i._currentValue;if(of!==i)if(i={context:i,memoizedValue:a,next:null},ha===null){if(fd===null)throw Error(s(308));ha=i,fd.dependencies={lanes:0,firstContext:i}}else ha=ha.next=i;return a}var go=null;function df(i){go===null?go=[i]:go.push(i)}function B0(i,a,p,S){var T=a.interleaved;return T===null?(p.next=p,df(a)):(p.next=T.next,T.next=p),a.interleaved=p,oi(i,S)}function oi(i,a){i.lanes|=a;var p=i.alternate;for(p!==null&&(p.lanes|=a),p=i,i=i.return;i!==null;)i.childLanes|=a,p=i.alternate,p!==null&&(p.childLanes|=a),p=i,i=i.return;return p.tag===3?p.stateNode:null}var Ti=!1;function uf(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $0(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function ai(i,a){return{eventTime:i,lane:a,tag:0,payload:null,callback:null,next:null}}function Ri(i,a,p){var S=i.updateQueue;if(S===null)return null;if(S=S.shared,(At&2)!==0){var T=S.pending;return T===null?a.next=a:(a.next=T.next,T.next=a),S.pending=a,oi(i,p)}return T=S.interleaved,T===null?(a.next=a,df(S)):(a.next=T.next,T.next=a),S.interleaved=a,oi(i,p)}function md(i,a,p){if(a=a.updateQueue,a!==null&&(a=a.shared,(p&4194240)!==0)){var S=a.lanes;S&=i.pendingLanes,p|=S,a.lanes=p,Yo(i,p)}}function z0(i,a){var p=i.updateQueue,S=i.alternate;if(S!==null&&(S=S.updateQueue,p===S)){var T=null,D=null;if(p=p.firstBaseUpdate,p!==null){do{var V={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};D===null?T=D=V:D=D.next=V,p=p.next}while(p!==null);D===null?T=D=a:D=D.next=a}else T=D=a;p={baseState:S.baseState,firstBaseUpdate:T,lastBaseUpdate:D,shared:S.shared,effects:S.effects},i.updateQueue=p;return}i=p.lastBaseUpdate,i===null?p.firstBaseUpdate=a:i.next=a,p.lastBaseUpdate=a}function pd(i,a,p,S){var T=i.updateQueue;Ti=!1;var D=T.firstBaseUpdate,V=T.lastBaseUpdate,ee=T.shared.pending;if(ee!==null){T.shared.pending=null;var ie=ee,ge=ie.next;ie.next=null,V===null?D=ge:V.next=ge,V=ie;var ke=i.alternate;ke!==null&&(ke=ke.updateQueue,ee=ke.lastBaseUpdate,ee!==V&&(ee===null?ke.firstBaseUpdate=ge:ee.next=ge,ke.lastBaseUpdate=ie))}if(D!==null){var Ne=T.baseState;V=0,ke=ge=ie=null,ee=D;do{var Se=ee.lane,$e=ee.eventTime;if((S&Se)===Se){ke!==null&&(ke=ke.next={eventTime:$e,lane:0,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null});e:{var We=i,Ye=ee;switch(Se=a,$e=p,Ye.tag){case 1:if(We=Ye.payload,typeof We=="function"){Ne=We.call($e,Ne,Se);break e}Ne=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=Ye.payload,Se=typeof We=="function"?We.call($e,Ne,Se):We,Se==null)break e;Ne=R({},Ne,Se);break e;case 2:Ti=!0}}ee.callback!==null&&ee.lane!==0&&(i.flags|=64,Se=T.effects,Se===null?T.effects=[ee]:Se.push(ee))}else $e={eventTime:$e,lane:Se,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},ke===null?(ge=ke=$e,ie=Ne):ke=ke.next=$e,V|=Se;if(ee=ee.next,ee===null){if(ee=T.shared.pending,ee===null)break;Se=ee,ee=Se.next,Se.next=null,T.lastBaseUpdate=Se,T.shared.pending=null}}while(!0);if(ke===null&&(ie=Ne),T.baseState=ie,T.firstBaseUpdate=ge,T.lastBaseUpdate=ke,a=T.shared.interleaved,a!==null){T=a;do V|=T.lane,T=T.next;while(T!==a)}else D===null&&(T.shared.lanes=0);yo|=V,i.lanes=V,i.memoizedState=Ne}}function H0(i,a,p){if(i=a.effects,a.effects=null,i!==null)for(a=0;a<i.length;a++){var S=i[a],T=S.callback;if(T!==null){if(S.callback=null,S=p,typeof T!="function")throw Error(s(191,T));T.call(S)}}}var Nl={},Dn=Ei(Nl),El=Ei(Nl),Pl=Ei(Nl);function xo(i){if(i===Nl)throw Error(s(174));return i}function hf(i,a){switch(Gt(Pl,a),Gt(El,i),Gt(Dn,Nl),i=a.nodeType,i){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:ye(null,"");break;default:i=i===8?a.parentNode:a,a=i.namespaceURI||null,i=i.tagName,a=ye(a,i)}Zt(Dn),Gt(Dn,a)}function ma(){Zt(Dn),Zt(El),Zt(Pl)}function W0(i){xo(Pl.current);var a=xo(Dn.current),p=ye(a,i.type);a!==p&&(Gt(El,i),Gt(Dn,p))}function ff(i){El.current===i&&(Zt(Dn),Zt(El))}var lr=Ei(0);function gd(i){for(var a=i;a!==null;){if(a.tag===13){var p=a.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||p.data==="$?"||p.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var mf=[];function pf(){for(var i=0;i<mf.length;i++)mf[i]._workInProgressVersionPrimary=null;mf.length=0}var xd=k.ReactCurrentDispatcher,gf=k.ReactCurrentBatchConfig,vo=0,cr=null,jr=null,Lr=null,vd=!1,Al=!1,Tl=0,yE=0;function ns(){throw Error(s(321))}function xf(i,a){if(a===null)return!1;for(var p=0;p<a.length&&p<i.length;p++)if(!vn(i[p],a[p]))return!1;return!0}function vf(i,a,p,S,T,D){if(vo=D,cr=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,xd.current=i===null||i.memoizedState===null?CE:SE,i=p(S,T),Al){D=0;do{if(Al=!1,Tl=0,25<=D)throw Error(s(301));D+=1,Lr=jr=null,a.updateQueue=null,xd.current=kE,i=p(S,T)}while(Al)}if(xd.current=wd,a=jr!==null&&jr.next!==null,vo=0,Lr=jr=cr=null,vd=!1,a)throw Error(s(300));return i}function yf(){var i=Tl!==0;return Tl=0,i}function In(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lr===null?cr.memoizedState=Lr=i:Lr=Lr.next=i,Lr}function tn(){if(jr===null){var i=cr.alternate;i=i!==null?i.memoizedState:null}else i=jr.next;var a=Lr===null?cr.memoizedState:Lr.next;if(a!==null)Lr=a,jr=i;else{if(i===null)throw Error(s(310));jr=i,i={memoizedState:jr.memoizedState,baseState:jr.baseState,baseQueue:jr.baseQueue,queue:jr.queue,next:null},Lr===null?cr.memoizedState=Lr=i:Lr=Lr.next=i}return Lr}function Rl(i,a){return typeof a=="function"?a(i):a}function bf(i){var a=tn(),p=a.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=i;var S=jr,T=S.baseQueue,D=p.pending;if(D!==null){if(T!==null){var V=T.next;T.next=D.next,D.next=V}S.baseQueue=T=D,p.pending=null}if(T!==null){D=T.next,S=S.baseState;var ee=V=null,ie=null,ge=D;do{var ke=ge.lane;if((vo&ke)===ke)ie!==null&&(ie=ie.next={lane:0,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),S=ge.hasEagerState?ge.eagerState:i(S,ge.action);else{var Ne={lane:ke,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null};ie===null?(ee=ie=Ne,V=S):ie=ie.next=Ne,cr.lanes|=ke,yo|=ke}ge=ge.next}while(ge!==null&&ge!==D);ie===null?V=S:ie.next=ee,vn(S,a.memoizedState)||(ks=!0),a.memoizedState=S,a.baseState=V,a.baseQueue=ie,p.lastRenderedState=S}if(i=p.interleaved,i!==null){T=i;do D=T.lane,cr.lanes|=D,yo|=D,T=T.next;while(T!==i)}else T===null&&(p.lanes=0);return[a.memoizedState,p.dispatch]}function wf(i){var a=tn(),p=a.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=i;var S=p.dispatch,T=p.pending,D=a.memoizedState;if(T!==null){p.pending=null;var V=T=T.next;do D=i(D,V.action),V=V.next;while(V!==T);vn(D,a.memoizedState)||(ks=!0),a.memoizedState=D,a.baseQueue===null&&(a.baseState=D),p.lastRenderedState=D}return[D,S]}function V0(){}function U0(i,a){var p=cr,S=tn(),T=a(),D=!vn(S.memoizedState,T);if(D&&(S.memoizedState=T,ks=!0),S=S.queue,_f(K0.bind(null,p,S,i),[i]),S.getSnapshot!==a||D||Lr!==null&&Lr.memoizedState.tag&1){if(p.flags|=2048,Ml(9,q0.bind(null,p,S,T,a),void 0,null),Or===null)throw Error(s(349));(vo&30)!==0||G0(p,a,T)}return T}function G0(i,a,p){i.flags|=16384,i={getSnapshot:a,value:p},a=cr.updateQueue,a===null?(a={lastEffect:null,stores:null},cr.updateQueue=a,a.stores=[i]):(p=a.stores,p===null?a.stores=[i]:p.push(i))}function q0(i,a,p,S){a.value=p,a.getSnapshot=S,Y0(a)&&J0(i)}function K0(i,a,p){return p(function(){Y0(a)&&J0(i)})}function Y0(i){var a=i.getSnapshot;i=i.value;try{var p=a();return!vn(i,p)}catch{return!0}}function J0(i){var a=oi(i,1);a!==null&&Cn(a,i,1,-1)}function X0(i){var a=In();return typeof i=="function"&&(i=i()),a.memoizedState=a.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Rl,lastRenderedState:i},a.queue=i,i=i.dispatch=_E.bind(null,cr,i),[a.memoizedState,i]}function Ml(i,a,p,S){return i={tag:i,create:a,destroy:p,deps:S,next:null},a=cr.updateQueue,a===null?(a={lastEffect:null,stores:null},cr.updateQueue=a,a.lastEffect=i.next=i):(p=a.lastEffect,p===null?a.lastEffect=i.next=i:(S=p.next,p.next=i,i.next=S,a.lastEffect=i)),i}function Q0(){return tn().memoizedState}function yd(i,a,p,S){var T=In();cr.flags|=i,T.memoizedState=Ml(1|a,p,void 0,S===void 0?null:S)}function bd(i,a,p,S){var T=tn();S=S===void 0?null:S;var D=void 0;if(jr!==null){var V=jr.memoizedState;if(D=V.destroy,S!==null&&xf(S,V.deps)){T.memoizedState=Ml(a,p,D,S);return}}cr.flags|=i,T.memoizedState=Ml(1|a,p,D,S)}function Z0(i,a){return yd(8390656,8,i,a)}function _f(i,a){return bd(2048,8,i,a)}function ev(i,a){return bd(4,2,i,a)}function tv(i,a){return bd(4,4,i,a)}function rv(i,a){if(typeof a=="function")return i=i(),a(i),function(){a(null)};if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function sv(i,a,p){return p=p!=null?p.concat([i]):null,bd(4,4,rv.bind(null,a,i),p)}function Cf(){}function nv(i,a){var p=tn();a=a===void 0?null:a;var S=p.memoizedState;return S!==null&&a!==null&&xf(a,S[1])?S[0]:(p.memoizedState=[i,a],i)}function iv(i,a){var p=tn();a=a===void 0?null:a;var S=p.memoizedState;return S!==null&&a!==null&&xf(a,S[1])?S[0]:(i=i(),p.memoizedState=[i,a],i)}function ov(i,a,p){return(vo&21)===0?(i.baseState&&(i.baseState=!1,ks=!0),i.memoizedState=p):(vn(p,a)||(p=_s(),cr.lanes|=p,yo|=p,i.baseState=!0),a)}function bE(i,a){var p=Pt;Pt=p!==0&&4>p?p:4,i(!0);var S=gf.transition;gf.transition={};try{i(!1),a()}finally{Pt=p,gf.transition=S}}function av(){return tn().memoizedState}function wE(i,a,p){var S=Li(i);if(p={lane:S,action:p,hasEagerState:!1,eagerState:null,next:null},lv(i))cv(a,p);else if(p=B0(i,a,p,S),p!==null){var T=ps();Cn(p,i,S,T),dv(p,a,S)}}function _E(i,a,p){var S=Li(i),T={lane:S,action:p,hasEagerState:!1,eagerState:null,next:null};if(lv(i))cv(a,T);else{var D=i.alternate;if(i.lanes===0&&(D===null||D.lanes===0)&&(D=a.lastRenderedReducer,D!==null))try{var V=a.lastRenderedState,ee=D(V,p);if(T.hasEagerState=!0,T.eagerState=ee,vn(ee,V)){var ie=a.interleaved;ie===null?(T.next=T,df(a)):(T.next=ie.next,ie.next=T),a.interleaved=T;return}}catch{}finally{}p=B0(i,a,T,S),p!==null&&(T=ps(),Cn(p,i,S,T),dv(p,a,S))}}function lv(i){var a=i.alternate;return i===cr||a!==null&&a===cr}function cv(i,a){Al=vd=!0;var p=i.pending;p===null?a.next=a:(a.next=p.next,p.next=a),i.pending=a}function dv(i,a,p){if((p&4194240)!==0){var S=a.lanes;S&=i.pendingLanes,p|=S,a.lanes=p,Yo(i,p)}}var wd={readContext:en,useCallback:ns,useContext:ns,useEffect:ns,useImperativeHandle:ns,useInsertionEffect:ns,useLayoutEffect:ns,useMemo:ns,useReducer:ns,useRef:ns,useState:ns,useDebugValue:ns,useDeferredValue:ns,useTransition:ns,useMutableSource:ns,useSyncExternalStore:ns,useId:ns,unstable_isNewReconciler:!1},CE={readContext:en,useCallback:function(i,a){return In().memoizedState=[i,a===void 0?null:a],i},useContext:en,useEffect:Z0,useImperativeHandle:function(i,a,p){return p=p!=null?p.concat([i]):null,yd(4194308,4,rv.bind(null,a,i),p)},useLayoutEffect:function(i,a){return yd(4194308,4,i,a)},useInsertionEffect:function(i,a){return yd(4,2,i,a)},useMemo:function(i,a){var p=In();return a=a===void 0?null:a,i=i(),p.memoizedState=[i,a],i},useReducer:function(i,a,p){var S=In();return a=p!==void 0?p(a):a,S.memoizedState=S.baseState=a,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:a},S.queue=i,i=i.dispatch=wE.bind(null,cr,i),[S.memoizedState,i]},useRef:function(i){var a=In();return i={current:i},a.memoizedState=i},useState:X0,useDebugValue:Cf,useDeferredValue:function(i){return In().memoizedState=i},useTransition:function(){var i=X0(!1),a=i[0];return i=bE.bind(null,i[1]),In().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,p){var S=cr,T=In();if(nr){if(p===void 0)throw Error(s(407));p=p()}else{if(p=a(),Or===null)throw Error(s(349));(vo&30)!==0||G0(S,a,p)}T.memoizedState=p;var D={value:p,getSnapshot:a};return T.queue=D,Z0(K0.bind(null,S,D,i),[i]),S.flags|=2048,Ml(9,q0.bind(null,S,D,p,a),void 0,null),p},useId:function(){var i=In(),a=Or.identifierPrefix;if(nr){var p=ii,S=ni;p=(S&~(1<<32-Mr(S)-1)).toString(32)+p,a=":"+a+"R"+p,p=Tl++,0<p&&(a+="H"+p.toString(32)),a+=":"}else p=yE++,a=":"+a+"r"+p.toString(32)+":";return i.memoizedState=a},unstable_isNewReconciler:!1},SE={readContext:en,useCallback:nv,useContext:en,useEffect:_f,useImperativeHandle:sv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:iv,useReducer:bf,useRef:Q0,useState:function(){return bf(Rl)},useDebugValue:Cf,useDeferredValue:function(i){var a=tn();return ov(a,jr.memoizedState,i)},useTransition:function(){var i=bf(Rl)[0],a=tn().memoizedState;return[i,a]},useMutableSource:V0,useSyncExternalStore:U0,useId:av,unstable_isNewReconciler:!1},kE={readContext:en,useCallback:nv,useContext:en,useEffect:_f,useImperativeHandle:sv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:iv,useReducer:wf,useRef:Q0,useState:function(){return wf(Rl)},useDebugValue:Cf,useDeferredValue:function(i){var a=tn();return jr===null?a.memoizedState=i:ov(a,jr.memoizedState,i)},useTransition:function(){var i=wf(Rl)[0],a=tn().memoizedState;return[i,a]},useMutableSource:V0,useSyncExternalStore:U0,useId:av,unstable_isNewReconciler:!1};function bn(i,a){if(i&&i.defaultProps){a=R({},a),i=i.defaultProps;for(var p in i)a[p]===void 0&&(a[p]=i[p]);return a}return a}function Sf(i,a,p,S){a=i.memoizedState,p=p(S,a),p=p==null?a:R({},a,p),i.memoizedState=p,i.lanes===0&&(i.updateQueue.baseState=p)}var _d={isMounted:function(i){return(i=i._reactInternals)?mn(i)===i:!1},enqueueSetState:function(i,a,p){i=i._reactInternals;var S=ps(),T=Li(i),D=ai(S,T);D.payload=a,p!=null&&(D.callback=p),a=Ri(i,D,T),a!==null&&(Cn(a,i,T,S),md(a,i,T))},enqueueReplaceState:function(i,a,p){i=i._reactInternals;var S=ps(),T=Li(i),D=ai(S,T);D.tag=1,D.payload=a,p!=null&&(D.callback=p),a=Ri(i,D,T),a!==null&&(Cn(a,i,T,S),md(a,i,T))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var p=ps(),S=Li(i),T=ai(p,S);T.tag=2,a!=null&&(T.callback=a),a=Ri(i,T,S),a!==null&&(Cn(a,i,S,p),md(a,i,S))}};function uv(i,a,p,S,T,D,V){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(S,D,V):a.prototype&&a.prototype.isPureReactComponent?!yl(p,S)||!yl(T,D):!0}function hv(i,a,p){var S=!1,T=Pi,D=a.contextType;return typeof D=="object"&&D!==null?D=en(D):(T=Ss(a)?fo:ss.current,S=a.contextTypes,D=(S=S!=null)?aa(i,T):Pi),a=new a(p,D),i.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=_d,i.stateNode=a,a._reactInternals=i,S&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=T,i.__reactInternalMemoizedMaskedChildContext=D),a}function fv(i,a,p,S){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(p,S),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(p,S),a.state!==i&&_d.enqueueReplaceState(a,a.state,null)}function kf(i,a,p,S){var T=i.stateNode;T.props=p,T.state=i.memoizedState,T.refs={},uf(i);var D=a.contextType;typeof D=="object"&&D!==null?T.context=en(D):(D=Ss(a)?fo:ss.current,T.context=aa(i,D)),T.state=i.memoizedState,D=a.getDerivedStateFromProps,typeof D=="function"&&(Sf(i,a,D,p),T.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof T.getSnapshotBeforeUpdate=="function"||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(a=T.state,typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount(),a!==T.state&&_d.enqueueReplaceState(T,T.state,null),pd(i,p,T,S),T.state=i.memoizedState),typeof T.componentDidMount=="function"&&(i.flags|=4194308)}function pa(i,a){try{var p="",S=a;do p+=ce(S),S=S.return;while(S);var T=p}catch(D){T=`
39
39
  Error generating stack: `+D.message+`
40
- `+D.stack}return{value:i,source:a,stack:T,digest:null}}function jf(i,a,p){return{value:i,source:null,stack:p??null,digest:a??null}}function Nf(i,a){try{console.error(a.value)}catch(p){setTimeout(function(){throw p})}}var jE=typeof WeakMap=="function"?WeakMap:Map;function mv(i,a,p){p=ai(-1,p),p.tag=3,p.payload={element:null};var S=a.value;return p.callback=function(){Pd||(Pd=!0,Hf=S),Nf(i,a)},p}function pv(i,a,p){p=ai(-1,p),p.tag=3;var S=i.type.getDerivedStateFromError;if(typeof S=="function"){var T=a.value;p.payload=function(){return S(T)},p.callback=function(){Nf(i,a)}}var D=i.stateNode;return D!==null&&typeof D.componentDidCatch=="function"&&(p.callback=function(){Nf(i,a),typeof S!="function"&&(Di===null?Di=new Set([this]):Di.add(this));var V=a.stack;this.componentDidCatch(a.value,{componentStack:V!==null?V:""})}),p}function gv(i,a,p){var S=i.pingCache;if(S===null){S=i.pingCache=new jE;var T=new Set;S.set(a,T)}else T=S.get(a),T===void 0&&(T=new Set,S.set(a,T));T.has(p)||(T.add(p),i=$E.bind(null,i,a,p),a.then(i,i))}function xv(i){do{var a;if((a=i.tag===13)&&(a=i.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return i;i=i.return}while(i!==null);return null}function vv(i,a,p,S,T){return(i.mode&1)===0?(i===a?i.flags|=65536:(i.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(a=ai(-1,1),a.tag=2,Ri(p,a,1))),p.lanes|=1),i):(i.flags|=65536,i.lanes=T,i)}var NE=k.ReactCurrentOwner,ks=!1;function ms(i,a,p,S){a.child=i===null?F0(a,null,p,S):ua(a,i.child,p,S)}function yv(i,a,p,S,T){p=p.render;var D=a.ref;return fa(a,T),S=vf(i,a,p,S,D,T),p=yf(),i!==null&&!ks?(a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~T,li(i,a,T)):(nr&&p&&ef(a),a.flags|=1,ms(i,a,S,T),a.child)}function bv(i,a,p,S,T){if(i===null){var D=p.type;return typeof D=="function"&&!Yf(D)&&D.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(a.tag=15,a.type=D,wv(i,a,D,S,T)):(i=Id(p.type,null,S,a,a.mode,T),i.ref=a.ref,i.return=a,a.child=i)}if(D=i.child,(i.lanes&T)===0){var V=D.memoizedProps;if(p=p.compare,p=p!==null?p:yl,p(V,S)&&i.ref===a.ref)return li(i,a,T)}return a.flags|=1,i=Fi(D,S),i.ref=a.ref,i.return=a,a.child=i}function wv(i,a,p,S,T){if(i!==null){var D=i.memoizedProps;if(yl(D,S)&&i.ref===a.ref)if(ks=!1,a.pendingProps=S=D,(i.lanes&T)!==0)(i.flags&131072)!==0&&(ks=!0);else return a.lanes=i.lanes,li(i,a,T)}return Ef(i,a,p,S,T)}function _v(i,a,p){var S=a.pendingProps,T=S.children,D=i!==null?i.memoizedState:null;if(S.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},Gt(xa,zs),zs|=p;else{if((p&1073741824)===0)return i=D!==null?D.baseLanes|p:p,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:i,cachePool:null,transitions:null},a.updateQueue=null,Gt(xa,zs),zs|=i,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},S=D!==null?D.baseLanes:p,Gt(xa,zs),zs|=S}else D!==null?(S=D.baseLanes|p,a.memoizedState=null):S=p,Gt(xa,zs),zs|=S;return ms(i,a,T,p),a.child}function Cv(i,a){var p=a.ref;(i===null&&p!==null||i!==null&&i.ref!==p)&&(a.flags|=512,a.flags|=2097152)}function Ef(i,a,p,S,T){var D=Ss(p)?fo:ss.current;return D=aa(a,D),fa(a,T),p=vf(i,a,p,S,D,T),S=yf(),i!==null&&!ks?(a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~T,li(i,a,T)):(nr&&S&&ef(a),a.flags|=1,ms(i,a,p,T),a.child)}function Sv(i,a,p,S,T){if(Ss(p)){var D=!0;od(a)}else D=!1;if(fa(a,T),a.stateNode===null)Sd(i,a),hv(a,p,S),kf(a,p,S,T),S=!0;else if(i===null){var V=a.stateNode,ee=a.memoizedProps;V.props=ee;var ie=V.context,ge=p.contextType;typeof ge=="object"&&ge!==null?ge=en(ge):(ge=Ss(p)?fo:ss.current,ge=aa(a,ge));var ke=p.getDerivedStateFromProps,Ne=typeof ke=="function"||typeof V.getSnapshotBeforeUpdate=="function";Ne||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(ee!==S||ie!==ge)&&fv(a,V,S,ge),Ti=!1;var Se=a.memoizedState;V.state=Se,pd(a,S,V,T),ie=a.memoizedState,ee!==S||Se!==ie||Cs.current||Ti?(typeof ke=="function"&&(Sf(a,p,ke,S),ie=a.memoizedState),(ee=Ti||uv(a,p,ee,S,Se,ie,ge))?(Ne||typeof V.UNSAFE_componentWillMount!="function"&&typeof V.componentWillMount!="function"||(typeof V.componentWillMount=="function"&&V.componentWillMount(),typeof V.UNSAFE_componentWillMount=="function"&&V.UNSAFE_componentWillMount()),typeof V.componentDidMount=="function"&&(a.flags|=4194308)):(typeof V.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=S,a.memoizedState=ie),V.props=S,V.state=ie,V.context=ge,S=ee):(typeof V.componentDidMount=="function"&&(a.flags|=4194308),S=!1)}else{V=a.stateNode,$0(i,a),ee=a.memoizedProps,ge=a.type===a.elementType?ee:bn(a.type,ee),V.props=ge,Ne=a.pendingProps,Se=V.context,ie=p.contextType,typeof ie=="object"&&ie!==null?ie=en(ie):(ie=Ss(p)?fo:ss.current,ie=aa(a,ie));var $e=p.getDerivedStateFromProps;(ke=typeof $e=="function"||typeof V.getSnapshotBeforeUpdate=="function")||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(ee!==Ne||Se!==ie)&&fv(a,V,S,ie),Ti=!1,Se=a.memoizedState,V.state=Se,pd(a,S,V,T);var We=a.memoizedState;ee!==Ne||Se!==We||Cs.current||Ti?(typeof $e=="function"&&(Sf(a,p,$e,S),We=a.memoizedState),(ge=Ti||uv(a,p,ge,S,Se,We,ie)||!1)?(ke||typeof V.UNSAFE_componentWillUpdate!="function"&&typeof V.componentWillUpdate!="function"||(typeof V.componentWillUpdate=="function"&&V.componentWillUpdate(S,We,ie),typeof V.UNSAFE_componentWillUpdate=="function"&&V.UNSAFE_componentWillUpdate(S,We,ie)),typeof V.componentDidUpdate=="function"&&(a.flags|=4),typeof V.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof V.componentDidUpdate!="function"||ee===i.memoizedProps&&Se===i.memoizedState||(a.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||ee===i.memoizedProps&&Se===i.memoizedState||(a.flags|=1024),a.memoizedProps=S,a.memoizedState=We),V.props=S,V.state=We,V.context=ie,S=ge):(typeof V.componentDidUpdate!="function"||ee===i.memoizedProps&&Se===i.memoizedState||(a.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||ee===i.memoizedProps&&Se===i.memoizedState||(a.flags|=1024),S=!1)}return Pf(i,a,p,S,D,T)}function Pf(i,a,p,S,T,D){Cv(i,a);var V=(a.flags&128)!==0;if(!S&&!V)return T&&P0(a,p,!1),li(i,a,D);S=a.stateNode,NE.current=a;var ee=V&&typeof p.getDerivedStateFromError!="function"?null:S.render();return a.flags|=1,i!==null&&V?(a.child=ua(a,i.child,null,D),a.child=ua(a,null,ee,D)):ms(i,a,ee,D),a.memoizedState=S.state,T&&P0(a,p,!0),a.child}function kv(i){var a=i.stateNode;a.pendingContext?N0(i,a.pendingContext,a.pendingContext!==a.context):a.context&&N0(i,a.context,!1),hf(i,a.containerInfo)}function jv(i,a,p,S,T){return da(),nf(T),a.flags|=256,ms(i,a,p,S),a.child}var Af={dehydrated:null,treeContext:null,retryLane:0};function Tf(i){return{baseLanes:i,cachePool:null,transitions:null}}function Nv(i,a,p){var S=a.pendingProps,T=lr.current,D=!1,V=(a.flags&128)!==0,ee;if((ee=V)||(ee=i!==null&&i.memoizedState===null?!1:(T&2)!==0),ee?(D=!0,a.flags&=-129):(i===null||i.memoizedState!==null)&&(T|=1),Gt(lr,T&1),i===null)return sf(a),i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((a.mode&1)===0?a.lanes=1:i.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(V=S.children,i=S.fallback,D?(S=a.mode,D=a.child,V={mode:"hidden",children:V},(S&1)===0&&D!==null?(D.childLanes=0,D.pendingProps=V):D=Ld(V,S,0,null),i=Co(i,S,p,null),D.return=a,i.return=a,D.sibling=i,a.child=D,a.child.memoizedState=Tf(p),a.memoizedState=Af,i):Rf(a,V));if(T=i.memoizedState,T!==null&&(ee=T.dehydrated,ee!==null))return EE(i,a,V,S,ee,T,p);if(D){D=S.fallback,V=a.mode,T=i.child,ee=T.sibling;var ie={mode:"hidden",children:S.children};return(V&1)===0&&a.child!==T?(S=a.child,S.childLanes=0,S.pendingProps=ie,a.deletions=null):(S=Fi(T,ie),S.subtreeFlags=T.subtreeFlags&14680064),ee!==null?D=Fi(ee,D):(D=Co(D,V,p,null),D.flags|=2),D.return=a,S.return=a,S.sibling=D,a.child=S,S=D,D=a.child,V=i.child.memoizedState,V=V===null?Tf(p):{baseLanes:V.baseLanes|p,cachePool:null,transitions:V.transitions},D.memoizedState=V,D.childLanes=i.childLanes&~p,a.memoizedState=Af,S}return D=i.child,i=D.sibling,S=Fi(D,{mode:"visible",children:S.children}),(a.mode&1)===0&&(S.lanes=p),S.return=a,S.sibling=null,i!==null&&(p=a.deletions,p===null?(a.deletions=[i],a.flags|=16):p.push(i)),a.child=S,a.memoizedState=null,S}function Rf(i,a){return a=Ld({mode:"visible",children:a},i.mode,0,null),a.return=i,i.child=a}function Cd(i,a,p,S){return S!==null&&nf(S),ua(a,i.child,null,p),i=Rf(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function EE(i,a,p,S,T,D,V){if(p)return a.flags&256?(a.flags&=-257,S=jf(Error(s(422))),Cd(i,a,V,S)):a.memoizedState!==null?(a.child=i.child,a.flags|=128,null):(D=S.fallback,T=a.mode,S=Ld({mode:"visible",children:S.children},T,0,null),D=Co(D,T,V,null),D.flags|=2,S.return=a,D.return=a,S.sibling=D,a.child=S,(a.mode&1)!==0&&ua(a,i.child,null,V),a.child.memoizedState=Tf(V),a.memoizedState=Af,D);if((a.mode&1)===0)return Cd(i,a,V,null);if(T.data==="$!"){if(S=T.nextSibling&&T.nextSibling.dataset,S)var ee=S.dgst;return S=ee,D=Error(s(419)),S=jf(D,S,void 0),Cd(i,a,V,S)}if(ee=(V&i.childLanes)!==0,ks||ee){if(S=Or,S!==null){switch(V&-V){case 4:T=2;break;case 16:T=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:T=32;break;case 536870912:T=268435456;break;default:T=0}T=(T&(S.suspendedLanes|V))!==0?0:T,T!==0&&T!==D.retryLane&&(D.retryLane=T,oi(i,T),Cn(S,i,T,-1))}return Kf(),S=jf(Error(s(421))),Cd(i,a,V,S)}return T.data==="$?"?(a.flags|=128,a.child=i.child,a=zE.bind(null,i),T._reactRetry=a,null):(i=D.treeContext,$s=Ni(T.nextSibling),Bs=a,nr=!0,yn=null,i!==null&&(Qs[Zs++]=ni,Qs[Zs++]=ii,Qs[Zs++]=mo,ni=i.id,ii=i.overflow,mo=a),a=Rf(a,S.children),a.flags|=4096,a)}function Ev(i,a,p){i.lanes|=a;var S=i.alternate;S!==null&&(S.lanes|=a),cf(i.return,a,p)}function Mf(i,a,p,S,T){var D=i.memoizedState;D===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:S,tail:p,tailMode:T}:(D.isBackwards=a,D.rendering=null,D.renderingStartTime=0,D.last=S,D.tail=p,D.tailMode=T)}function Pv(i,a,p){var S=a.pendingProps,T=S.revealOrder,D=S.tail;if(ms(i,a,S.children,p),S=lr.current,(S&2)!==0)S=S&1|2,a.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Ev(i,p,a);else if(i.tag===19)Ev(i,p,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}S&=1}if(Gt(lr,S),(a.mode&1)===0)a.memoizedState=null;else switch(T){case"forwards":for(p=a.child,T=null;p!==null;)i=p.alternate,i!==null&&gd(i)===null&&(T=p),p=p.sibling;p=T,p===null?(T=a.child,a.child=null):(T=p.sibling,p.sibling=null),Mf(a,!1,T,p,D);break;case"backwards":for(p=null,T=a.child,a.child=null;T!==null;){if(i=T.alternate,i!==null&&gd(i)===null){a.child=T;break}i=T.sibling,T.sibling=p,p=T,T=i}Mf(a,!0,p,null,D);break;case"together":Mf(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Sd(i,a){(a.mode&1)===0&&i!==null&&(i.alternate=null,a.alternate=null,a.flags|=2)}function li(i,a,p){if(i!==null&&(a.dependencies=i.dependencies),yo|=a.lanes,(p&a.childLanes)===0)return null;if(i!==null&&a.child!==i.child)throw Error(s(153));if(a.child!==null){for(i=a.child,p=Fi(i,i.pendingProps),a.child=p,p.return=a;i.sibling!==null;)i=i.sibling,p=p.sibling=Fi(i,i.pendingProps),p.return=a;p.sibling=null}return a.child}function PE(i,a,p){switch(a.tag){case 3:kv(a),da();break;case 5:W0(a);break;case 1:Ss(a.type)&&od(a);break;case 4:hf(a,a.stateNode.containerInfo);break;case 10:var S=a.type._context,T=a.memoizedProps.value;Gt(hd,S._currentValue),S._currentValue=T;break;case 13:if(S=a.memoizedState,S!==null)return S.dehydrated!==null?(Gt(lr,lr.current&1),a.flags|=128,null):(p&a.child.childLanes)!==0?Nv(i,a,p):(Gt(lr,lr.current&1),i=li(i,a,p),i!==null?i.sibling:null);Gt(lr,lr.current&1);break;case 19:if(S=(p&a.childLanes)!==0,(i.flags&128)!==0){if(S)return Pv(i,a,p);a.flags|=128}if(T=a.memoizedState,T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),Gt(lr,lr.current),S)break;return null;case 22:case 23:return a.lanes=0,_v(i,a,p)}return li(i,a,p)}var Av,Df,Tv,Rv;Av=function(i,a){for(var p=a.child;p!==null;){if(p.tag===5||p.tag===6)i.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===a)break;for(;p.sibling===null;){if(p.return===null||p.return===a)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},Df=function(){},Tv=function(i,a,p,S){var T=i.memoizedProps;if(T!==S){i=a.stateNode,xo(Dn.current);var D=null;switch(p){case"input":T=Le(i,T),S=Le(i,S),D=[];break;case"select":T=R({},T,{value:void 0}),S=R({},S,{value:void 0}),D=[];break;case"textarea":T=we(i,T),S=we(i,S),D=[];break;default:typeof T.onClick!="function"&&typeof S.onClick=="function"&&(i.onclick=sd)}Jt(p,S);var V;p=null;for(ge in T)if(!S.hasOwnProperty(ge)&&T.hasOwnProperty(ge)&&T[ge]!=null)if(ge==="style"){var ee=T[ge];for(V in ee)ee.hasOwnProperty(V)&&(p||(p={}),p[V]="")}else ge!=="dangerouslySetInnerHTML"&&ge!=="children"&&ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&ge!=="autoFocus"&&(o.hasOwnProperty(ge)?D||(D=[]):(D=D||[]).push(ge,null));for(ge in S){var ie=S[ge];if(ee=T!=null?T[ge]:void 0,S.hasOwnProperty(ge)&&ie!==ee&&(ie!=null||ee!=null))if(ge==="style")if(ee){for(V in ee)!ee.hasOwnProperty(V)||ie&&ie.hasOwnProperty(V)||(p||(p={}),p[V]="");for(V in ie)ie.hasOwnProperty(V)&&ee[V]!==ie[V]&&(p||(p={}),p[V]=ie[V])}else p||(D||(D=[]),D.push(ge,p)),p=ie;else ge==="dangerouslySetInnerHTML"?(ie=ie?ie.__html:void 0,ee=ee?ee.__html:void 0,ie!=null&&ee!==ie&&(D=D||[]).push(ge,ie)):ge==="children"?typeof ie!="string"&&typeof ie!="number"||(D=D||[]).push(ge,""+ie):ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&(o.hasOwnProperty(ge)?(ie!=null&&ge==="onScroll"&&Qt("scroll",i),D||ee===ie||(D=[])):(D=D||[]).push(ge,ie))}p&&(D=D||[]).push("style",p);var ge=D;(a.updateQueue=ge)&&(a.flags|=4)}},Rv=function(i,a,p,S){p!==S&&(a.flags|=4)};function Dl(i,a){if(!nr)switch(i.tailMode){case"hidden":a=i.tail;for(var p=null;a!==null;)a.alternate!==null&&(p=a),a=a.sibling;p===null?i.tail=null:p.sibling=null;break;case"collapsed":p=i.tail;for(var S=null;p!==null;)p.alternate!==null&&(S=p),p=p.sibling;S===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:S.sibling=null}}function is(i){var a=i.alternate!==null&&i.alternate.child===i.child,p=0,S=0;if(a)for(var T=i.child;T!==null;)p|=T.lanes|T.childLanes,S|=T.subtreeFlags&14680064,S|=T.flags&14680064,T.return=i,T=T.sibling;else for(T=i.child;T!==null;)p|=T.lanes|T.childLanes,S|=T.subtreeFlags,S|=T.flags,T.return=i,T=T.sibling;return i.subtreeFlags|=S,i.childLanes=p,a}function AE(i,a,p){var S=a.pendingProps;switch(tf(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return is(a),null;case 1:return Ss(a.type)&&id(),is(a),null;case 3:return S=a.stateNode,ma(),Zt(Cs),Zt(ss),pf(),S.pendingContext&&(S.context=S.pendingContext,S.pendingContext=null),(i===null||i.child===null)&&(dd(a)?a.flags|=4:i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,yn!==null&&(Uf(yn),yn=null))),Df(i,a),is(a),null;case 5:ff(a);var T=xo(Pl.current);if(p=a.type,i!==null&&a.stateNode!=null)Tv(i,a,p,S,T),i.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!S){if(a.stateNode===null)throw Error(s(166));return is(a),null}if(i=xo(Dn.current),dd(a)){S=a.stateNode,p=a.type;var D=a.memoizedProps;switch(S[Mn]=a,S[Sl]=D,i=(a.mode&1)!==0,p){case"dialog":Qt("cancel",S),Qt("close",S);break;case"iframe":case"object":case"embed":Qt("load",S);break;case"video":case"audio":for(T=0;T<wl.length;T++)Qt(wl[T],S);break;case"source":Qt("error",S);break;case"img":case"image":case"link":Qt("error",S),Qt("load",S);break;case"details":Qt("toggle",S);break;case"input":Ge(S,D),Qt("invalid",S);break;case"select":S._wrapperState={wasMultiple:!!D.multiple},Qt("invalid",S);break;case"textarea":ve(S,D),Qt("invalid",S)}Jt(p,D),T=null;for(var V in D)if(D.hasOwnProperty(V)){var ee=D[V];V==="children"?typeof ee=="string"?S.textContent!==ee&&(D.suppressHydrationWarning!==!0&&rd(S.textContent,ee,i),T=["children",ee]):typeof ee=="number"&&S.textContent!==""+ee&&(D.suppressHydrationWarning!==!0&&rd(S.textContent,ee,i),T=["children",""+ee]):o.hasOwnProperty(V)&&ee!=null&&V==="onScroll"&&Qt("scroll",S)}switch(p){case"input":Z(S),Be(S,D,!0);break;case"textarea":Z(S),Oe(S);break;case"select":case"option":break;default:typeof D.onClick=="function"&&(S.onclick=sd)}S=T,a.updateQueue=S,S!==null&&(a.flags|=4)}else{V=T.nodeType===9?T:T.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=de(p)),i==="http://www.w3.org/1999/xhtml"?p==="script"?(i=V.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof S.is=="string"?i=V.createElement(p,{is:S.is}):(i=V.createElement(p),p==="select"&&(V=i,S.multiple?V.multiple=!0:S.size&&(V.size=S.size))):i=V.createElementNS(i,p),i[Mn]=a,i[Sl]=S,Av(i,a,!1,!1),a.stateNode=i;e:{switch(V=Cr(p,S),p){case"dialog":Qt("cancel",i),Qt("close",i),T=S;break;case"iframe":case"object":case"embed":Qt("load",i),T=S;break;case"video":case"audio":for(T=0;T<wl.length;T++)Qt(wl[T],i);T=S;break;case"source":Qt("error",i),T=S;break;case"img":case"image":case"link":Qt("error",i),Qt("load",i),T=S;break;case"details":Qt("toggle",i),T=S;break;case"input":Ge(i,S),T=Le(i,S),Qt("invalid",i);break;case"option":T=S;break;case"select":i._wrapperState={wasMultiple:!!S.multiple},T=R({},S,{value:void 0}),Qt("invalid",i);break;case"textarea":ve(i,S),T=we(i,S),Qt("invalid",i);break;default:T=S}Jt(p,T),ee=T;for(D in ee)if(ee.hasOwnProperty(D)){var ie=ee[D];D==="style"?Rr(i,ie):D==="dangerouslySetInnerHTML"?(ie=ie?ie.__html:void 0,ie!=null&&ze(i,ie)):D==="children"?typeof ie=="string"?(p!=="textarea"||ie!=="")&&Je(i,ie):typeof ie=="number"&&Je(i,""+ie):D!=="suppressContentEditableWarning"&&D!=="suppressHydrationWarning"&&D!=="autoFocus"&&(o.hasOwnProperty(D)?ie!=null&&D==="onScroll"&&Qt("scroll",i):ie!=null&&b(i,D,ie,V))}switch(p){case"input":Z(i),Be(i,S,!1);break;case"textarea":Z(i),Oe(i);break;case"option":S.value!=null&&i.setAttribute("value",""+W(S.value));break;case"select":i.multiple=!!S.multiple,D=S.value,D!=null?je(i,!!S.multiple,D,!1):S.defaultValue!=null&&je(i,!!S.multiple,S.defaultValue,!0);break;default:typeof T.onClick=="function"&&(i.onclick=sd)}switch(p){case"button":case"input":case"select":case"textarea":S=!!S.autoFocus;break e;case"img":S=!0;break e;default:S=!1}}S&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return is(a),null;case 6:if(i&&a.stateNode!=null)Rv(i,a,i.memoizedProps,S);else{if(typeof S!="string"&&a.stateNode===null)throw Error(s(166));if(p=xo(Pl.current),xo(Dn.current),dd(a)){if(S=a.stateNode,p=a.memoizedProps,S[Mn]=a,(D=S.nodeValue!==p)&&(i=Bs,i!==null))switch(i.tag){case 3:rd(S.nodeValue,p,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&rd(S.nodeValue,p,(i.mode&1)!==0)}D&&(a.flags|=4)}else S=(p.nodeType===9?p:p.ownerDocument).createTextNode(S),S[Mn]=a,a.stateNode=S}return is(a),null;case 13:if(Zt(lr),S=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(nr&&$s!==null&&(a.mode&1)!==0&&(a.flags&128)===0)I0(),da(),a.flags|=98560,D=!1;else if(D=dd(a),S!==null&&S.dehydrated!==null){if(i===null){if(!D)throw Error(s(318));if(D=a.memoizedState,D=D!==null?D.dehydrated:null,!D)throw Error(s(317));D[Mn]=a}else da(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;is(a),D=!1}else yn!==null&&(Uf(yn),yn=null),D=!0;if(!D)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=p,a):(S=S!==null,S!==(i!==null&&i.memoizedState!==null)&&S&&(a.child.flags|=8192,(a.mode&1)!==0&&(i===null||(lr.current&1)!==0?Nr===0&&(Nr=3):Kf())),a.updateQueue!==null&&(a.flags|=4),is(a),null);case 4:return ma(),Df(i,a),i===null&&_l(a.stateNode.containerInfo),is(a),null;case 10:return lf(a.type._context),is(a),null;case 17:return Ss(a.type)&&id(),is(a),null;case 19:if(Zt(lr),D=a.memoizedState,D===null)return is(a),null;if(S=(a.flags&128)!==0,V=D.rendering,V===null)if(S)Dl(D,!1);else{if(Nr!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(V=gd(i),V!==null){for(a.flags|=128,Dl(D,!1),S=V.updateQueue,S!==null&&(a.updateQueue=S,a.flags|=4),a.subtreeFlags=0,S=p,p=a.child;p!==null;)D=p,i=S,D.flags&=14680066,V=D.alternate,V===null?(D.childLanes=0,D.lanes=i,D.child=null,D.subtreeFlags=0,D.memoizedProps=null,D.memoizedState=null,D.updateQueue=null,D.dependencies=null,D.stateNode=null):(D.childLanes=V.childLanes,D.lanes=V.lanes,D.child=V.child,D.subtreeFlags=0,D.deletions=null,D.memoizedProps=V.memoizedProps,D.memoizedState=V.memoizedState,D.updateQueue=V.updateQueue,D.type=V.type,i=V.dependencies,D.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),p=p.sibling;return Gt(lr,lr.current&1|2),a.child}i=i.sibling}D.tail!==null&&Xt()>va&&(a.flags|=128,S=!0,Dl(D,!1),a.lanes=4194304)}else{if(!S)if(i=gd(V),i!==null){if(a.flags|=128,S=!0,p=i.updateQueue,p!==null&&(a.updateQueue=p,a.flags|=4),Dl(D,!0),D.tail===null&&D.tailMode==="hidden"&&!V.alternate&&!nr)return is(a),null}else 2*Xt()-D.renderingStartTime>va&&p!==1073741824&&(a.flags|=128,S=!0,Dl(D,!1),a.lanes=4194304);D.isBackwards?(V.sibling=a.child,a.child=V):(p=D.last,p!==null?p.sibling=V:a.child=V,D.last=V)}return D.tail!==null?(a=D.tail,D.rendering=a,D.tail=a.sibling,D.renderingStartTime=Xt(),a.sibling=null,p=lr.current,Gt(lr,S?p&1|2:p&1),a):(is(a),null);case 22:case 23:return qf(),S=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==S&&(a.flags|=8192),S&&(a.mode&1)!==0?(zs&1073741824)!==0&&(is(a),a.subtreeFlags&6&&(a.flags|=8192)):is(a),null;case 24:return null;case 25:return null}throw Error(s(156,a.tag))}function TE(i,a){switch(tf(a),a.tag){case 1:return Ss(a.type)&&id(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return ma(),Zt(Cs),Zt(ss),pf(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 5:return ff(a),null;case 13:if(Zt(lr),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(s(340));da()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return Zt(lr),null;case 4:return ma(),null;case 10:return lf(a.type._context),null;case 22:case 23:return qf(),null;case 24:return null;default:return null}}var kd=!1,os=!1,RE=typeof WeakSet=="function"?WeakSet:Set,He=null;function ga(i,a){var p=i.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(S){fr(i,a,S)}else p.current=null}function If(i,a,p){try{p()}catch(S){fr(i,a,S)}}var Mv=!1;function ME(i,a){if(Gh=uo,i=u0(),Fh(i)){if("selectionStart"in i)var p={start:i.selectionStart,end:i.selectionEnd};else e:{p=(p=i.ownerDocument)&&p.defaultView||window;var S=p.getSelection&&p.getSelection();if(S&&S.rangeCount!==0){p=S.anchorNode;var T=S.anchorOffset,D=S.focusNode;S=S.focusOffset;try{p.nodeType,D.nodeType}catch{p=null;break e}var V=0,ee=-1,ie=-1,ge=0,ke=0,Ne=i,Se=null;t:for(;;){for(var $e;Ne!==p||T!==0&&Ne.nodeType!==3||(ee=V+T),Ne!==D||S!==0&&Ne.nodeType!==3||(ie=V+S),Ne.nodeType===3&&(V+=Ne.nodeValue.length),($e=Ne.firstChild)!==null;)Se=Ne,Ne=$e;for(;;){if(Ne===i)break t;if(Se===p&&++ge===T&&(ee=V),Se===D&&++ke===S&&(ie=V),($e=Ne.nextSibling)!==null)break;Ne=Se,Se=Ne.parentNode}Ne=$e}p=ee===-1||ie===-1?null:{start:ee,end:ie}}else p=null}p=p||{start:0,end:0}}else p=null;for(qh={focusedElem:i,selectionRange:p},uo=!1,He=a;He!==null;)if(a=He,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,He=i;else for(;He!==null;){a=He;try{var We=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(We!==null){var Ye=We.memoizedProps,gr=We.memoizedState,he=a.stateNode,oe=he.getSnapshotBeforeUpdate(a.elementType===a.type?Ye:bn(a.type,Ye),gr);he.__reactInternalSnapshotBeforeUpdate=oe}break;case 3:var pe=a.stateNode.containerInfo;pe.nodeType===1?pe.textContent="":pe.nodeType===9&&pe.documentElement&&pe.removeChild(pe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(Re){fr(a,a.return,Re)}if(i=a.sibling,i!==null){i.return=a.return,He=i;break}He=a.return}return We=Mv,Mv=!1,We}function Il(i,a,p){var S=a.updateQueue;if(S=S!==null?S.lastEffect:null,S!==null){var T=S=S.next;do{if((T.tag&i)===i){var D=T.destroy;T.destroy=void 0,D!==void 0&&If(a,p,D)}T=T.next}while(T!==S)}}function jd(i,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var p=a=a.next;do{if((p.tag&i)===i){var S=p.create;p.destroy=S()}p=p.next}while(p!==a)}}function Lf(i){var a=i.ref;if(a!==null){var p=i.stateNode;switch(i.tag){case 5:i=p;break;default:i=p}typeof a=="function"?a(i):a.current=i}}function Dv(i){var a=i.alternate;a!==null&&(i.alternate=null,Dv(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&(delete a[Mn],delete a[Sl],delete a[Xh],delete a[pE],delete a[gE])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Iv(i){return i.tag===5||i.tag===3||i.tag===4}function Lv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Iv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Of(i,a,p){var S=i.tag;if(S===5||S===6)i=i.stateNode,a?p.nodeType===8?p.parentNode.insertBefore(i,a):p.insertBefore(i,a):(p.nodeType===8?(a=p.parentNode,a.insertBefore(i,p)):(a=p,a.appendChild(i)),p=p._reactRootContainer,p!=null||a.onclick!==null||(a.onclick=sd));else if(S!==4&&(i=i.child,i!==null))for(Of(i,a,p),i=i.sibling;i!==null;)Of(i,a,p),i=i.sibling}function Ff(i,a,p){var S=i.tag;if(S===5||S===6)i=i.stateNode,a?p.insertBefore(i,a):p.appendChild(i);else if(S!==4&&(i=i.child,i!==null))for(Ff(i,a,p),i=i.sibling;i!==null;)Ff(i,a,p),i=i.sibling}var Ur=null,wn=!1;function Mi(i,a,p){for(p=p.child;p!==null;)Ov(i,a,p),p=p.sibling}function Ov(i,a,p){if(fs&&typeof fs.onCommitFiberUnmount=="function")try{fs.onCommitFiberUnmount(Zn,p)}catch{}switch(p.tag){case 5:os||ga(p,a);case 6:var S=Ur,T=wn;Ur=null,Mi(i,a,p),Ur=S,wn=T,Ur!==null&&(wn?(i=Ur,p=p.stateNode,i.nodeType===8?i.parentNode.removeChild(p):i.removeChild(p)):Ur.removeChild(p.stateNode));break;case 18:Ur!==null&&(wn?(i=Ur,p=p.stateNode,i.nodeType===8?Jh(i.parentNode,p):i.nodeType===1&&Jh(i,p),Si(i)):Jh(Ur,p.stateNode));break;case 4:S=Ur,T=wn,Ur=p.stateNode.containerInfo,wn=!0,Mi(i,a,p),Ur=S,wn=T;break;case 0:case 11:case 14:case 15:if(!os&&(S=p.updateQueue,S!==null&&(S=S.lastEffect,S!==null))){T=S=S.next;do{var D=T,V=D.destroy;D=D.tag,V!==void 0&&((D&2)!==0||(D&4)!==0)&&If(p,a,V),T=T.next}while(T!==S)}Mi(i,a,p);break;case 1:if(!os&&(ga(p,a),S=p.stateNode,typeof S.componentWillUnmount=="function"))try{S.props=p.memoizedProps,S.state=p.memoizedState,S.componentWillUnmount()}catch(ee){fr(p,a,ee)}Mi(i,a,p);break;case 21:Mi(i,a,p);break;case 22:p.mode&1?(os=(S=os)||p.memoizedState!==null,Mi(i,a,p),os=S):Mi(i,a,p);break;default:Mi(i,a,p)}}function Fv(i){var a=i.updateQueue;if(a!==null){i.updateQueue=null;var p=i.stateNode;p===null&&(p=i.stateNode=new RE),a.forEach(function(S){var T=HE.bind(null,i,S);p.has(S)||(p.add(S),S.then(T,T))})}}function _n(i,a){var p=a.deletions;if(p!==null)for(var S=0;S<p.length;S++){var T=p[S];try{var D=i,V=a,ee=V;e:for(;ee!==null;){switch(ee.tag){case 5:Ur=ee.stateNode,wn=!1;break e;case 3:Ur=ee.stateNode.containerInfo,wn=!0;break e;case 4:Ur=ee.stateNode.containerInfo,wn=!0;break e}ee=ee.return}if(Ur===null)throw Error(s(160));Ov(D,V,T),Ur=null,wn=!1;var ie=T.alternate;ie!==null&&(ie.return=null),T.return=null}catch(ge){fr(T,a,ge)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)Bv(a,i),a=a.sibling}function Bv(i,a){var p=i.alternate,S=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(_n(a,i),Ln(i),S&4){try{Il(3,i,i.return),jd(3,i)}catch(Ye){fr(i,i.return,Ye)}try{Il(5,i,i.return)}catch(Ye){fr(i,i.return,Ye)}}break;case 1:_n(a,i),Ln(i),S&512&&p!==null&&ga(p,p.return);break;case 5:if(_n(a,i),Ln(i),S&512&&p!==null&&ga(p,p.return),i.flags&32){var T=i.stateNode;try{Je(T,"")}catch(Ye){fr(i,i.return,Ye)}}if(S&4&&(T=i.stateNode,T!=null)){var D=i.memoizedProps,V=p!==null?p.memoizedProps:D,ee=i.type,ie=i.updateQueue;if(i.updateQueue=null,ie!==null)try{ee==="input"&&D.type==="radio"&&D.name!=null&&me(T,D),Cr(ee,V);var ge=Cr(ee,D);for(V=0;V<ie.length;V+=2){var ke=ie[V],Ne=ie[V+1];ke==="style"?Rr(T,Ne):ke==="dangerouslySetInnerHTML"?ze(T,Ne):ke==="children"?Je(T,Ne):b(T,ke,Ne,ge)}switch(ee){case"input":be(T,D);break;case"textarea":_e(T,D);break;case"select":var Se=T._wrapperState.wasMultiple;T._wrapperState.wasMultiple=!!D.multiple;var $e=D.value;$e!=null?je(T,!!D.multiple,$e,!1):Se!==!!D.multiple&&(D.defaultValue!=null?je(T,!!D.multiple,D.defaultValue,!0):je(T,!!D.multiple,D.multiple?[]:"",!1))}T[Sl]=D}catch(Ye){fr(i,i.return,Ye)}}break;case 6:if(_n(a,i),Ln(i),S&4){if(i.stateNode===null)throw Error(s(162));T=i.stateNode,D=i.memoizedProps;try{T.nodeValue=D}catch(Ye){fr(i,i.return,Ye)}}break;case 3:if(_n(a,i),Ln(i),S&4&&p!==null&&p.memoizedState.isDehydrated)try{Si(a.containerInfo)}catch(Ye){fr(i,i.return,Ye)}break;case 4:_n(a,i),Ln(i);break;case 13:_n(a,i),Ln(i),T=i.child,T.flags&8192&&(D=T.memoizedState!==null,T.stateNode.isHidden=D,!D||T.alternate!==null&&T.alternate.memoizedState!==null||(zf=Xt())),S&4&&Fv(i);break;case 22:if(ke=p!==null&&p.memoizedState!==null,i.mode&1?(os=(ge=os)||ke,_n(a,i),os=ge):_n(a,i),Ln(i),S&8192){if(ge=i.memoizedState!==null,(i.stateNode.isHidden=ge)&&!ke&&(i.mode&1)!==0)for(He=i,ke=i.child;ke!==null;){for(Ne=He=ke;He!==null;){switch(Se=He,$e=Se.child,Se.tag){case 0:case 11:case 14:case 15:Il(4,Se,Se.return);break;case 1:ga(Se,Se.return);var We=Se.stateNode;if(typeof We.componentWillUnmount=="function"){S=Se,p=Se.return;try{a=S,We.props=a.memoizedProps,We.state=a.memoizedState,We.componentWillUnmount()}catch(Ye){fr(S,p,Ye)}}break;case 5:ga(Se,Se.return);break;case 22:if(Se.memoizedState!==null){Hv(Ne);continue}}$e!==null?($e.return=Se,He=$e):Hv(Ne)}ke=ke.sibling}e:for(ke=null,Ne=i;;){if(Ne.tag===5){if(ke===null){ke=Ne;try{T=Ne.stateNode,ge?(D=T.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none"):(ee=Ne.stateNode,ie=Ne.memoizedProps.style,V=ie!=null&&ie.hasOwnProperty("display")?ie.display:null,ee.style.display=ur("display",V))}catch(Ye){fr(i,i.return,Ye)}}}else if(Ne.tag===6){if(ke===null)try{Ne.stateNode.nodeValue=ge?"":Ne.memoizedProps}catch(Ye){fr(i,i.return,Ye)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===i)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===i)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===i)break e;ke===Ne&&(ke=null),Ne=Ne.return}ke===Ne&&(ke=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:_n(a,i),Ln(i),S&4&&Fv(i);break;case 21:break;default:_n(a,i),Ln(i)}}function Ln(i){var a=i.flags;if(a&2){try{e:{for(var p=i.return;p!==null;){if(Iv(p)){var S=p;break e}p=p.return}throw Error(s(160))}switch(S.tag){case 5:var T=S.stateNode;S.flags&32&&(Je(T,""),S.flags&=-33);var D=Lv(i);Ff(i,D,T);break;case 3:case 4:var V=S.stateNode.containerInfo,ee=Lv(i);Of(i,ee,V);break;default:throw Error(s(161))}}catch(ie){fr(i,i.return,ie)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function DE(i,a,p){He=i,$v(i)}function $v(i,a,p){for(var S=(i.mode&1)!==0;He!==null;){var T=He,D=T.child;if(T.tag===22&&S){var V=T.memoizedState!==null||kd;if(!V){var ee=T.alternate,ie=ee!==null&&ee.memoizedState!==null||os;ee=kd;var ge=os;if(kd=V,(os=ie)&&!ge)for(He=T;He!==null;)V=He,ie=V.child,V.tag===22&&V.memoizedState!==null?Wv(T):ie!==null?(ie.return=V,He=ie):Wv(T);for(;D!==null;)He=D,$v(D),D=D.sibling;He=T,kd=ee,os=ge}zv(i)}else(T.subtreeFlags&8772)!==0&&D!==null?(D.return=T,He=D):zv(i)}}function zv(i){for(;He!==null;){var a=He;if((a.flags&8772)!==0){var p=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:os||jd(5,a);break;case 1:var S=a.stateNode;if(a.flags&4&&!os)if(p===null)S.componentDidMount();else{var T=a.elementType===a.type?p.memoizedProps:bn(a.type,p.memoizedProps);S.componentDidUpdate(T,p.memoizedState,S.__reactInternalSnapshotBeforeUpdate)}var D=a.updateQueue;D!==null&&H0(a,D,S);break;case 3:var V=a.updateQueue;if(V!==null){if(p=null,a.child!==null)switch(a.child.tag){case 5:p=a.child.stateNode;break;case 1:p=a.child.stateNode}H0(a,V,p)}break;case 5:var ee=a.stateNode;if(p===null&&a.flags&4){p=ee;var ie=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":ie.autoFocus&&p.focus();break;case"img":ie.src&&(p.src=ie.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var ge=a.alternate;if(ge!==null){var ke=ge.memoizedState;if(ke!==null){var Ne=ke.dehydrated;Ne!==null&&Si(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}os||a.flags&512&&Lf(a)}catch(Se){fr(a,a.return,Se)}}if(a===i){He=null;break}if(p=a.sibling,p!==null){p.return=a.return,He=p;break}He=a.return}}function Hv(i){for(;He!==null;){var a=He;if(a===i){He=null;break}var p=a.sibling;if(p!==null){p.return=a.return,He=p;break}He=a.return}}function Wv(i){for(;He!==null;){var a=He;try{switch(a.tag){case 0:case 11:case 15:var p=a.return;try{jd(4,a)}catch(ie){fr(a,p,ie)}break;case 1:var S=a.stateNode;if(typeof S.componentDidMount=="function"){var T=a.return;try{S.componentDidMount()}catch(ie){fr(a,T,ie)}}var D=a.return;try{Lf(a)}catch(ie){fr(a,D,ie)}break;case 5:var V=a.return;try{Lf(a)}catch(ie){fr(a,V,ie)}}}catch(ie){fr(a,a.return,ie)}if(a===i){He=null;break}var ee=a.sibling;if(ee!==null){ee.return=a.return,He=ee;break}He=a.return}}var IE=Math.ceil,Nd=k.ReactCurrentDispatcher,Bf=k.ReactCurrentOwner,rn=k.ReactCurrentBatchConfig,At=0,Or=null,wr=null,Gr=0,zs=0,xa=Ei(0),Nr=0,Ll=null,yo=0,Ed=0,$f=0,Ol=null,js=null,zf=0,va=1/0,ci=null,Pd=!1,Hf=null,Di=null,Ad=!1,Ii=null,Td=0,Fl=0,Wf=null,Rd=-1,Md=0;function ps(){return(At&6)!==0?Xt():Rd!==-1?Rd:Rd=Xt()}function Li(i){return(i.mode&1)===0?1:(At&2)!==0&&Gr!==0?Gr&-Gr:vE.transition!==null?(Md===0&&(Md=_s()),Md):(i=Pt,i!==0||(i=window.event,i=i===void 0?16:Ux(i.type)),i)}function Cn(i,a,p,S){if(50<Fl)throw Fl=0,Wf=null,Error(s(185));Rn(i,p,S),((At&2)===0||i!==Or)&&(i===Or&&((At&2)===0&&(Ed|=p),Nr===4&&Oi(i,Gr)),Ns(i,S),p===1&&At===0&&(a.mode&1)===0&&(va=Xt()+500,ad&&Ai()))}function Ns(i,a){var p=i.callbackNode;pr(i,a);var S=sr(i,i===Or?Gr:0);if(S===0)p!==null&&Go(p),i.callbackNode=null,i.callbackPriority=0;else if(a=S&-S,i.callbackPriority!==a){if(p!=null&&Go(p),a===1)i.tag===0?xE(Uv.bind(null,i)):A0(Uv.bind(null,i)),fE(function(){(At&6)===0&&Ai()}),p=null;else{switch(cl(S)){case 1:p=Js;break;case 4:p=io;break;case 16:p=Tn;break;case 536870912:p=oo;break;default:p=Tn}p=Zv(p,Vv.bind(null,i))}i.callbackPriority=a,i.callbackNode=p}}function Vv(i,a){if(Rd=-1,Md=0,(At&6)!==0)throw Error(s(327));var p=i.callbackNode;if(ya()&&i.callbackNode!==p)return null;var S=sr(i,i===Or?Gr:0);if(S===0)return null;if((S&30)!==0||(S&i.expiredLanes)!==0||a)a=Dd(i,S);else{a=S;var T=At;At|=2;var D=qv();(Or!==i||Gr!==a)&&(ci=null,va=Xt()+500,wo(i,a));do try{FE();break}catch(ee){Gv(i,ee)}while(!0);af(),Nd.current=D,At=T,wr!==null?a=0:(Or=null,Gr=0,a=Nr)}if(a!==0){if(a===2&&(T=es(i),T!==0&&(S=T,a=Vf(i,T))),a===1)throw p=Ll,wo(i,0),Oi(i,S),Ns(i,Xt()),p;if(a===6)Oi(i,S);else{if(T=i.current.alternate,(S&30)===0&&!LE(T)&&(a=Dd(i,S),a===2&&(D=es(i),D!==0&&(S=D,a=Vf(i,D))),a===1))throw p=Ll,wo(i,0),Oi(i,S),Ns(i,Xt()),p;switch(i.finishedWork=T,i.finishedLanes=S,a){case 0:case 1:throw Error(s(345));case 2:_o(i,js,ci);break;case 3:if(Oi(i,S),(S&130023424)===S&&(a=zf+500-Xt(),10<a)){if(sr(i,0)!==0)break;if(T=i.suspendedLanes,(T&S)!==S){ps(),i.pingedLanes|=i.suspendedLanes&T;break}i.timeoutHandle=Yh(_o.bind(null,i,js,ci),a);break}_o(i,js,ci);break;case 4:if(Oi(i,S),(S&4194240)===S)break;for(a=i.eventTimes,T=-1;0<S;){var V=31-Mr(S);D=1<<V,V=a[V],V>T&&(T=V),S&=~D}if(S=T,S=Xt()-S,S=(120>S?120:480>S?480:1080>S?1080:1920>S?1920:3e3>S?3e3:4320>S?4320:1960*IE(S/1960))-S,10<S){i.timeoutHandle=Yh(_o.bind(null,i,js,ci),S);break}_o(i,js,ci);break;case 5:_o(i,js,ci);break;default:throw Error(s(329))}}}return Ns(i,Xt()),i.callbackNode===p?Vv.bind(null,i):null}function Vf(i,a){var p=Ol;return i.current.memoizedState.isDehydrated&&(wo(i,a).flags|=256),i=Dd(i,a),i!==2&&(a=js,js=p,a!==null&&Uf(a)),i}function Uf(i){js===null?js=i:js.push.apply(js,i)}function LE(i){for(var a=i;;){if(a.flags&16384){var p=a.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var S=0;S<p.length;S++){var T=p[S],D=T.getSnapshot;T=T.value;try{if(!vn(D(),T))return!1}catch{return!1}}}if(p=a.child,a.subtreeFlags&16384&&p!==null)p.return=a,a=p;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Oi(i,a){for(a&=~$f,a&=~Ed,i.suspendedLanes|=a,i.pingedLanes&=~a,i=i.expirationTimes;0<a;){var p=31-Mr(a),S=1<<p;i[p]=-1,a&=~S}}function Uv(i){if((At&6)!==0)throw Error(s(327));ya();var a=sr(i,0);if((a&1)===0)return Ns(i,Xt()),null;var p=Dd(i,a);if(i.tag!==0&&p===2){var S=es(i);S!==0&&(a=S,p=Vf(i,S))}if(p===1)throw p=Ll,wo(i,0),Oi(i,a),Ns(i,Xt()),p;if(p===6)throw Error(s(345));return i.finishedWork=i.current.alternate,i.finishedLanes=a,_o(i,js,ci),Ns(i,Xt()),null}function Gf(i,a){var p=At;At|=1;try{return i(a)}finally{At=p,At===0&&(va=Xt()+500,ad&&Ai())}}function bo(i){Ii!==null&&Ii.tag===0&&(At&6)===0&&ya();var a=At;At|=1;var p=rn.transition,S=Pt;try{if(rn.transition=null,Pt=1,i)return i()}finally{Pt=S,rn.transition=p,At=a,(At&6)===0&&Ai()}}function qf(){zs=xa.current,Zt(xa)}function wo(i,a){i.finishedWork=null,i.finishedLanes=0;var p=i.timeoutHandle;if(p!==-1&&(i.timeoutHandle=-1,hE(p)),wr!==null)for(p=wr.return;p!==null;){var S=p;switch(tf(S),S.tag){case 1:S=S.type.childContextTypes,S!=null&&id();break;case 3:ma(),Zt(Cs),Zt(ss),pf();break;case 5:ff(S);break;case 4:ma();break;case 13:Zt(lr);break;case 19:Zt(lr);break;case 10:lf(S.type._context);break;case 22:case 23:qf()}p=p.return}if(Or=i,wr=i=Fi(i.current,null),Gr=zs=a,Nr=0,Ll=null,$f=Ed=yo=0,js=Ol=null,go!==null){for(a=0;a<go.length;a++)if(p=go[a],S=p.interleaved,S!==null){p.interleaved=null;var T=S.next,D=p.pending;if(D!==null){var V=D.next;D.next=T,S.next=V}p.pending=S}go=null}return i}function Gv(i,a){do{var p=wr;try{if(af(),xd.current=wd,vd){for(var S=cr.memoizedState;S!==null;){var T=S.queue;T!==null&&(T.pending=null),S=S.next}vd=!1}if(vo=0,Lr=jr=cr=null,Al=!1,Tl=0,Bf.current=null,p===null||p.return===null){Nr=1,Ll=a,wr=null;break}e:{var D=i,V=p.return,ee=p,ie=a;if(a=Gr,ee.flags|=32768,ie!==null&&typeof ie=="object"&&typeof ie.then=="function"){var ge=ie,ke=ee,Ne=ke.tag;if((ke.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var Se=ke.alternate;Se?(ke.updateQueue=Se.updateQueue,ke.memoizedState=Se.memoizedState,ke.lanes=Se.lanes):(ke.updateQueue=null,ke.memoizedState=null)}var $e=xv(V);if($e!==null){$e.flags&=-257,vv($e,V,ee,D,a),$e.mode&1&&gv(D,ge,a),a=$e,ie=ge;var We=a.updateQueue;if(We===null){var Ye=new Set;Ye.add(ie),a.updateQueue=Ye}else We.add(ie);break e}else{if((a&1)===0){gv(D,ge,a),Kf();break e}ie=Error(s(426))}}else if(nr&&ee.mode&1){var gr=xv(V);if(gr!==null){(gr.flags&65536)===0&&(gr.flags|=256),vv(gr,V,ee,D,a),nf(pa(ie,ee));break e}}D=ie=pa(ie,ee),Nr!==4&&(Nr=2),Ol===null?Ol=[D]:Ol.push(D),D=V;do{switch(D.tag){case 3:D.flags|=65536,a&=-a,D.lanes|=a;var he=mv(D,ie,a);z0(D,he);break e;case 1:ee=ie;var oe=D.type,pe=D.stateNode;if((D.flags&128)===0&&(typeof oe.getDerivedStateFromError=="function"||pe!==null&&typeof pe.componentDidCatch=="function"&&(Di===null||!Di.has(pe)))){D.flags|=65536,a&=-a,D.lanes|=a;var Re=pv(D,ee,a);z0(D,Re);break e}}D=D.return}while(D!==null)}Yv(p)}catch(Xe){a=Xe,wr===p&&p!==null&&(wr=p=p.return);continue}break}while(!0)}function qv(){var i=Nd.current;return Nd.current=wd,i===null?wd:i}function Kf(){(Nr===0||Nr===3||Nr===2)&&(Nr=4),Or===null||(yo&268435455)===0&&(Ed&268435455)===0||Oi(Or,Gr)}function Dd(i,a){var p=At;At|=2;var S=qv();(Or!==i||Gr!==a)&&(ci=null,wo(i,a));do try{OE();break}catch(T){Gv(i,T)}while(!0);if(af(),At=p,Nd.current=S,wr!==null)throw Error(s(261));return Or=null,Gr=0,Nr}function OE(){for(;wr!==null;)Kv(wr)}function FE(){for(;wr!==null&&!qo();)Kv(wr)}function Kv(i){var a=Qv(i.alternate,i,zs);i.memoizedProps=i.pendingProps,a===null?Yv(i):wr=a,Bf.current=null}function Yv(i){var a=i;do{var p=a.alternate;if(i=a.return,(a.flags&32768)===0){if(p=AE(p,a,zs),p!==null){wr=p;return}}else{if(p=TE(p,a),p!==null){p.flags&=32767,wr=p;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{Nr=6,wr=null;return}}if(a=a.sibling,a!==null){wr=a;return}wr=a=i}while(a!==null);Nr===0&&(Nr=5)}function _o(i,a,p){var S=Pt,T=rn.transition;try{rn.transition=null,Pt=1,BE(i,a,p,S)}finally{rn.transition=T,Pt=S}return null}function BE(i,a,p,S){do ya();while(Ii!==null);if((At&6)!==0)throw Error(s(327));p=i.finishedWork;var T=i.finishedLanes;if(p===null)return null;if(i.finishedWork=null,i.finishedLanes=0,p===i.current)throw Error(s(177));i.callbackNode=null,i.callbackPriority=0;var D=p.lanes|p.childLanes;if(Vc(i,D),i===Or&&(wr=Or=null,Gr=0),(p.subtreeFlags&2064)===0&&(p.flags&2064)===0||Ad||(Ad=!0,Zv(Tn,function(){return ya(),null})),D=(p.flags&15990)!==0,(p.subtreeFlags&15990)!==0||D){D=rn.transition,rn.transition=null;var V=Pt;Pt=1;var ee=At;At|=4,Bf.current=null,ME(i,p),Bv(p,i),iE(qh),uo=!!Gh,qh=Gh=null,i.current=p,DE(p),no(),At=ee,Pt=V,rn.transition=D}else i.current=p;if(Ad&&(Ad=!1,Ii=i,Td=T),D=i.pendingLanes,D===0&&(Di=null),ao(p.stateNode),Ns(i,Xt()),a!==null)for(S=i.onRecoverableError,p=0;p<a.length;p++)T=a[p],S(T.value,{componentStack:T.stack,digest:T.digest});if(Pd)throw Pd=!1,i=Hf,Hf=null,i;return(Td&1)!==0&&i.tag!==0&&ya(),D=i.pendingLanes,(D&1)!==0?i===Wf?Fl++:(Fl=0,Wf=i):Fl=0,Ai(),null}function ya(){if(Ii!==null){var i=cl(Td),a=rn.transition,p=Pt;try{if(rn.transition=null,Pt=16>i?16:i,Ii===null)var S=!1;else{if(i=Ii,Ii=null,Td=0,(At&6)!==0)throw Error(s(331));var T=At;for(At|=4,He=i.current;He!==null;){var D=He,V=D.child;if((He.flags&16)!==0){var ee=D.deletions;if(ee!==null){for(var ie=0;ie<ee.length;ie++){var ge=ee[ie];for(He=ge;He!==null;){var ke=He;switch(ke.tag){case 0:case 11:case 15:Il(8,ke,D)}var Ne=ke.child;if(Ne!==null)Ne.return=ke,He=Ne;else for(;He!==null;){ke=He;var Se=ke.sibling,$e=ke.return;if(Dv(ke),ke===ge){He=null;break}if(Se!==null){Se.return=$e,He=Se;break}He=$e}}}var We=D.alternate;if(We!==null){var Ye=We.child;if(Ye!==null){We.child=null;do{var gr=Ye.sibling;Ye.sibling=null,Ye=gr}while(Ye!==null)}}He=D}}if((D.subtreeFlags&2064)!==0&&V!==null)V.return=D,He=V;else e:for(;He!==null;){if(D=He,(D.flags&2048)!==0)switch(D.tag){case 0:case 11:case 15:Il(9,D,D.return)}var he=D.sibling;if(he!==null){he.return=D.return,He=he;break e}He=D.return}}var oe=i.current;for(He=oe;He!==null;){V=He;var pe=V.child;if((V.subtreeFlags&2064)!==0&&pe!==null)pe.return=V,He=pe;else e:for(V=oe;He!==null;){if(ee=He,(ee.flags&2048)!==0)try{switch(ee.tag){case 0:case 11:case 15:jd(9,ee)}}catch(Xe){fr(ee,ee.return,Xe)}if(ee===V){He=null;break e}var Re=ee.sibling;if(Re!==null){Re.return=ee.return,He=Re;break e}He=ee.return}}if(At=T,Ai(),fs&&typeof fs.onPostCommitFiberRoot=="function")try{fs.onPostCommitFiberRoot(Zn,i)}catch{}S=!0}return S}finally{Pt=p,rn.transition=a}}return!1}function Jv(i,a,p){a=pa(p,a),a=mv(i,a,1),i=Ri(i,a,1),a=ps(),i!==null&&(Rn(i,1,a),Ns(i,a))}function fr(i,a,p){if(i.tag===3)Jv(i,i,p);else for(;a!==null;){if(a.tag===3){Jv(a,i,p);break}else if(a.tag===1){var S=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof S.componentDidCatch=="function"&&(Di===null||!Di.has(S))){i=pa(p,i),i=pv(a,i,1),a=Ri(a,i,1),i=ps(),a!==null&&(Rn(a,1,i),Ns(a,i));break}}a=a.return}}function $E(i,a,p){var S=i.pingCache;S!==null&&S.delete(a),a=ps(),i.pingedLanes|=i.suspendedLanes&p,Or===i&&(Gr&p)===p&&(Nr===4||Nr===3&&(Gr&130023424)===Gr&&500>Xt()-zf?wo(i,0):$f|=p),Ns(i,a)}function Xv(i,a){a===0&&((i.mode&1)===0?a=1:(a=$t,$t<<=1,($t&130023424)===0&&($t=4194304)));var p=ps();i=oi(i,a),i!==null&&(Rn(i,a,p),Ns(i,p))}function zE(i){var a=i.memoizedState,p=0;a!==null&&(p=a.retryLane),Xv(i,p)}function HE(i,a){var p=0;switch(i.tag){case 13:var S=i.stateNode,T=i.memoizedState;T!==null&&(p=T.retryLane);break;case 19:S=i.stateNode;break;default:throw Error(s(314))}S!==null&&S.delete(a),Xv(i,p)}var Qv;Qv=function(i,a,p){if(i!==null)if(i.memoizedProps!==a.pendingProps||Cs.current)ks=!0;else{if((i.lanes&p)===0&&(a.flags&128)===0)return ks=!1,PE(i,a,p);ks=(i.flags&131072)!==0}else ks=!1,nr&&(a.flags&1048576)!==0&&T0(a,cd,a.index);switch(a.lanes=0,a.tag){case 2:var S=a.type;Sd(i,a),i=a.pendingProps;var T=aa(a,ss.current);fa(a,p),T=vf(null,a,S,i,T,p);var D=yf();return a.flags|=1,typeof T=="object"&&T!==null&&typeof T.render=="function"&&T.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Ss(S)?(D=!0,od(a)):D=!1,a.memoizedState=T.state!==null&&T.state!==void 0?T.state:null,uf(a),T.updater=_d,a.stateNode=T,T._reactInternals=a,kf(a,S,i,p),a=Pf(null,a,S,!0,D,p)):(a.tag=0,nr&&D&&ef(a),ms(null,a,T,p),a=a.child),a;case 16:S=a.elementType;e:{switch(Sd(i,a),i=a.pendingProps,T=S._init,S=T(S._payload),a.type=S,T=a.tag=VE(S),i=bn(S,i),T){case 0:a=Ef(null,a,S,i,p);break e;case 1:a=Sv(null,a,S,i,p);break e;case 11:a=yv(null,a,S,i,p);break e;case 14:a=bv(null,a,S,bn(S.type,i),p);break e}throw Error(s(306,S,""))}return a;case 0:return S=a.type,T=a.pendingProps,T=a.elementType===S?T:bn(S,T),Ef(i,a,S,T,p);case 1:return S=a.type,T=a.pendingProps,T=a.elementType===S?T:bn(S,T),Sv(i,a,S,T,p);case 3:e:{if(kv(a),i===null)throw Error(s(387));S=a.pendingProps,D=a.memoizedState,T=D.element,$0(i,a),pd(a,S,null,p);var V=a.memoizedState;if(S=V.element,D.isDehydrated)if(D={element:S,isDehydrated:!1,cache:V.cache,pendingSuspenseBoundaries:V.pendingSuspenseBoundaries,transitions:V.transitions},a.updateQueue.baseState=D,a.memoizedState=D,a.flags&256){T=pa(Error(s(423)),a),a=jv(i,a,S,p,T);break e}else if(S!==T){T=pa(Error(s(424)),a),a=jv(i,a,S,p,T);break e}else for($s=Ni(a.stateNode.containerInfo.firstChild),Bs=a,nr=!0,yn=null,p=F0(a,null,S,p),a.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(da(),S===T){a=li(i,a,p);break e}ms(i,a,S,p)}a=a.child}return a;case 5:return W0(a),i===null&&sf(a),S=a.type,T=a.pendingProps,D=i!==null?i.memoizedProps:null,V=T.children,Kh(S,T)?V=null:D!==null&&Kh(S,D)&&(a.flags|=32),Cv(i,a),ms(i,a,V,p),a.child;case 6:return i===null&&sf(a),null;case 13:return Nv(i,a,p);case 4:return hf(a,a.stateNode.containerInfo),S=a.pendingProps,i===null?a.child=ua(a,null,S,p):ms(i,a,S,p),a.child;case 11:return S=a.type,T=a.pendingProps,T=a.elementType===S?T:bn(S,T),yv(i,a,S,T,p);case 7:return ms(i,a,a.pendingProps,p),a.child;case 8:return ms(i,a,a.pendingProps.children,p),a.child;case 12:return ms(i,a,a.pendingProps.children,p),a.child;case 10:e:{if(S=a.type._context,T=a.pendingProps,D=a.memoizedProps,V=T.value,Gt(hd,S._currentValue),S._currentValue=V,D!==null)if(vn(D.value,V)){if(D.children===T.children&&!Cs.current){a=li(i,a,p);break e}}else for(D=a.child,D!==null&&(D.return=a);D!==null;){var ee=D.dependencies;if(ee!==null){V=D.child;for(var ie=ee.firstContext;ie!==null;){if(ie.context===S){if(D.tag===1){ie=ai(-1,p&-p),ie.tag=2;var ge=D.updateQueue;if(ge!==null){ge=ge.shared;var ke=ge.pending;ke===null?ie.next=ie:(ie.next=ke.next,ke.next=ie),ge.pending=ie}}D.lanes|=p,ie=D.alternate,ie!==null&&(ie.lanes|=p),cf(D.return,p,a),ee.lanes|=p;break}ie=ie.next}}else if(D.tag===10)V=D.type===a.type?null:D.child;else if(D.tag===18){if(V=D.return,V===null)throw Error(s(341));V.lanes|=p,ee=V.alternate,ee!==null&&(ee.lanes|=p),cf(V,p,a),V=D.sibling}else V=D.child;if(V!==null)V.return=D;else for(V=D;V!==null;){if(V===a){V=null;break}if(D=V.sibling,D!==null){D.return=V.return,V=D;break}V=V.return}D=V}ms(i,a,T.children,p),a=a.child}return a;case 9:return T=a.type,S=a.pendingProps.children,fa(a,p),T=en(T),S=S(T),a.flags|=1,ms(i,a,S,p),a.child;case 14:return S=a.type,T=bn(S,a.pendingProps),T=bn(S.type,T),bv(i,a,S,T,p);case 15:return wv(i,a,a.type,a.pendingProps,p);case 17:return S=a.type,T=a.pendingProps,T=a.elementType===S?T:bn(S,T),Sd(i,a),a.tag=1,Ss(S)?(i=!0,od(a)):i=!1,fa(a,p),hv(a,S,T),kf(a,S,T,p),Pf(null,a,S,!0,i,p);case 19:return Pv(i,a,p);case 22:return _v(i,a,p)}throw Error(s(156,a.tag))};function Zv(i,a){return Uo(i,a)}function WE(i,a,p,S){this.tag=i,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sn(i,a,p,S){return new WE(i,a,p,S)}function Yf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function VE(i){if(typeof i=="function")return Yf(i)?1:0;if(i!=null){if(i=i.$$typeof,i===B)return 11;if(i===H)return 14}return 2}function Fi(i,a){var p=i.alternate;return p===null?(p=sn(i.tag,a,i.key,i.mode),p.elementType=i.elementType,p.type=i.type,p.stateNode=i.stateNode,p.alternate=i,i.alternate=p):(p.pendingProps=a,p.type=i.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=i.flags&14680064,p.childLanes=i.childLanes,p.lanes=i.lanes,p.child=i.child,p.memoizedProps=i.memoizedProps,p.memoizedState=i.memoizedState,p.updateQueue=i.updateQueue,a=i.dependencies,p.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},p.sibling=i.sibling,p.index=i.index,p.ref=i.ref,p}function Id(i,a,p,S,T,D){var V=2;if(S=i,typeof i=="function")Yf(i)&&(V=1);else if(typeof i=="string")V=5;else e:switch(i){case A:return Co(p.children,T,D,a);case N:V=8,T|=8;break;case M:return i=sn(12,p,a,T|2),i.elementType=M,i.lanes=D,i;case z:return i=sn(13,p,a,T),i.elementType=z,i.lanes=D,i;case Y:return i=sn(19,p,a,T),i.elementType=Y,i.lanes=D,i;case X:return Ld(p,T,D,a);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case I:V=10;break e;case L:V=9;break e;case B:V=11;break e;case H:V=14;break e;case U:V=16,S=null;break e}throw Error(s(130,i==null?i:typeof i,""))}return a=sn(V,p,a,T),a.elementType=i,a.type=S,a.lanes=D,a}function Co(i,a,p,S){return i=sn(7,i,S,a),i.lanes=p,i}function Ld(i,a,p,S){return i=sn(22,i,S,a),i.elementType=X,i.lanes=p,i.stateNode={isHidden:!1},i}function Jf(i,a,p){return i=sn(6,i,null,a),i.lanes=p,i}function Xf(i,a,p){return a=sn(4,i.children!==null?i.children:[],i.key,a),a.lanes=p,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}function UE(i,a,p,S,T){this.tag=a,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xs(0),this.expirationTimes=Xs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xs(0),this.identifierPrefix=S,this.onRecoverableError=T,this.mutableSourceEagerHydrationData=null}function Qf(i,a,p,S,T,D,V,ee,ie){return i=new UE(i,a,p,ee,ie),a===1?(a=1,D===!0&&(a|=8)):a=0,D=sn(3,null,null,a),i.current=D,D.stateNode=i,D.memoizedState={element:S,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},uf(D),i}function GE(i,a,p){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:S==null?null:""+S,children:i,containerInfo:a,implementation:p}}function ey(i){if(!i)return Pi;i=i._reactInternals;e:{if(mn(i)!==i||i.tag!==1)throw Error(s(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(Ss(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(s(171))}if(i.tag===1){var p=i.type;if(Ss(p))return E0(i,p,a)}return a}function ty(i,a,p,S,T,D,V,ee,ie){return i=Qf(p,S,!0,i,T,D,V,ee,ie),i.context=ey(null),p=i.current,S=ps(),T=Li(p),D=ai(S,T),D.callback=a??null,Ri(p,D,T),i.current.lanes=T,Rn(i,T,S),Ns(i,S),i}function Od(i,a,p,S){var T=a.current,D=ps(),V=Li(T);return p=ey(p),a.context===null?a.context=p:a.pendingContext=p,a=ai(D,V),a.payload={element:i},S=S===void 0?null:S,S!==null&&(a.callback=S),i=Ri(T,a,V),i!==null&&(Cn(i,T,V,D),md(i,T,V)),V}function Fd(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function ry(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var p=i.retryLane;i.retryLane=p!==0&&p<a?p:a}}function Zf(i,a){ry(i,a),(i=i.alternate)&&ry(i,a)}function qE(){return null}var sy=typeof reportError=="function"?reportError:function(i){console.error(i)};function em(i){this._internalRoot=i}Bd.prototype.render=em.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(s(409));Od(i,a,null,null)},Bd.prototype.unmount=em.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;bo(function(){Od(null,i,null,null)}),a[ri]=null}};function Bd(i){this._internalRoot=i}Bd.prototype.unstable_scheduleHydration=function(i){if(i){var a=hl();i={blockedOn:null,target:i,priority:a};for(var p=0;p<Rt.length&&a!==0&&a<Rt[p].priority;p++);Rt.splice(p,0,i),p===0&&Ir(i)}};function tm(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function $d(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function ny(){}function KE(i,a,p,S,T){if(T){if(typeof S=="function"){var D=S;S=function(){var ge=Fd(V);D.call(ge)}}var V=ty(a,S,i,0,null,!1,!1,"",ny);return i._reactRootContainer=V,i[ri]=V.current,_l(i.nodeType===8?i.parentNode:i),bo(),V}for(;T=i.lastChild;)i.removeChild(T);if(typeof S=="function"){var ee=S;S=function(){var ge=Fd(ie);ee.call(ge)}}var ie=Qf(i,0,!1,null,null,!1,!1,"",ny);return i._reactRootContainer=ie,i[ri]=ie.current,_l(i.nodeType===8?i.parentNode:i),bo(function(){Od(a,ie,p,S)}),ie}function zd(i,a,p,S,T){var D=p._reactRootContainer;if(D){var V=D;if(typeof T=="function"){var ee=T;T=function(){var ie=Fd(V);ee.call(ie)}}Od(a,V,i,T)}else V=KE(p,a,i,T,S);return Fd(V)}dl=function(i){switch(i.tag){case 3:var a=i.stateNode;if(a.current.memoizedState.isDehydrated){var p=jt(a.pendingLanes);p!==0&&(Yo(a,p|1),Ns(a,Xt()),(At&6)===0&&(va=Xt()+500,Ai()))}break;case 13:bo(function(){var S=oi(i,1);if(S!==null){var T=ps();Cn(S,i,1,T)}}),Zf(i,1)}},Jo=function(i){if(i.tag===13){var a=oi(i,134217728);if(a!==null){var p=ps();Cn(a,i,134217728,p)}Zf(i,134217728)}},ul=function(i){if(i.tag===13){var a=Li(i),p=oi(i,a);if(p!==null){var S=ps();Cn(p,i,a,S)}Zf(i,a)}},hl=function(){return Pt},fl=function(i,a){var p=Pt;try{return Pt=i,a()}finally{Pt=p}},us=function(i,a,p){switch(a){case"input":if(be(i,p),a=p.name,p.type==="radio"&&a!=null){for(p=i;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<p.length;a++){var S=p[a];if(S!==i&&S.form===i.form){var T=nd(S);if(!T)throw Error(s(90));le(S),be(S,T)}}}break;case"textarea":_e(i,p);break;case"select":a=p.value,a!=null&&je(i,!!p.multiple,a,!1)}},rr=Gf,ar=bo;var YE={usingClientEntryPoint:!1,Events:[kl,ia,nd,it,zt,Gf]},Bl={findFiberByHostInstance:ho,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},JE={bundleType:Bl.bundleType,version:Bl.version,rendererPackageName:Bl.rendererPackageName,rendererConfig:Bl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:k.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Vo(i),i===null?null:i.stateNode},findFiberByHostInstance:Bl.findFiberByHostInstance||qE,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 Hd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hd.isDisabled&&Hd.supportsFiber)try{Zn=Hd.inject(JE),fs=Hd}catch{}}return Es.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=YE,Es.createPortal=function(i,a){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tm(a))throw Error(s(200));return GE(i,a,null,p)},Es.createRoot=function(i,a){if(!tm(i))throw Error(s(299));var p=!1,S="",T=sy;return a!=null&&(a.unstable_strictMode===!0&&(p=!0),a.identifierPrefix!==void 0&&(S=a.identifierPrefix),a.onRecoverableError!==void 0&&(T=a.onRecoverableError)),a=Qf(i,1,!1,null,null,p,!1,S,T),i[ri]=a.current,_l(i.nodeType===8?i.parentNode:i),new em(a)},Es.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=Vo(a),i=i===null?null:i.stateNode,i},Es.flushSync=function(i){return bo(i)},Es.hydrate=function(i,a,p){if(!$d(a))throw Error(s(200));return zd(null,i,a,!0,p)},Es.hydrateRoot=function(i,a,p){if(!tm(i))throw Error(s(405));var S=p!=null&&p.hydratedSources||null,T=!1,D="",V=sy;if(p!=null&&(p.unstable_strictMode===!0&&(T=!0),p.identifierPrefix!==void 0&&(D=p.identifierPrefix),p.onRecoverableError!==void 0&&(V=p.onRecoverableError)),a=ty(a,null,i,1,p??null,T,!1,D,V),i[ri]=a.current,_l(i),S)for(i=0;i<S.length;i++)p=S[i],T=p._getVersion,T=T(p._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[p,T]:a.mutableSourceEagerHydrationData.push(p,T);return new Bd(a)},Es.render=function(i,a,p){if(!$d(a))throw Error(s(200));return zd(null,i,a,!1,p)},Es.unmountComponentAtNode=function(i){if(!$d(i))throw Error(s(40));return i._reactRootContainer?(bo(function(){zd(null,null,i,!1,function(){i._reactRootContainer=null,i[ri]=null})}),!0):!1},Es.unstable_batchedUpdates=Gf,Es.unstable_renderSubtreeIntoContainer=function(i,a,p,S){if(!$d(p))throw Error(s(200));if(i==null||i._reactInternals===void 0)throw Error(s(38));return zd(i,a,p,!1,S)},Es.version="18.3.1-next-f1338f8080-20240426",Es}var hy;function w_(){if(hy)return nm.exports;hy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),nm.exports=nP(),nm.exports}var fy;function iP(){if(fy)return Wd;fy=1;var e=w_();return Wd.createRoot=e.createRoot,Wd.hydrateRoot=e.hydrateRoot,Wd}var oP=iP();const aP=wc(oP);var _c=w_();const __=wc(_c);function lP(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}const cP=e=>{switch(e){case"success":return hP;case"info":return mP;case"warning":return fP;case"error":return pP;default:return null}},dP=Array(12).fill(0),uP=({visible:e,className:t})=>Pe.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Pe.createElement("div",{className:"sonner-spinner"},dP.map((s,n)=>Pe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),hP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Pe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),fP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Pe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),mP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),pP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),gP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Pe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Pe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),xP=()=>{const[e,t]=Pe.useState(document.hidden);return Pe.useEffect(()=>{const s=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),e};let Zm=1;class vP{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const s=this.subscribers.indexOf(t);this.subscribers.splice(s,1)}),this.publish=t=>{this.subscribers.forEach(s=>s(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var s;const{message:n,...o}=t,c=typeof(t==null?void 0:t.id)=="number"||((s=t.id)==null?void 0:s.length)>0?t.id:Zm++,u=this.toasts.find(d=>d.id===c),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(c)&&this.dismissedToasts.delete(c),u?this.toasts=this.toasts.map(d=>d.id===c?(this.publish({...d,...t,id:c,title:n}),{...d,...t,id:c,dismissible:l,title:n}):d):this.addToast({title:n,...o,dismissible:l,id:c}),c},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(s=>s({id:t,dismiss:!0})))):this.toasts.forEach(s=>{this.subscribers.forEach(n=>n({id:s.id,dismiss:!0}))}),t),this.message=(t,s)=>this.create({...s,message:t}),this.error=(t,s)=>this.create({...s,message:t,type:"error"}),this.success=(t,s)=>this.create({...s,type:"success",message:t}),this.info=(t,s)=>this.create({...s,type:"info",message:t}),this.warning=(t,s)=>this.create({...s,type:"warning",message:t}),this.loading=(t,s)=>this.create({...s,type:"loading",message:t}),this.promise=(t,s)=>{if(!s)return;let n;s.loading!==void 0&&(n=this.create({...s,promise:t,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let c=n!==void 0,u;const l=o.then(async f=>{if(u=["resolve",f],Pe.isValidElement(f))c=!1,this.create({id:n,type:"default",message:f});else if(bP(f)&&!f.ok){c=!1;const h=typeof s.error=="function"?await s.error(`HTTP error! status: ${f.status}`):s.error,x=typeof s.description=="function"?await s.description(`HTTP error! status: ${f.status}`):s.description,j=typeof h=="object"&&!Pe.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:x,...j})}else if(f instanceof Error){c=!1;const h=typeof s.error=="function"?await s.error(f):s.error,x=typeof s.description=="function"?await s.description(f):s.description,j=typeof h=="object"&&!Pe.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:x,...j})}else if(s.success!==void 0){c=!1;const h=typeof s.success=="function"?await s.success(f):s.success,x=typeof s.description=="function"?await s.description(f):s.description,j=typeof h=="object"&&!Pe.isValidElement(h)?h:{message:h};this.create({id:n,type:"success",description:x,...j})}}).catch(async f=>{if(u=["reject",f],s.error!==void 0){c=!1;const m=typeof s.error=="function"?await s.error(f):s.error,h=typeof s.description=="function"?await s.description(f):s.description,w=typeof m=="object"&&!Pe.isValidElement(m)?m:{message:m};this.create({id:n,type:"error",description:h,...w})}}).finally(()=>{c&&(this.dismiss(n),n=void 0),s.finally==null||s.finally.call(s)}),d=()=>new Promise((f,m)=>l.then(()=>u[0]==="reject"?m(u[1]):f(u[1])).catch(m));return typeof n!="string"&&typeof n!="number"?{unwrap:d}:Object.assign(n,{unwrap:d})},this.custom=(t,s)=>{const n=(s==null?void 0:s.id)||Zm++;return this.create({jsx:t(n),id:n,...s}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const As=new vP,yP=(e,t)=>{const s=(t==null?void 0:t.id)||Zm++;return As.addToast({title:e,...t,id:s}),s},bP=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",wP=yP,_P=()=>As.toasts,CP=()=>As.getActiveToasts(),K=Object.assign(wP,{success:As.success,info:As.info,warning:As.warning,error:As.error,custom:As.custom,message:As.message,promise:As.promise,dismiss:As.dismiss,loading:As.loading},{getHistory:_P,getToasts:CP});lP("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Vd(e){return e.label!==void 0}const SP=3,kP="24px",jP="16px",my=4e3,NP=356,EP=14,PP=45,AP=200;function On(...e){return e.filter(Boolean).join(" ")}function TP(e){const[t,s]=e.split("-"),n=[];return t&&n.push(t),s&&n.push(s),n}const RP=e=>{var t,s,n,o,c,u,l,d,f;const{invert:m,toast:h,unstyled:x,interacting:w,setHeights:j,visibleToasts:C,heights:v,index:y,toasts:g,expanded:b,removeToast:k,defaultRichColors:E,closeButton:P,style:A,cancelButtonStyle:N,actionButtonStyle:M,className:I="",descriptionClassName:L="",duration:B,position:z,gap:Y,expandByDefault:H,classNames:U,icons:X,closeButtonAriaLabel:q="Close toast"}=e,[O,R]=Pe.useState(null),[$,G]=Pe.useState(null),[F,te]=Pe.useState(!1),[ce,fe]=Pe.useState(!1),[J,W]=Pe.useState(!1),[ae,ne]=Pe.useState(!1),[Z,le]=Pe.useState(!1),[Ce,Le]=Pe.useState(0),[Ge,me]=Pe.useState(0),be=Pe.useRef(h.duration||B||my),Be=Pe.useRef(null),Ke=Pe.useRef(null),Qe=y===0,je=y+1<=C,we=h.type,ve=h.dismissible!==!1,_e=h.className||"",Oe=h.descriptionClassName||"",de=Pe.useMemo(()=>v.findIndex(it=>it.toastId===h.id)||0,[v,h.id]),ye=Pe.useMemo(()=>{var it;return(it=h.closeButton)!=null?it:P},[h.closeButton,P]),De=Pe.useMemo(()=>h.duration||B||my,[h.duration,B]),ze=Pe.useRef(0),Je=Pe.useRef(0),Et=Pe.useRef(0),at=Pe.useRef(null),[ur,Rr]=z.split("-"),Wr=Pe.useMemo(()=>v.reduce((it,zt,rr)=>rr>=de?it:it+zt.height,0),[v,de]),Jt=xP(),Cr=h.invert||m,Wt=we==="loading";Je.current=Pe.useMemo(()=>de*Y+Wr,[de,Wr]),Pe.useEffect(()=>{be.current=De},[De]),Pe.useEffect(()=>{te(!0)},[]),Pe.useEffect(()=>{const it=Ke.current;if(it){const zt=it.getBoundingClientRect().height;return me(zt),j(rr=>[{toastId:h.id,height:zt,position:h.position},...rr]),()=>j(rr=>rr.filter(ar=>ar.toastId!==h.id))}},[j,h.id]),Pe.useLayoutEffect(()=>{if(!F)return;const it=Ke.current,zt=it.style.height;it.style.height="auto";const rr=it.getBoundingClientRect().height;it.style.height=zt,me(rr),j(ar=>ar.find(Vt=>Vt.toastId===h.id)?ar.map(Vt=>Vt.toastId===h.id?{...Vt,height:rr}:Vt):[{toastId:h.id,height:rr,position:h.position},...ar])},[F,h.title,h.description,j,h.id,h.jsx,h.action,h.cancel]);const yr=Pe.useCallback(()=>{fe(!0),Le(Je.current),j(it=>it.filter(zt=>zt.toastId!==h.id)),setTimeout(()=>{k(h)},AP)},[h,k,j,Je]);Pe.useEffect(()=>{if(h.promise&&we==="loading"||h.duration===1/0||h.type==="loading")return;let it;return b||w||Jt?(()=>{if(Et.current<ze.current){const ar=new Date().getTime()-ze.current;be.current=be.current-ar}Et.current=new Date().getTime()})():(()=>{be.current!==1/0&&(ze.current=new Date().getTime(),it=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),yr()},be.current))})(),()=>clearTimeout(it)},[b,w,h,we,Jt,yr]),Pe.useEffect(()=>{h.delete&&(yr(),h.onDismiss==null||h.onDismiss.call(h,h))},[yr,h.delete]);function us(){var it;if(X!=null&&X.loading){var zt;return Pe.createElement("div",{className:On(U==null?void 0:U.loader,h==null||(zt=h.classNames)==null?void 0:zt.loader,"sonner-loader"),"data-visible":we==="loading"},X.loading)}return Pe.createElement(uP,{className:On(U==null?void 0:U.loader,h==null||(it=h.classNames)==null?void 0:it.loader),visible:we==="loading"})}const Xr=h.icon||(X==null?void 0:X[we])||cP(we);var Ls,Os;return Pe.createElement("li",{tabIndex:0,ref:Ke,className:On(I,_e,U==null?void 0:U.toast,h==null||(t=h.classNames)==null?void 0:t.toast,U==null?void 0:U.default,U==null?void 0:U[we],h==null||(s=h.classNames)==null?void 0:s[we]),"data-sonner-toast":"","data-rich-colors":(Ls=h.richColors)!=null?Ls:E,"data-styled":!(h.jsx||h.unstyled||x),"data-mounted":F,"data-promise":!!h.promise,"data-swiped":Z,"data-removed":ce,"data-visible":je,"data-y-position":ur,"data-x-position":Rr,"data-index":y,"data-front":Qe,"data-swiping":J,"data-dismissible":ve,"data-type":we,"data-invert":Cr,"data-swipe-out":ae,"data-swipe-direction":$,"data-expanded":!!(b||H&&F),"data-testid":h.testId,style:{"--index":y,"--toasts-before":y,"--z-index":g.length-y,"--offset":`${ce?Ce:Je.current}px`,"--initial-height":H?"auto":`${Ge}px`,...A,...h.style},onDragEnd:()=>{W(!1),R(null),at.current=null},onPointerDown:it=>{it.button!==2&&(Wt||!ve||(Be.current=new Date,Le(Je.current),it.target.setPointerCapture(it.pointerId),it.target.tagName!=="BUTTON"&&(W(!0),at.current={x:it.clientX,y:it.clientY})))},onPointerUp:()=>{var it,zt,rr;if(ae||!ve)return;at.current=null;const ar=Number(((it=Ke.current)==null?void 0:it.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ws=Number(((zt=Ke.current)==null?void 0:zt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Vt=new Date().getTime()-((rr=Be.current)==null?void 0:rr.getTime()),Ut=O==="x"?ar:ws,Vr=Math.abs(Ut)/Vt;if(Math.abs(Ut)>=PP||Vr>.11){Le(Je.current),h.onDismiss==null||h.onDismiss.call(h,h),G(O==="x"?ar>0?"right":"left":ws>0?"down":"up"),yr(),ne(!0);return}else{var ut,hr;(ut=Ke.current)==null||ut.style.setProperty("--swipe-amount-x","0px"),(hr=Ke.current)==null||hr.style.setProperty("--swipe-amount-y","0px")}le(!1),W(!1),R(null)},onPointerMove:it=>{var zt,rr,ar;if(!at.current||!ve||((zt=window.getSelection())==null?void 0:zt.toString().length)>0)return;const Vt=it.clientY-at.current.y,Ut=it.clientX-at.current.x;var Vr;const ut=(Vr=e.swipeDirections)!=null?Vr:TP(z);!O&&(Math.abs(Ut)>1||Math.abs(Vt)>1)&&R(Math.abs(Ut)>Math.abs(Vt)?"x":"y");let hr={x:0,y:0};const hs=Qr=>1/(1.5+Math.abs(Qr)/20);if(O==="y"){if(ut.includes("top")||ut.includes("bottom"))if(ut.includes("top")&&Vt<0||ut.includes("bottom")&&Vt>0)hr.y=Vt;else{const Qr=Vt*hs(Vt);hr.y=Math.abs(Qr)<Math.abs(Vt)?Qr:Vt}}else if(O==="x"&&(ut.includes("left")||ut.includes("right")))if(ut.includes("left")&&Ut<0||ut.includes("right")&&Ut>0)hr.x=Ut;else{const Qr=Ut*hs(Ut);hr.x=Math.abs(Qr)<Math.abs(Ut)?Qr:Ut}(Math.abs(hr.x)>0||Math.abs(hr.y)>0)&&le(!0),(rr=Ke.current)==null||rr.style.setProperty("--swipe-amount-x",`${hr.x}px`),(ar=Ke.current)==null||ar.style.setProperty("--swipe-amount-y",`${hr.y}px`)}},ye&&!h.jsx&&we!=="loading"?Pe.createElement("button",{"aria-label":q,"data-disabled":Wt,"data-close-button":!0,onClick:Wt||!ve?()=>{}:()=>{yr(),h.onDismiss==null||h.onDismiss.call(h,h)},className:On(U==null?void 0:U.closeButton,h==null||(n=h.classNames)==null?void 0:n.closeButton)},(Os=X==null?void 0:X.close)!=null?Os:gP):null,(we||h.icon||h.promise)&&h.icon!==null&&((X==null?void 0:X[we])!==null||h.icon)?Pe.createElement("div",{"data-icon":"",className:On(U==null?void 0:U.icon,h==null||(o=h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||us():null,h.type!=="loading"?Xr:null):null,Pe.createElement("div",{"data-content":"",className:On(U==null?void 0:U.content,h==null||(c=h.classNames)==null?void 0:c.content)},Pe.createElement("div",{"data-title":"",className:On(U==null?void 0:U.title,h==null||(u=h.classNames)==null?void 0:u.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?Pe.createElement("div",{"data-description":"",className:On(L,Oe,U==null?void 0:U.description,h==null||(l=h.classNames)==null?void 0:l.description)},typeof h.description=="function"?h.description():h.description):null),Pe.isValidElement(h.cancel)?h.cancel:h.cancel&&Vd(h.cancel)?Pe.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||N,onClick:it=>{Vd(h.cancel)&&ve&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,it),yr())},className:On(U==null?void 0:U.cancelButton,h==null||(d=h.classNames)==null?void 0:d.cancelButton)},h.cancel.label):null,Pe.isValidElement(h.action)?h.action:h.action&&Vd(h.action)?Pe.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||M,onClick:it=>{Vd(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,it),!it.defaultPrevented&&yr())},className:On(U==null?void 0:U.actionButton,h==null||(f=h.classNames)==null?void 0:f.actionButton)},h.action.label):null)};function py(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function MP(e,t){const s={};return[e,t].forEach((n,o)=>{const c=o===1,u=c?"--mobile-offset":"--offset",l=c?jP:kP;function d(f){["top","right","bottom","left"].forEach(m=>{s[`${u}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof n=="number"||typeof n=="string"?d(n):typeof n=="object"?["top","right","bottom","left"].forEach(f=>{n[f]===void 0?s[`${u}-${f}`]=l:s[`${u}-${f}`]=typeof n[f]=="number"?`${n[f]}px`:n[f]}):d(l)}),s}const DP=Pe.forwardRef(function(t,s){const{id:n,invert:o,position:c="bottom-right",hotkey:u=["altKey","KeyT"],expand:l,closeButton:d,className:f,offset:m,mobileOffset:h,theme:x="light",richColors:w,duration:j,style:C,visibleToasts:v=SP,toastOptions:y,dir:g=py(),gap:b=EP,icons:k,containerAriaLabel:E="Notifications"}=t,[P,A]=Pe.useState([]),N=Pe.useMemo(()=>n?P.filter(F=>F.toasterId===n):P.filter(F=>!F.toasterId),[P,n]),M=Pe.useMemo(()=>Array.from(new Set([c].concat(N.filter(F=>F.position).map(F=>F.position)))),[N,c]),[I,L]=Pe.useState([]),[B,z]=Pe.useState(!1),[Y,H]=Pe.useState(!1),[U,X]=Pe.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=Pe.useRef(null),O=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=Pe.useRef(null),$=Pe.useRef(!1),G=Pe.useCallback(F=>{A(te=>{var ce;return(ce=te.find(fe=>fe.id===F.id))!=null&&ce.delete||As.dismiss(F.id),te.filter(({id:fe})=>fe!==F.id)})},[]);return Pe.useEffect(()=>As.subscribe(F=>{if(F.dismiss){requestAnimationFrame(()=>{A(te=>te.map(ce=>ce.id===F.id?{...ce,delete:!0}:ce))});return}setTimeout(()=>{__.flushSync(()=>{A(te=>{const ce=te.findIndex(fe=>fe.id===F.id);return ce!==-1?[...te.slice(0,ce),{...te[ce],...F},...te.slice(ce+1)]:[F,...te]})})})}),[P]),Pe.useEffect(()=>{if(x!=="system"){X(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?X("dark"):X("light")),typeof window>"u")return;const F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:te})=>{X(te?"dark":"light")})}catch{F.addListener(({matches:ce})=>{try{X(ce?"dark":"light")}catch(fe){console.error(fe)}})}},[x]),Pe.useEffect(()=>{P.length<=1&&z(!1)},[P]),Pe.useEffect(()=>{const F=te=>{var ce;if(u.every(W=>te[W]||te.code===W)){var J;z(!0),(J=q.current)==null||J.focus()}te.code==="Escape"&&(document.activeElement===q.current||(ce=q.current)!=null&&ce.contains(document.activeElement))&&z(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[u]),Pe.useEffect(()=>{if(q.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,$.current=!1)}},[q.current]),Pe.createElement("section",{ref:s,"aria-label":`${E} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((F,te)=>{var ce;const[fe,J]=F.split("-");return N.length?Pe.createElement("ol",{key:F,dir:g==="auto"?py():g,tabIndex:-1,ref:q,className:f,"data-sonner-toaster":!0,"data-sonner-theme":U,"data-y-position":fe,"data-x-position":J,style:{"--front-toast-height":`${((ce=I[0])==null?void 0:ce.height)||0}px`,"--width":`${NP}px`,"--gap":`${b}px`,...C,...MP(m,h)},onBlur:W=>{$.current&&!W.currentTarget.contains(W.relatedTarget)&&($.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||$.current||($.current=!0,R.current=W.relatedTarget)},onMouseEnter:()=>z(!0),onMouseMove:()=>z(!0),onMouseLeave:()=>{Y||z(!1)},onDragEnd:()=>z(!1),onPointerDown:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},N.filter(W=>!W.position&&te===0||W.position===F).map((W,ae)=>{var ne,Z;return Pe.createElement(RP,{key:W.id,icons:k,index:ae,toast:W,defaultRichColors:w,duration:(ne=y==null?void 0:y.duration)!=null?ne:j,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:o,visibleToasts:v,closeButton:(Z=y==null?void 0:y.closeButton)!=null?Z:d,interacting:Y,position:F,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,closeButtonAriaLabel:y==null?void 0:y.closeButtonAriaLabel,removeToast:G,toasts:N.filter(le=>le.position==W.position),heights:I.filter(le=>le.position==W.position),setHeights:L,expandByDefault:l,gap:b,expanded:B,swipeDirections:t.swipeDirections})})):null}))}),Yp=_.createContext({});function Jp(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const Hu=_.createContext(null),Xp=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class IP extends _.Component{getSnapshotBeforeUpdate(t){const s=this.props.childRef.current;if(s&&t.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=s.offsetHeight||0,n.width=s.offsetWidth||0,n.top=s.offsetTop,n.left=s.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function LP({children:e,isPresent:t}){const s=_.useId(),n=_.useRef(null),o=_.useRef({width:0,height:0,top:0,left:0}),{nonce:c}=_.useContext(Xp);return _.useInsertionEffect(()=>{const{width:u,height:l,top:d,left:f}=o.current;if(t||!n.current||!u||!l)return;n.current.dataset.motionPopId=s;const m=document.createElement("style");return c&&(m.nonce=c),document.head.appendChild(m),m.sheet&&m.sheet.insertRule(`
40
+ `+D.stack}return{value:i,source:a,stack:T,digest:null}}function jf(i,a,p){return{value:i,source:null,stack:p??null,digest:a??null}}function Nf(i,a){try{console.error(a.value)}catch(p){setTimeout(function(){throw p})}}var jE=typeof WeakMap=="function"?WeakMap:Map;function mv(i,a,p){p=ai(-1,p),p.tag=3,p.payload={element:null};var S=a.value;return p.callback=function(){Pd||(Pd=!0,Hf=S),Nf(i,a)},p}function pv(i,a,p){p=ai(-1,p),p.tag=3;var S=i.type.getDerivedStateFromError;if(typeof S=="function"){var T=a.value;p.payload=function(){return S(T)},p.callback=function(){Nf(i,a)}}var D=i.stateNode;return D!==null&&typeof D.componentDidCatch=="function"&&(p.callback=function(){Nf(i,a),typeof S!="function"&&(Di===null?Di=new Set([this]):Di.add(this));var V=a.stack;this.componentDidCatch(a.value,{componentStack:V!==null?V:""})}),p}function gv(i,a,p){var S=i.pingCache;if(S===null){S=i.pingCache=new jE;var T=new Set;S.set(a,T)}else T=S.get(a),T===void 0&&(T=new Set,S.set(a,T));T.has(p)||(T.add(p),i=$E.bind(null,i,a,p),a.then(i,i))}function xv(i){do{var a;if((a=i.tag===13)&&(a=i.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return i;i=i.return}while(i!==null);return null}function vv(i,a,p,S,T){return(i.mode&1)===0?(i===a?i.flags|=65536:(i.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(a=ai(-1,1),a.tag=2,Ri(p,a,1))),p.lanes|=1),i):(i.flags|=65536,i.lanes=T,i)}var NE=k.ReactCurrentOwner,ks=!1;function ms(i,a,p,S){a.child=i===null?F0(a,null,p,S):ua(a,i.child,p,S)}function yv(i,a,p,S,T){p=p.render;var D=a.ref;return fa(a,T),S=vf(i,a,p,S,D,T),p=yf(),i!==null&&!ks?(a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~T,li(i,a,T)):(nr&&p&&ef(a),a.flags|=1,ms(i,a,S,T),a.child)}function bv(i,a,p,S,T){if(i===null){var D=p.type;return typeof D=="function"&&!Yf(D)&&D.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(a.tag=15,a.type=D,wv(i,a,D,S,T)):(i=Id(p.type,null,S,a,a.mode,T),i.ref=a.ref,i.return=a,a.child=i)}if(D=i.child,(i.lanes&T)===0){var V=D.memoizedProps;if(p=p.compare,p=p!==null?p:yl,p(V,S)&&i.ref===a.ref)return li(i,a,T)}return a.flags|=1,i=Fi(D,S),i.ref=a.ref,i.return=a,a.child=i}function wv(i,a,p,S,T){if(i!==null){var D=i.memoizedProps;if(yl(D,S)&&i.ref===a.ref)if(ks=!1,a.pendingProps=S=D,(i.lanes&T)!==0)(i.flags&131072)!==0&&(ks=!0);else return a.lanes=i.lanes,li(i,a,T)}return Ef(i,a,p,S,T)}function _v(i,a,p){var S=a.pendingProps,T=S.children,D=i!==null?i.memoizedState:null;if(S.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},Gt(xa,zs),zs|=p;else{if((p&1073741824)===0)return i=D!==null?D.baseLanes|p:p,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:i,cachePool:null,transitions:null},a.updateQueue=null,Gt(xa,zs),zs|=i,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},S=D!==null?D.baseLanes:p,Gt(xa,zs),zs|=S}else D!==null?(S=D.baseLanes|p,a.memoizedState=null):S=p,Gt(xa,zs),zs|=S;return ms(i,a,T,p),a.child}function Cv(i,a){var p=a.ref;(i===null&&p!==null||i!==null&&i.ref!==p)&&(a.flags|=512,a.flags|=2097152)}function Ef(i,a,p,S,T){var D=Ss(p)?fo:ss.current;return D=aa(a,D),fa(a,T),p=vf(i,a,p,S,D,T),S=yf(),i!==null&&!ks?(a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~T,li(i,a,T)):(nr&&S&&ef(a),a.flags|=1,ms(i,a,p,T),a.child)}function Sv(i,a,p,S,T){if(Ss(p)){var D=!0;od(a)}else D=!1;if(fa(a,T),a.stateNode===null)Sd(i,a),hv(a,p,S),kf(a,p,S,T),S=!0;else if(i===null){var V=a.stateNode,ee=a.memoizedProps;V.props=ee;var ie=V.context,ge=p.contextType;typeof ge=="object"&&ge!==null?ge=en(ge):(ge=Ss(p)?fo:ss.current,ge=aa(a,ge));var ke=p.getDerivedStateFromProps,Ne=typeof ke=="function"||typeof V.getSnapshotBeforeUpdate=="function";Ne||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(ee!==S||ie!==ge)&&fv(a,V,S,ge),Ti=!1;var Se=a.memoizedState;V.state=Se,pd(a,S,V,T),ie=a.memoizedState,ee!==S||Se!==ie||Cs.current||Ti?(typeof ke=="function"&&(Sf(a,p,ke,S),ie=a.memoizedState),(ee=Ti||uv(a,p,ee,S,Se,ie,ge))?(Ne||typeof V.UNSAFE_componentWillMount!="function"&&typeof V.componentWillMount!="function"||(typeof V.componentWillMount=="function"&&V.componentWillMount(),typeof V.UNSAFE_componentWillMount=="function"&&V.UNSAFE_componentWillMount()),typeof V.componentDidMount=="function"&&(a.flags|=4194308)):(typeof V.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=S,a.memoizedState=ie),V.props=S,V.state=ie,V.context=ge,S=ee):(typeof V.componentDidMount=="function"&&(a.flags|=4194308),S=!1)}else{V=a.stateNode,$0(i,a),ee=a.memoizedProps,ge=a.type===a.elementType?ee:bn(a.type,ee),V.props=ge,Ne=a.pendingProps,Se=V.context,ie=p.contextType,typeof ie=="object"&&ie!==null?ie=en(ie):(ie=Ss(p)?fo:ss.current,ie=aa(a,ie));var $e=p.getDerivedStateFromProps;(ke=typeof $e=="function"||typeof V.getSnapshotBeforeUpdate=="function")||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(ee!==Ne||Se!==ie)&&fv(a,V,S,ie),Ti=!1,Se=a.memoizedState,V.state=Se,pd(a,S,V,T);var We=a.memoizedState;ee!==Ne||Se!==We||Cs.current||Ti?(typeof $e=="function"&&(Sf(a,p,$e,S),We=a.memoizedState),(ge=Ti||uv(a,p,ge,S,Se,We,ie)||!1)?(ke||typeof V.UNSAFE_componentWillUpdate!="function"&&typeof V.componentWillUpdate!="function"||(typeof V.componentWillUpdate=="function"&&V.componentWillUpdate(S,We,ie),typeof V.UNSAFE_componentWillUpdate=="function"&&V.UNSAFE_componentWillUpdate(S,We,ie)),typeof V.componentDidUpdate=="function"&&(a.flags|=4),typeof V.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof V.componentDidUpdate!="function"||ee===i.memoizedProps&&Se===i.memoizedState||(a.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||ee===i.memoizedProps&&Se===i.memoizedState||(a.flags|=1024),a.memoizedProps=S,a.memoizedState=We),V.props=S,V.state=We,V.context=ie,S=ge):(typeof V.componentDidUpdate!="function"||ee===i.memoizedProps&&Se===i.memoizedState||(a.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||ee===i.memoizedProps&&Se===i.memoizedState||(a.flags|=1024),S=!1)}return Pf(i,a,p,S,D,T)}function Pf(i,a,p,S,T,D){Cv(i,a);var V=(a.flags&128)!==0;if(!S&&!V)return T&&P0(a,p,!1),li(i,a,D);S=a.stateNode,NE.current=a;var ee=V&&typeof p.getDerivedStateFromError!="function"?null:S.render();return a.flags|=1,i!==null&&V?(a.child=ua(a,i.child,null,D),a.child=ua(a,null,ee,D)):ms(i,a,ee,D),a.memoizedState=S.state,T&&P0(a,p,!0),a.child}function kv(i){var a=i.stateNode;a.pendingContext?N0(i,a.pendingContext,a.pendingContext!==a.context):a.context&&N0(i,a.context,!1),hf(i,a.containerInfo)}function jv(i,a,p,S,T){return da(),nf(T),a.flags|=256,ms(i,a,p,S),a.child}var Af={dehydrated:null,treeContext:null,retryLane:0};function Tf(i){return{baseLanes:i,cachePool:null,transitions:null}}function Nv(i,a,p){var S=a.pendingProps,T=lr.current,D=!1,V=(a.flags&128)!==0,ee;if((ee=V)||(ee=i!==null&&i.memoizedState===null?!1:(T&2)!==0),ee?(D=!0,a.flags&=-129):(i===null||i.memoizedState!==null)&&(T|=1),Gt(lr,T&1),i===null)return sf(a),i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((a.mode&1)===0?a.lanes=1:i.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(V=S.children,i=S.fallback,D?(S=a.mode,D=a.child,V={mode:"hidden",children:V},(S&1)===0&&D!==null?(D.childLanes=0,D.pendingProps=V):D=Ld(V,S,0,null),i=Co(i,S,p,null),D.return=a,i.return=a,D.sibling=i,a.child=D,a.child.memoizedState=Tf(p),a.memoizedState=Af,i):Rf(a,V));if(T=i.memoizedState,T!==null&&(ee=T.dehydrated,ee!==null))return EE(i,a,V,S,ee,T,p);if(D){D=S.fallback,V=a.mode,T=i.child,ee=T.sibling;var ie={mode:"hidden",children:S.children};return(V&1)===0&&a.child!==T?(S=a.child,S.childLanes=0,S.pendingProps=ie,a.deletions=null):(S=Fi(T,ie),S.subtreeFlags=T.subtreeFlags&14680064),ee!==null?D=Fi(ee,D):(D=Co(D,V,p,null),D.flags|=2),D.return=a,S.return=a,S.sibling=D,a.child=S,S=D,D=a.child,V=i.child.memoizedState,V=V===null?Tf(p):{baseLanes:V.baseLanes|p,cachePool:null,transitions:V.transitions},D.memoizedState=V,D.childLanes=i.childLanes&~p,a.memoizedState=Af,S}return D=i.child,i=D.sibling,S=Fi(D,{mode:"visible",children:S.children}),(a.mode&1)===0&&(S.lanes=p),S.return=a,S.sibling=null,i!==null&&(p=a.deletions,p===null?(a.deletions=[i],a.flags|=16):p.push(i)),a.child=S,a.memoizedState=null,S}function Rf(i,a){return a=Ld({mode:"visible",children:a},i.mode,0,null),a.return=i,i.child=a}function Cd(i,a,p,S){return S!==null&&nf(S),ua(a,i.child,null,p),i=Rf(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function EE(i,a,p,S,T,D,V){if(p)return a.flags&256?(a.flags&=-257,S=jf(Error(s(422))),Cd(i,a,V,S)):a.memoizedState!==null?(a.child=i.child,a.flags|=128,null):(D=S.fallback,T=a.mode,S=Ld({mode:"visible",children:S.children},T,0,null),D=Co(D,T,V,null),D.flags|=2,S.return=a,D.return=a,S.sibling=D,a.child=S,(a.mode&1)!==0&&ua(a,i.child,null,V),a.child.memoizedState=Tf(V),a.memoizedState=Af,D);if((a.mode&1)===0)return Cd(i,a,V,null);if(T.data==="$!"){if(S=T.nextSibling&&T.nextSibling.dataset,S)var ee=S.dgst;return S=ee,D=Error(s(419)),S=jf(D,S,void 0),Cd(i,a,V,S)}if(ee=(V&i.childLanes)!==0,ks||ee){if(S=Or,S!==null){switch(V&-V){case 4:T=2;break;case 16:T=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:T=32;break;case 536870912:T=268435456;break;default:T=0}T=(T&(S.suspendedLanes|V))!==0?0:T,T!==0&&T!==D.retryLane&&(D.retryLane=T,oi(i,T),Cn(S,i,T,-1))}return Kf(),S=jf(Error(s(421))),Cd(i,a,V,S)}return T.data==="$?"?(a.flags|=128,a.child=i.child,a=zE.bind(null,i),T._reactRetry=a,null):(i=D.treeContext,$s=Ni(T.nextSibling),Bs=a,nr=!0,yn=null,i!==null&&(Qs[Zs++]=ni,Qs[Zs++]=ii,Qs[Zs++]=mo,ni=i.id,ii=i.overflow,mo=a),a=Rf(a,S.children),a.flags|=4096,a)}function Ev(i,a,p){i.lanes|=a;var S=i.alternate;S!==null&&(S.lanes|=a),cf(i.return,a,p)}function Mf(i,a,p,S,T){var D=i.memoizedState;D===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:S,tail:p,tailMode:T}:(D.isBackwards=a,D.rendering=null,D.renderingStartTime=0,D.last=S,D.tail=p,D.tailMode=T)}function Pv(i,a,p){var S=a.pendingProps,T=S.revealOrder,D=S.tail;if(ms(i,a,S.children,p),S=lr.current,(S&2)!==0)S=S&1|2,a.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Ev(i,p,a);else if(i.tag===19)Ev(i,p,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}S&=1}if(Gt(lr,S),(a.mode&1)===0)a.memoizedState=null;else switch(T){case"forwards":for(p=a.child,T=null;p!==null;)i=p.alternate,i!==null&&gd(i)===null&&(T=p),p=p.sibling;p=T,p===null?(T=a.child,a.child=null):(T=p.sibling,p.sibling=null),Mf(a,!1,T,p,D);break;case"backwards":for(p=null,T=a.child,a.child=null;T!==null;){if(i=T.alternate,i!==null&&gd(i)===null){a.child=T;break}i=T.sibling,T.sibling=p,p=T,T=i}Mf(a,!0,p,null,D);break;case"together":Mf(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Sd(i,a){(a.mode&1)===0&&i!==null&&(i.alternate=null,a.alternate=null,a.flags|=2)}function li(i,a,p){if(i!==null&&(a.dependencies=i.dependencies),yo|=a.lanes,(p&a.childLanes)===0)return null;if(i!==null&&a.child!==i.child)throw Error(s(153));if(a.child!==null){for(i=a.child,p=Fi(i,i.pendingProps),a.child=p,p.return=a;i.sibling!==null;)i=i.sibling,p=p.sibling=Fi(i,i.pendingProps),p.return=a;p.sibling=null}return a.child}function PE(i,a,p){switch(a.tag){case 3:kv(a),da();break;case 5:W0(a);break;case 1:Ss(a.type)&&od(a);break;case 4:hf(a,a.stateNode.containerInfo);break;case 10:var S=a.type._context,T=a.memoizedProps.value;Gt(hd,S._currentValue),S._currentValue=T;break;case 13:if(S=a.memoizedState,S!==null)return S.dehydrated!==null?(Gt(lr,lr.current&1),a.flags|=128,null):(p&a.child.childLanes)!==0?Nv(i,a,p):(Gt(lr,lr.current&1),i=li(i,a,p),i!==null?i.sibling:null);Gt(lr,lr.current&1);break;case 19:if(S=(p&a.childLanes)!==0,(i.flags&128)!==0){if(S)return Pv(i,a,p);a.flags|=128}if(T=a.memoizedState,T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),Gt(lr,lr.current),S)break;return null;case 22:case 23:return a.lanes=0,_v(i,a,p)}return li(i,a,p)}var Av,Df,Tv,Rv;Av=function(i,a){for(var p=a.child;p!==null;){if(p.tag===5||p.tag===6)i.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===a)break;for(;p.sibling===null;){if(p.return===null||p.return===a)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},Df=function(){},Tv=function(i,a,p,S){var T=i.memoizedProps;if(T!==S){i=a.stateNode,xo(Dn.current);var D=null;switch(p){case"input":T=Le(i,T),S=Le(i,S),D=[];break;case"select":T=R({},T,{value:void 0}),S=R({},S,{value:void 0}),D=[];break;case"textarea":T=we(i,T),S=we(i,S),D=[];break;default:typeof T.onClick!="function"&&typeof S.onClick=="function"&&(i.onclick=sd)}Jt(p,S);var V;p=null;for(ge in T)if(!S.hasOwnProperty(ge)&&T.hasOwnProperty(ge)&&T[ge]!=null)if(ge==="style"){var ee=T[ge];for(V in ee)ee.hasOwnProperty(V)&&(p||(p={}),p[V]="")}else ge!=="dangerouslySetInnerHTML"&&ge!=="children"&&ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&ge!=="autoFocus"&&(o.hasOwnProperty(ge)?D||(D=[]):(D=D||[]).push(ge,null));for(ge in S){var ie=S[ge];if(ee=T!=null?T[ge]:void 0,S.hasOwnProperty(ge)&&ie!==ee&&(ie!=null||ee!=null))if(ge==="style")if(ee){for(V in ee)!ee.hasOwnProperty(V)||ie&&ie.hasOwnProperty(V)||(p||(p={}),p[V]="");for(V in ie)ie.hasOwnProperty(V)&&ee[V]!==ie[V]&&(p||(p={}),p[V]=ie[V])}else p||(D||(D=[]),D.push(ge,p)),p=ie;else ge==="dangerouslySetInnerHTML"?(ie=ie?ie.__html:void 0,ee=ee?ee.__html:void 0,ie!=null&&ee!==ie&&(D=D||[]).push(ge,ie)):ge==="children"?typeof ie!="string"&&typeof ie!="number"||(D=D||[]).push(ge,""+ie):ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&(o.hasOwnProperty(ge)?(ie!=null&&ge==="onScroll"&&Qt("scroll",i),D||ee===ie||(D=[])):(D=D||[]).push(ge,ie))}p&&(D=D||[]).push("style",p);var ge=D;(a.updateQueue=ge)&&(a.flags|=4)}},Rv=function(i,a,p,S){p!==S&&(a.flags|=4)};function Dl(i,a){if(!nr)switch(i.tailMode){case"hidden":a=i.tail;for(var p=null;a!==null;)a.alternate!==null&&(p=a),a=a.sibling;p===null?i.tail=null:p.sibling=null;break;case"collapsed":p=i.tail;for(var S=null;p!==null;)p.alternate!==null&&(S=p),p=p.sibling;S===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:S.sibling=null}}function is(i){var a=i.alternate!==null&&i.alternate.child===i.child,p=0,S=0;if(a)for(var T=i.child;T!==null;)p|=T.lanes|T.childLanes,S|=T.subtreeFlags&14680064,S|=T.flags&14680064,T.return=i,T=T.sibling;else for(T=i.child;T!==null;)p|=T.lanes|T.childLanes,S|=T.subtreeFlags,S|=T.flags,T.return=i,T=T.sibling;return i.subtreeFlags|=S,i.childLanes=p,a}function AE(i,a,p){var S=a.pendingProps;switch(tf(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return is(a),null;case 1:return Ss(a.type)&&id(),is(a),null;case 3:return S=a.stateNode,ma(),Zt(Cs),Zt(ss),pf(),S.pendingContext&&(S.context=S.pendingContext,S.pendingContext=null),(i===null||i.child===null)&&(dd(a)?a.flags|=4:i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,yn!==null&&(Uf(yn),yn=null))),Df(i,a),is(a),null;case 5:ff(a);var T=xo(Pl.current);if(p=a.type,i!==null&&a.stateNode!=null)Tv(i,a,p,S,T),i.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!S){if(a.stateNode===null)throw Error(s(166));return is(a),null}if(i=xo(Dn.current),dd(a)){S=a.stateNode,p=a.type;var D=a.memoizedProps;switch(S[Mn]=a,S[Sl]=D,i=(a.mode&1)!==0,p){case"dialog":Qt("cancel",S),Qt("close",S);break;case"iframe":case"object":case"embed":Qt("load",S);break;case"video":case"audio":for(T=0;T<wl.length;T++)Qt(wl[T],S);break;case"source":Qt("error",S);break;case"img":case"image":case"link":Qt("error",S),Qt("load",S);break;case"details":Qt("toggle",S);break;case"input":Ge(S,D),Qt("invalid",S);break;case"select":S._wrapperState={wasMultiple:!!D.multiple},Qt("invalid",S);break;case"textarea":ve(S,D),Qt("invalid",S)}Jt(p,D),T=null;for(var V in D)if(D.hasOwnProperty(V)){var ee=D[V];V==="children"?typeof ee=="string"?S.textContent!==ee&&(D.suppressHydrationWarning!==!0&&rd(S.textContent,ee,i),T=["children",ee]):typeof ee=="number"&&S.textContent!==""+ee&&(D.suppressHydrationWarning!==!0&&rd(S.textContent,ee,i),T=["children",""+ee]):o.hasOwnProperty(V)&&ee!=null&&V==="onScroll"&&Qt("scroll",S)}switch(p){case"input":Z(S),Be(S,D,!0);break;case"textarea":Z(S),Oe(S);break;case"select":case"option":break;default:typeof D.onClick=="function"&&(S.onclick=sd)}S=T,a.updateQueue=S,S!==null&&(a.flags|=4)}else{V=T.nodeType===9?T:T.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=de(p)),i==="http://www.w3.org/1999/xhtml"?p==="script"?(i=V.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof S.is=="string"?i=V.createElement(p,{is:S.is}):(i=V.createElement(p),p==="select"&&(V=i,S.multiple?V.multiple=!0:S.size&&(V.size=S.size))):i=V.createElementNS(i,p),i[Mn]=a,i[Sl]=S,Av(i,a,!1,!1),a.stateNode=i;e:{switch(V=Cr(p,S),p){case"dialog":Qt("cancel",i),Qt("close",i),T=S;break;case"iframe":case"object":case"embed":Qt("load",i),T=S;break;case"video":case"audio":for(T=0;T<wl.length;T++)Qt(wl[T],i);T=S;break;case"source":Qt("error",i),T=S;break;case"img":case"image":case"link":Qt("error",i),Qt("load",i),T=S;break;case"details":Qt("toggle",i),T=S;break;case"input":Ge(i,S),T=Le(i,S),Qt("invalid",i);break;case"option":T=S;break;case"select":i._wrapperState={wasMultiple:!!S.multiple},T=R({},S,{value:void 0}),Qt("invalid",i);break;case"textarea":ve(i,S),T=we(i,S),Qt("invalid",i);break;default:T=S}Jt(p,T),ee=T;for(D in ee)if(ee.hasOwnProperty(D)){var ie=ee[D];D==="style"?Rr(i,ie):D==="dangerouslySetInnerHTML"?(ie=ie?ie.__html:void 0,ie!=null&&ze(i,ie)):D==="children"?typeof ie=="string"?(p!=="textarea"||ie!=="")&&Je(i,ie):typeof ie=="number"&&Je(i,""+ie):D!=="suppressContentEditableWarning"&&D!=="suppressHydrationWarning"&&D!=="autoFocus"&&(o.hasOwnProperty(D)?ie!=null&&D==="onScroll"&&Qt("scroll",i):ie!=null&&b(i,D,ie,V))}switch(p){case"input":Z(i),Be(i,S,!1);break;case"textarea":Z(i),Oe(i);break;case"option":S.value!=null&&i.setAttribute("value",""+W(S.value));break;case"select":i.multiple=!!S.multiple,D=S.value,D!=null?je(i,!!S.multiple,D,!1):S.defaultValue!=null&&je(i,!!S.multiple,S.defaultValue,!0);break;default:typeof T.onClick=="function"&&(i.onclick=sd)}switch(p){case"button":case"input":case"select":case"textarea":S=!!S.autoFocus;break e;case"img":S=!0;break e;default:S=!1}}S&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return is(a),null;case 6:if(i&&a.stateNode!=null)Rv(i,a,i.memoizedProps,S);else{if(typeof S!="string"&&a.stateNode===null)throw Error(s(166));if(p=xo(Pl.current),xo(Dn.current),dd(a)){if(S=a.stateNode,p=a.memoizedProps,S[Mn]=a,(D=S.nodeValue!==p)&&(i=Bs,i!==null))switch(i.tag){case 3:rd(S.nodeValue,p,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&rd(S.nodeValue,p,(i.mode&1)!==0)}D&&(a.flags|=4)}else S=(p.nodeType===9?p:p.ownerDocument).createTextNode(S),S[Mn]=a,a.stateNode=S}return is(a),null;case 13:if(Zt(lr),S=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(nr&&$s!==null&&(a.mode&1)!==0&&(a.flags&128)===0)I0(),da(),a.flags|=98560,D=!1;else if(D=dd(a),S!==null&&S.dehydrated!==null){if(i===null){if(!D)throw Error(s(318));if(D=a.memoizedState,D=D!==null?D.dehydrated:null,!D)throw Error(s(317));D[Mn]=a}else da(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;is(a),D=!1}else yn!==null&&(Uf(yn),yn=null),D=!0;if(!D)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=p,a):(S=S!==null,S!==(i!==null&&i.memoizedState!==null)&&S&&(a.child.flags|=8192,(a.mode&1)!==0&&(i===null||(lr.current&1)!==0?Nr===0&&(Nr=3):Kf())),a.updateQueue!==null&&(a.flags|=4),is(a),null);case 4:return ma(),Df(i,a),i===null&&_l(a.stateNode.containerInfo),is(a),null;case 10:return lf(a.type._context),is(a),null;case 17:return Ss(a.type)&&id(),is(a),null;case 19:if(Zt(lr),D=a.memoizedState,D===null)return is(a),null;if(S=(a.flags&128)!==0,V=D.rendering,V===null)if(S)Dl(D,!1);else{if(Nr!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(V=gd(i),V!==null){for(a.flags|=128,Dl(D,!1),S=V.updateQueue,S!==null&&(a.updateQueue=S,a.flags|=4),a.subtreeFlags=0,S=p,p=a.child;p!==null;)D=p,i=S,D.flags&=14680066,V=D.alternate,V===null?(D.childLanes=0,D.lanes=i,D.child=null,D.subtreeFlags=0,D.memoizedProps=null,D.memoizedState=null,D.updateQueue=null,D.dependencies=null,D.stateNode=null):(D.childLanes=V.childLanes,D.lanes=V.lanes,D.child=V.child,D.subtreeFlags=0,D.deletions=null,D.memoizedProps=V.memoizedProps,D.memoizedState=V.memoizedState,D.updateQueue=V.updateQueue,D.type=V.type,i=V.dependencies,D.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),p=p.sibling;return Gt(lr,lr.current&1|2),a.child}i=i.sibling}D.tail!==null&&Xt()>va&&(a.flags|=128,S=!0,Dl(D,!1),a.lanes=4194304)}else{if(!S)if(i=gd(V),i!==null){if(a.flags|=128,S=!0,p=i.updateQueue,p!==null&&(a.updateQueue=p,a.flags|=4),Dl(D,!0),D.tail===null&&D.tailMode==="hidden"&&!V.alternate&&!nr)return is(a),null}else 2*Xt()-D.renderingStartTime>va&&p!==1073741824&&(a.flags|=128,S=!0,Dl(D,!1),a.lanes=4194304);D.isBackwards?(V.sibling=a.child,a.child=V):(p=D.last,p!==null?p.sibling=V:a.child=V,D.last=V)}return D.tail!==null?(a=D.tail,D.rendering=a,D.tail=a.sibling,D.renderingStartTime=Xt(),a.sibling=null,p=lr.current,Gt(lr,S?p&1|2:p&1),a):(is(a),null);case 22:case 23:return qf(),S=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==S&&(a.flags|=8192),S&&(a.mode&1)!==0?(zs&1073741824)!==0&&(is(a),a.subtreeFlags&6&&(a.flags|=8192)):is(a),null;case 24:return null;case 25:return null}throw Error(s(156,a.tag))}function TE(i,a){switch(tf(a),a.tag){case 1:return Ss(a.type)&&id(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return ma(),Zt(Cs),Zt(ss),pf(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 5:return ff(a),null;case 13:if(Zt(lr),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(s(340));da()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return Zt(lr),null;case 4:return ma(),null;case 10:return lf(a.type._context),null;case 22:case 23:return qf(),null;case 24:return null;default:return null}}var kd=!1,os=!1,RE=typeof WeakSet=="function"?WeakSet:Set,He=null;function ga(i,a){var p=i.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(S){fr(i,a,S)}else p.current=null}function If(i,a,p){try{p()}catch(S){fr(i,a,S)}}var Mv=!1;function ME(i,a){if(Gh=uo,i=u0(),Fh(i)){if("selectionStart"in i)var p={start:i.selectionStart,end:i.selectionEnd};else e:{p=(p=i.ownerDocument)&&p.defaultView||window;var S=p.getSelection&&p.getSelection();if(S&&S.rangeCount!==0){p=S.anchorNode;var T=S.anchorOffset,D=S.focusNode;S=S.focusOffset;try{p.nodeType,D.nodeType}catch{p=null;break e}var V=0,ee=-1,ie=-1,ge=0,ke=0,Ne=i,Se=null;t:for(;;){for(var $e;Ne!==p||T!==0&&Ne.nodeType!==3||(ee=V+T),Ne!==D||S!==0&&Ne.nodeType!==3||(ie=V+S),Ne.nodeType===3&&(V+=Ne.nodeValue.length),($e=Ne.firstChild)!==null;)Se=Ne,Ne=$e;for(;;){if(Ne===i)break t;if(Se===p&&++ge===T&&(ee=V),Se===D&&++ke===S&&(ie=V),($e=Ne.nextSibling)!==null)break;Ne=Se,Se=Ne.parentNode}Ne=$e}p=ee===-1||ie===-1?null:{start:ee,end:ie}}else p=null}p=p||{start:0,end:0}}else p=null;for(qh={focusedElem:i,selectionRange:p},uo=!1,He=a;He!==null;)if(a=He,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,He=i;else for(;He!==null;){a=He;try{var We=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(We!==null){var Ye=We.memoizedProps,gr=We.memoizedState,he=a.stateNode,oe=he.getSnapshotBeforeUpdate(a.elementType===a.type?Ye:bn(a.type,Ye),gr);he.__reactInternalSnapshotBeforeUpdate=oe}break;case 3:var pe=a.stateNode.containerInfo;pe.nodeType===1?pe.textContent="":pe.nodeType===9&&pe.documentElement&&pe.removeChild(pe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(Me){fr(a,a.return,Me)}if(i=a.sibling,i!==null){i.return=a.return,He=i;break}He=a.return}return We=Mv,Mv=!1,We}function Il(i,a,p){var S=a.updateQueue;if(S=S!==null?S.lastEffect:null,S!==null){var T=S=S.next;do{if((T.tag&i)===i){var D=T.destroy;T.destroy=void 0,D!==void 0&&If(a,p,D)}T=T.next}while(T!==S)}}function jd(i,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var p=a=a.next;do{if((p.tag&i)===i){var S=p.create;p.destroy=S()}p=p.next}while(p!==a)}}function Lf(i){var a=i.ref;if(a!==null){var p=i.stateNode;switch(i.tag){case 5:i=p;break;default:i=p}typeof a=="function"?a(i):a.current=i}}function Dv(i){var a=i.alternate;a!==null&&(i.alternate=null,Dv(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&(delete a[Mn],delete a[Sl],delete a[Xh],delete a[pE],delete a[gE])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Iv(i){return i.tag===5||i.tag===3||i.tag===4}function Lv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Iv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Of(i,a,p){var S=i.tag;if(S===5||S===6)i=i.stateNode,a?p.nodeType===8?p.parentNode.insertBefore(i,a):p.insertBefore(i,a):(p.nodeType===8?(a=p.parentNode,a.insertBefore(i,p)):(a=p,a.appendChild(i)),p=p._reactRootContainer,p!=null||a.onclick!==null||(a.onclick=sd));else if(S!==4&&(i=i.child,i!==null))for(Of(i,a,p),i=i.sibling;i!==null;)Of(i,a,p),i=i.sibling}function Ff(i,a,p){var S=i.tag;if(S===5||S===6)i=i.stateNode,a?p.insertBefore(i,a):p.appendChild(i);else if(S!==4&&(i=i.child,i!==null))for(Ff(i,a,p),i=i.sibling;i!==null;)Ff(i,a,p),i=i.sibling}var Ur=null,wn=!1;function Mi(i,a,p){for(p=p.child;p!==null;)Ov(i,a,p),p=p.sibling}function Ov(i,a,p){if(fs&&typeof fs.onCommitFiberUnmount=="function")try{fs.onCommitFiberUnmount(Zn,p)}catch{}switch(p.tag){case 5:os||ga(p,a);case 6:var S=Ur,T=wn;Ur=null,Mi(i,a,p),Ur=S,wn=T,Ur!==null&&(wn?(i=Ur,p=p.stateNode,i.nodeType===8?i.parentNode.removeChild(p):i.removeChild(p)):Ur.removeChild(p.stateNode));break;case 18:Ur!==null&&(wn?(i=Ur,p=p.stateNode,i.nodeType===8?Jh(i.parentNode,p):i.nodeType===1&&Jh(i,p),Si(i)):Jh(Ur,p.stateNode));break;case 4:S=Ur,T=wn,Ur=p.stateNode.containerInfo,wn=!0,Mi(i,a,p),Ur=S,wn=T;break;case 0:case 11:case 14:case 15:if(!os&&(S=p.updateQueue,S!==null&&(S=S.lastEffect,S!==null))){T=S=S.next;do{var D=T,V=D.destroy;D=D.tag,V!==void 0&&((D&2)!==0||(D&4)!==0)&&If(p,a,V),T=T.next}while(T!==S)}Mi(i,a,p);break;case 1:if(!os&&(ga(p,a),S=p.stateNode,typeof S.componentWillUnmount=="function"))try{S.props=p.memoizedProps,S.state=p.memoizedState,S.componentWillUnmount()}catch(ee){fr(p,a,ee)}Mi(i,a,p);break;case 21:Mi(i,a,p);break;case 22:p.mode&1?(os=(S=os)||p.memoizedState!==null,Mi(i,a,p),os=S):Mi(i,a,p);break;default:Mi(i,a,p)}}function Fv(i){var a=i.updateQueue;if(a!==null){i.updateQueue=null;var p=i.stateNode;p===null&&(p=i.stateNode=new RE),a.forEach(function(S){var T=HE.bind(null,i,S);p.has(S)||(p.add(S),S.then(T,T))})}}function _n(i,a){var p=a.deletions;if(p!==null)for(var S=0;S<p.length;S++){var T=p[S];try{var D=i,V=a,ee=V;e:for(;ee!==null;){switch(ee.tag){case 5:Ur=ee.stateNode,wn=!1;break e;case 3:Ur=ee.stateNode.containerInfo,wn=!0;break e;case 4:Ur=ee.stateNode.containerInfo,wn=!0;break e}ee=ee.return}if(Ur===null)throw Error(s(160));Ov(D,V,T),Ur=null,wn=!1;var ie=T.alternate;ie!==null&&(ie.return=null),T.return=null}catch(ge){fr(T,a,ge)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)Bv(a,i),a=a.sibling}function Bv(i,a){var p=i.alternate,S=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(_n(a,i),Ln(i),S&4){try{Il(3,i,i.return),jd(3,i)}catch(Ye){fr(i,i.return,Ye)}try{Il(5,i,i.return)}catch(Ye){fr(i,i.return,Ye)}}break;case 1:_n(a,i),Ln(i),S&512&&p!==null&&ga(p,p.return);break;case 5:if(_n(a,i),Ln(i),S&512&&p!==null&&ga(p,p.return),i.flags&32){var T=i.stateNode;try{Je(T,"")}catch(Ye){fr(i,i.return,Ye)}}if(S&4&&(T=i.stateNode,T!=null)){var D=i.memoizedProps,V=p!==null?p.memoizedProps:D,ee=i.type,ie=i.updateQueue;if(i.updateQueue=null,ie!==null)try{ee==="input"&&D.type==="radio"&&D.name!=null&&me(T,D),Cr(ee,V);var ge=Cr(ee,D);for(V=0;V<ie.length;V+=2){var ke=ie[V],Ne=ie[V+1];ke==="style"?Rr(T,Ne):ke==="dangerouslySetInnerHTML"?ze(T,Ne):ke==="children"?Je(T,Ne):b(T,ke,Ne,ge)}switch(ee){case"input":be(T,D);break;case"textarea":_e(T,D);break;case"select":var Se=T._wrapperState.wasMultiple;T._wrapperState.wasMultiple=!!D.multiple;var $e=D.value;$e!=null?je(T,!!D.multiple,$e,!1):Se!==!!D.multiple&&(D.defaultValue!=null?je(T,!!D.multiple,D.defaultValue,!0):je(T,!!D.multiple,D.multiple?[]:"",!1))}T[Sl]=D}catch(Ye){fr(i,i.return,Ye)}}break;case 6:if(_n(a,i),Ln(i),S&4){if(i.stateNode===null)throw Error(s(162));T=i.stateNode,D=i.memoizedProps;try{T.nodeValue=D}catch(Ye){fr(i,i.return,Ye)}}break;case 3:if(_n(a,i),Ln(i),S&4&&p!==null&&p.memoizedState.isDehydrated)try{Si(a.containerInfo)}catch(Ye){fr(i,i.return,Ye)}break;case 4:_n(a,i),Ln(i);break;case 13:_n(a,i),Ln(i),T=i.child,T.flags&8192&&(D=T.memoizedState!==null,T.stateNode.isHidden=D,!D||T.alternate!==null&&T.alternate.memoizedState!==null||(zf=Xt())),S&4&&Fv(i);break;case 22:if(ke=p!==null&&p.memoizedState!==null,i.mode&1?(os=(ge=os)||ke,_n(a,i),os=ge):_n(a,i),Ln(i),S&8192){if(ge=i.memoizedState!==null,(i.stateNode.isHidden=ge)&&!ke&&(i.mode&1)!==0)for(He=i,ke=i.child;ke!==null;){for(Ne=He=ke;He!==null;){switch(Se=He,$e=Se.child,Se.tag){case 0:case 11:case 14:case 15:Il(4,Se,Se.return);break;case 1:ga(Se,Se.return);var We=Se.stateNode;if(typeof We.componentWillUnmount=="function"){S=Se,p=Se.return;try{a=S,We.props=a.memoizedProps,We.state=a.memoizedState,We.componentWillUnmount()}catch(Ye){fr(S,p,Ye)}}break;case 5:ga(Se,Se.return);break;case 22:if(Se.memoizedState!==null){Hv(Ne);continue}}$e!==null?($e.return=Se,He=$e):Hv(Ne)}ke=ke.sibling}e:for(ke=null,Ne=i;;){if(Ne.tag===5){if(ke===null){ke=Ne;try{T=Ne.stateNode,ge?(D=T.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none"):(ee=Ne.stateNode,ie=Ne.memoizedProps.style,V=ie!=null&&ie.hasOwnProperty("display")?ie.display:null,ee.style.display=ur("display",V))}catch(Ye){fr(i,i.return,Ye)}}}else if(Ne.tag===6){if(ke===null)try{Ne.stateNode.nodeValue=ge?"":Ne.memoizedProps}catch(Ye){fr(i,i.return,Ye)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===i)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===i)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===i)break e;ke===Ne&&(ke=null),Ne=Ne.return}ke===Ne&&(ke=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:_n(a,i),Ln(i),S&4&&Fv(i);break;case 21:break;default:_n(a,i),Ln(i)}}function Ln(i){var a=i.flags;if(a&2){try{e:{for(var p=i.return;p!==null;){if(Iv(p)){var S=p;break e}p=p.return}throw Error(s(160))}switch(S.tag){case 5:var T=S.stateNode;S.flags&32&&(Je(T,""),S.flags&=-33);var D=Lv(i);Ff(i,D,T);break;case 3:case 4:var V=S.stateNode.containerInfo,ee=Lv(i);Of(i,ee,V);break;default:throw Error(s(161))}}catch(ie){fr(i,i.return,ie)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function DE(i,a,p){He=i,$v(i)}function $v(i,a,p){for(var S=(i.mode&1)!==0;He!==null;){var T=He,D=T.child;if(T.tag===22&&S){var V=T.memoizedState!==null||kd;if(!V){var ee=T.alternate,ie=ee!==null&&ee.memoizedState!==null||os;ee=kd;var ge=os;if(kd=V,(os=ie)&&!ge)for(He=T;He!==null;)V=He,ie=V.child,V.tag===22&&V.memoizedState!==null?Wv(T):ie!==null?(ie.return=V,He=ie):Wv(T);for(;D!==null;)He=D,$v(D),D=D.sibling;He=T,kd=ee,os=ge}zv(i)}else(T.subtreeFlags&8772)!==0&&D!==null?(D.return=T,He=D):zv(i)}}function zv(i){for(;He!==null;){var a=He;if((a.flags&8772)!==0){var p=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:os||jd(5,a);break;case 1:var S=a.stateNode;if(a.flags&4&&!os)if(p===null)S.componentDidMount();else{var T=a.elementType===a.type?p.memoizedProps:bn(a.type,p.memoizedProps);S.componentDidUpdate(T,p.memoizedState,S.__reactInternalSnapshotBeforeUpdate)}var D=a.updateQueue;D!==null&&H0(a,D,S);break;case 3:var V=a.updateQueue;if(V!==null){if(p=null,a.child!==null)switch(a.child.tag){case 5:p=a.child.stateNode;break;case 1:p=a.child.stateNode}H0(a,V,p)}break;case 5:var ee=a.stateNode;if(p===null&&a.flags&4){p=ee;var ie=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":ie.autoFocus&&p.focus();break;case"img":ie.src&&(p.src=ie.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var ge=a.alternate;if(ge!==null){var ke=ge.memoizedState;if(ke!==null){var Ne=ke.dehydrated;Ne!==null&&Si(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}os||a.flags&512&&Lf(a)}catch(Se){fr(a,a.return,Se)}}if(a===i){He=null;break}if(p=a.sibling,p!==null){p.return=a.return,He=p;break}He=a.return}}function Hv(i){for(;He!==null;){var a=He;if(a===i){He=null;break}var p=a.sibling;if(p!==null){p.return=a.return,He=p;break}He=a.return}}function Wv(i){for(;He!==null;){var a=He;try{switch(a.tag){case 0:case 11:case 15:var p=a.return;try{jd(4,a)}catch(ie){fr(a,p,ie)}break;case 1:var S=a.stateNode;if(typeof S.componentDidMount=="function"){var T=a.return;try{S.componentDidMount()}catch(ie){fr(a,T,ie)}}var D=a.return;try{Lf(a)}catch(ie){fr(a,D,ie)}break;case 5:var V=a.return;try{Lf(a)}catch(ie){fr(a,V,ie)}}}catch(ie){fr(a,a.return,ie)}if(a===i){He=null;break}var ee=a.sibling;if(ee!==null){ee.return=a.return,He=ee;break}He=a.return}}var IE=Math.ceil,Nd=k.ReactCurrentDispatcher,Bf=k.ReactCurrentOwner,rn=k.ReactCurrentBatchConfig,At=0,Or=null,wr=null,Gr=0,zs=0,xa=Ei(0),Nr=0,Ll=null,yo=0,Ed=0,$f=0,Ol=null,js=null,zf=0,va=1/0,ci=null,Pd=!1,Hf=null,Di=null,Ad=!1,Ii=null,Td=0,Fl=0,Wf=null,Rd=-1,Md=0;function ps(){return(At&6)!==0?Xt():Rd!==-1?Rd:Rd=Xt()}function Li(i){return(i.mode&1)===0?1:(At&2)!==0&&Gr!==0?Gr&-Gr:vE.transition!==null?(Md===0&&(Md=_s()),Md):(i=Pt,i!==0||(i=window.event,i=i===void 0?16:Ux(i.type)),i)}function Cn(i,a,p,S){if(50<Fl)throw Fl=0,Wf=null,Error(s(185));Rn(i,p,S),((At&2)===0||i!==Or)&&(i===Or&&((At&2)===0&&(Ed|=p),Nr===4&&Oi(i,Gr)),Ns(i,S),p===1&&At===0&&(a.mode&1)===0&&(va=Xt()+500,ad&&Ai()))}function Ns(i,a){var p=i.callbackNode;pr(i,a);var S=sr(i,i===Or?Gr:0);if(S===0)p!==null&&Go(p),i.callbackNode=null,i.callbackPriority=0;else if(a=S&-S,i.callbackPriority!==a){if(p!=null&&Go(p),a===1)i.tag===0?xE(Uv.bind(null,i)):A0(Uv.bind(null,i)),fE(function(){(At&6)===0&&Ai()}),p=null;else{switch(cl(S)){case 1:p=Js;break;case 4:p=io;break;case 16:p=Tn;break;case 536870912:p=oo;break;default:p=Tn}p=Zv(p,Vv.bind(null,i))}i.callbackPriority=a,i.callbackNode=p}}function Vv(i,a){if(Rd=-1,Md=0,(At&6)!==0)throw Error(s(327));var p=i.callbackNode;if(ya()&&i.callbackNode!==p)return null;var S=sr(i,i===Or?Gr:0);if(S===0)return null;if((S&30)!==0||(S&i.expiredLanes)!==0||a)a=Dd(i,S);else{a=S;var T=At;At|=2;var D=qv();(Or!==i||Gr!==a)&&(ci=null,va=Xt()+500,wo(i,a));do try{FE();break}catch(ee){Gv(i,ee)}while(!0);af(),Nd.current=D,At=T,wr!==null?a=0:(Or=null,Gr=0,a=Nr)}if(a!==0){if(a===2&&(T=es(i),T!==0&&(S=T,a=Vf(i,T))),a===1)throw p=Ll,wo(i,0),Oi(i,S),Ns(i,Xt()),p;if(a===6)Oi(i,S);else{if(T=i.current.alternate,(S&30)===0&&!LE(T)&&(a=Dd(i,S),a===2&&(D=es(i),D!==0&&(S=D,a=Vf(i,D))),a===1))throw p=Ll,wo(i,0),Oi(i,S),Ns(i,Xt()),p;switch(i.finishedWork=T,i.finishedLanes=S,a){case 0:case 1:throw Error(s(345));case 2:_o(i,js,ci);break;case 3:if(Oi(i,S),(S&130023424)===S&&(a=zf+500-Xt(),10<a)){if(sr(i,0)!==0)break;if(T=i.suspendedLanes,(T&S)!==S){ps(),i.pingedLanes|=i.suspendedLanes&T;break}i.timeoutHandle=Yh(_o.bind(null,i,js,ci),a);break}_o(i,js,ci);break;case 4:if(Oi(i,S),(S&4194240)===S)break;for(a=i.eventTimes,T=-1;0<S;){var V=31-Mr(S);D=1<<V,V=a[V],V>T&&(T=V),S&=~D}if(S=T,S=Xt()-S,S=(120>S?120:480>S?480:1080>S?1080:1920>S?1920:3e3>S?3e3:4320>S?4320:1960*IE(S/1960))-S,10<S){i.timeoutHandle=Yh(_o.bind(null,i,js,ci),S);break}_o(i,js,ci);break;case 5:_o(i,js,ci);break;default:throw Error(s(329))}}}return Ns(i,Xt()),i.callbackNode===p?Vv.bind(null,i):null}function Vf(i,a){var p=Ol;return i.current.memoizedState.isDehydrated&&(wo(i,a).flags|=256),i=Dd(i,a),i!==2&&(a=js,js=p,a!==null&&Uf(a)),i}function Uf(i){js===null?js=i:js.push.apply(js,i)}function LE(i){for(var a=i;;){if(a.flags&16384){var p=a.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var S=0;S<p.length;S++){var T=p[S],D=T.getSnapshot;T=T.value;try{if(!vn(D(),T))return!1}catch{return!1}}}if(p=a.child,a.subtreeFlags&16384&&p!==null)p.return=a,a=p;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Oi(i,a){for(a&=~$f,a&=~Ed,i.suspendedLanes|=a,i.pingedLanes&=~a,i=i.expirationTimes;0<a;){var p=31-Mr(a),S=1<<p;i[p]=-1,a&=~S}}function Uv(i){if((At&6)!==0)throw Error(s(327));ya();var a=sr(i,0);if((a&1)===0)return Ns(i,Xt()),null;var p=Dd(i,a);if(i.tag!==0&&p===2){var S=es(i);S!==0&&(a=S,p=Vf(i,S))}if(p===1)throw p=Ll,wo(i,0),Oi(i,a),Ns(i,Xt()),p;if(p===6)throw Error(s(345));return i.finishedWork=i.current.alternate,i.finishedLanes=a,_o(i,js,ci),Ns(i,Xt()),null}function Gf(i,a){var p=At;At|=1;try{return i(a)}finally{At=p,At===0&&(va=Xt()+500,ad&&Ai())}}function bo(i){Ii!==null&&Ii.tag===0&&(At&6)===0&&ya();var a=At;At|=1;var p=rn.transition,S=Pt;try{if(rn.transition=null,Pt=1,i)return i()}finally{Pt=S,rn.transition=p,At=a,(At&6)===0&&Ai()}}function qf(){zs=xa.current,Zt(xa)}function wo(i,a){i.finishedWork=null,i.finishedLanes=0;var p=i.timeoutHandle;if(p!==-1&&(i.timeoutHandle=-1,hE(p)),wr!==null)for(p=wr.return;p!==null;){var S=p;switch(tf(S),S.tag){case 1:S=S.type.childContextTypes,S!=null&&id();break;case 3:ma(),Zt(Cs),Zt(ss),pf();break;case 5:ff(S);break;case 4:ma();break;case 13:Zt(lr);break;case 19:Zt(lr);break;case 10:lf(S.type._context);break;case 22:case 23:qf()}p=p.return}if(Or=i,wr=i=Fi(i.current,null),Gr=zs=a,Nr=0,Ll=null,$f=Ed=yo=0,js=Ol=null,go!==null){for(a=0;a<go.length;a++)if(p=go[a],S=p.interleaved,S!==null){p.interleaved=null;var T=S.next,D=p.pending;if(D!==null){var V=D.next;D.next=T,S.next=V}p.pending=S}go=null}return i}function Gv(i,a){do{var p=wr;try{if(af(),xd.current=wd,vd){for(var S=cr.memoizedState;S!==null;){var T=S.queue;T!==null&&(T.pending=null),S=S.next}vd=!1}if(vo=0,Lr=jr=cr=null,Al=!1,Tl=0,Bf.current=null,p===null||p.return===null){Nr=1,Ll=a,wr=null;break}e:{var D=i,V=p.return,ee=p,ie=a;if(a=Gr,ee.flags|=32768,ie!==null&&typeof ie=="object"&&typeof ie.then=="function"){var ge=ie,ke=ee,Ne=ke.tag;if((ke.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var Se=ke.alternate;Se?(ke.updateQueue=Se.updateQueue,ke.memoizedState=Se.memoizedState,ke.lanes=Se.lanes):(ke.updateQueue=null,ke.memoizedState=null)}var $e=xv(V);if($e!==null){$e.flags&=-257,vv($e,V,ee,D,a),$e.mode&1&&gv(D,ge,a),a=$e,ie=ge;var We=a.updateQueue;if(We===null){var Ye=new Set;Ye.add(ie),a.updateQueue=Ye}else We.add(ie);break e}else{if((a&1)===0){gv(D,ge,a),Kf();break e}ie=Error(s(426))}}else if(nr&&ee.mode&1){var gr=xv(V);if(gr!==null){(gr.flags&65536)===0&&(gr.flags|=256),vv(gr,V,ee,D,a),nf(pa(ie,ee));break e}}D=ie=pa(ie,ee),Nr!==4&&(Nr=2),Ol===null?Ol=[D]:Ol.push(D),D=V;do{switch(D.tag){case 3:D.flags|=65536,a&=-a,D.lanes|=a;var he=mv(D,ie,a);z0(D,he);break e;case 1:ee=ie;var oe=D.type,pe=D.stateNode;if((D.flags&128)===0&&(typeof oe.getDerivedStateFromError=="function"||pe!==null&&typeof pe.componentDidCatch=="function"&&(Di===null||!Di.has(pe)))){D.flags|=65536,a&=-a,D.lanes|=a;var Me=pv(D,ee,a);z0(D,Me);break e}}D=D.return}while(D!==null)}Yv(p)}catch(Xe){a=Xe,wr===p&&p!==null&&(wr=p=p.return);continue}break}while(!0)}function qv(){var i=Nd.current;return Nd.current=wd,i===null?wd:i}function Kf(){(Nr===0||Nr===3||Nr===2)&&(Nr=4),Or===null||(yo&268435455)===0&&(Ed&268435455)===0||Oi(Or,Gr)}function Dd(i,a){var p=At;At|=2;var S=qv();(Or!==i||Gr!==a)&&(ci=null,wo(i,a));do try{OE();break}catch(T){Gv(i,T)}while(!0);if(af(),At=p,Nd.current=S,wr!==null)throw Error(s(261));return Or=null,Gr=0,Nr}function OE(){for(;wr!==null;)Kv(wr)}function FE(){for(;wr!==null&&!qo();)Kv(wr)}function Kv(i){var a=Qv(i.alternate,i,zs);i.memoizedProps=i.pendingProps,a===null?Yv(i):wr=a,Bf.current=null}function Yv(i){var a=i;do{var p=a.alternate;if(i=a.return,(a.flags&32768)===0){if(p=AE(p,a,zs),p!==null){wr=p;return}}else{if(p=TE(p,a),p!==null){p.flags&=32767,wr=p;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{Nr=6,wr=null;return}}if(a=a.sibling,a!==null){wr=a;return}wr=a=i}while(a!==null);Nr===0&&(Nr=5)}function _o(i,a,p){var S=Pt,T=rn.transition;try{rn.transition=null,Pt=1,BE(i,a,p,S)}finally{rn.transition=T,Pt=S}return null}function BE(i,a,p,S){do ya();while(Ii!==null);if((At&6)!==0)throw Error(s(327));p=i.finishedWork;var T=i.finishedLanes;if(p===null)return null;if(i.finishedWork=null,i.finishedLanes=0,p===i.current)throw Error(s(177));i.callbackNode=null,i.callbackPriority=0;var D=p.lanes|p.childLanes;if(Vc(i,D),i===Or&&(wr=Or=null,Gr=0),(p.subtreeFlags&2064)===0&&(p.flags&2064)===0||Ad||(Ad=!0,Zv(Tn,function(){return ya(),null})),D=(p.flags&15990)!==0,(p.subtreeFlags&15990)!==0||D){D=rn.transition,rn.transition=null;var V=Pt;Pt=1;var ee=At;At|=4,Bf.current=null,ME(i,p),Bv(p,i),iE(qh),uo=!!Gh,qh=Gh=null,i.current=p,DE(p),no(),At=ee,Pt=V,rn.transition=D}else i.current=p;if(Ad&&(Ad=!1,Ii=i,Td=T),D=i.pendingLanes,D===0&&(Di=null),ao(p.stateNode),Ns(i,Xt()),a!==null)for(S=i.onRecoverableError,p=0;p<a.length;p++)T=a[p],S(T.value,{componentStack:T.stack,digest:T.digest});if(Pd)throw Pd=!1,i=Hf,Hf=null,i;return(Td&1)!==0&&i.tag!==0&&ya(),D=i.pendingLanes,(D&1)!==0?i===Wf?Fl++:(Fl=0,Wf=i):Fl=0,Ai(),null}function ya(){if(Ii!==null){var i=cl(Td),a=rn.transition,p=Pt;try{if(rn.transition=null,Pt=16>i?16:i,Ii===null)var S=!1;else{if(i=Ii,Ii=null,Td=0,(At&6)!==0)throw Error(s(331));var T=At;for(At|=4,He=i.current;He!==null;){var D=He,V=D.child;if((He.flags&16)!==0){var ee=D.deletions;if(ee!==null){for(var ie=0;ie<ee.length;ie++){var ge=ee[ie];for(He=ge;He!==null;){var ke=He;switch(ke.tag){case 0:case 11:case 15:Il(8,ke,D)}var Ne=ke.child;if(Ne!==null)Ne.return=ke,He=Ne;else for(;He!==null;){ke=He;var Se=ke.sibling,$e=ke.return;if(Dv(ke),ke===ge){He=null;break}if(Se!==null){Se.return=$e,He=Se;break}He=$e}}}var We=D.alternate;if(We!==null){var Ye=We.child;if(Ye!==null){We.child=null;do{var gr=Ye.sibling;Ye.sibling=null,Ye=gr}while(Ye!==null)}}He=D}}if((D.subtreeFlags&2064)!==0&&V!==null)V.return=D,He=V;else e:for(;He!==null;){if(D=He,(D.flags&2048)!==0)switch(D.tag){case 0:case 11:case 15:Il(9,D,D.return)}var he=D.sibling;if(he!==null){he.return=D.return,He=he;break e}He=D.return}}var oe=i.current;for(He=oe;He!==null;){V=He;var pe=V.child;if((V.subtreeFlags&2064)!==0&&pe!==null)pe.return=V,He=pe;else e:for(V=oe;He!==null;){if(ee=He,(ee.flags&2048)!==0)try{switch(ee.tag){case 0:case 11:case 15:jd(9,ee)}}catch(Xe){fr(ee,ee.return,Xe)}if(ee===V){He=null;break e}var Me=ee.sibling;if(Me!==null){Me.return=ee.return,He=Me;break e}He=ee.return}}if(At=T,Ai(),fs&&typeof fs.onPostCommitFiberRoot=="function")try{fs.onPostCommitFiberRoot(Zn,i)}catch{}S=!0}return S}finally{Pt=p,rn.transition=a}}return!1}function Jv(i,a,p){a=pa(p,a),a=mv(i,a,1),i=Ri(i,a,1),a=ps(),i!==null&&(Rn(i,1,a),Ns(i,a))}function fr(i,a,p){if(i.tag===3)Jv(i,i,p);else for(;a!==null;){if(a.tag===3){Jv(a,i,p);break}else if(a.tag===1){var S=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof S.componentDidCatch=="function"&&(Di===null||!Di.has(S))){i=pa(p,i),i=pv(a,i,1),a=Ri(a,i,1),i=ps(),a!==null&&(Rn(a,1,i),Ns(a,i));break}}a=a.return}}function $E(i,a,p){var S=i.pingCache;S!==null&&S.delete(a),a=ps(),i.pingedLanes|=i.suspendedLanes&p,Or===i&&(Gr&p)===p&&(Nr===4||Nr===3&&(Gr&130023424)===Gr&&500>Xt()-zf?wo(i,0):$f|=p),Ns(i,a)}function Xv(i,a){a===0&&((i.mode&1)===0?a=1:(a=$t,$t<<=1,($t&130023424)===0&&($t=4194304)));var p=ps();i=oi(i,a),i!==null&&(Rn(i,a,p),Ns(i,p))}function zE(i){var a=i.memoizedState,p=0;a!==null&&(p=a.retryLane),Xv(i,p)}function HE(i,a){var p=0;switch(i.tag){case 13:var S=i.stateNode,T=i.memoizedState;T!==null&&(p=T.retryLane);break;case 19:S=i.stateNode;break;default:throw Error(s(314))}S!==null&&S.delete(a),Xv(i,p)}var Qv;Qv=function(i,a,p){if(i!==null)if(i.memoizedProps!==a.pendingProps||Cs.current)ks=!0;else{if((i.lanes&p)===0&&(a.flags&128)===0)return ks=!1,PE(i,a,p);ks=(i.flags&131072)!==0}else ks=!1,nr&&(a.flags&1048576)!==0&&T0(a,cd,a.index);switch(a.lanes=0,a.tag){case 2:var S=a.type;Sd(i,a),i=a.pendingProps;var T=aa(a,ss.current);fa(a,p),T=vf(null,a,S,i,T,p);var D=yf();return a.flags|=1,typeof T=="object"&&T!==null&&typeof T.render=="function"&&T.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Ss(S)?(D=!0,od(a)):D=!1,a.memoizedState=T.state!==null&&T.state!==void 0?T.state:null,uf(a),T.updater=_d,a.stateNode=T,T._reactInternals=a,kf(a,S,i,p),a=Pf(null,a,S,!0,D,p)):(a.tag=0,nr&&D&&ef(a),ms(null,a,T,p),a=a.child),a;case 16:S=a.elementType;e:{switch(Sd(i,a),i=a.pendingProps,T=S._init,S=T(S._payload),a.type=S,T=a.tag=VE(S),i=bn(S,i),T){case 0:a=Ef(null,a,S,i,p);break e;case 1:a=Sv(null,a,S,i,p);break e;case 11:a=yv(null,a,S,i,p);break e;case 14:a=bv(null,a,S,bn(S.type,i),p);break e}throw Error(s(306,S,""))}return a;case 0:return S=a.type,T=a.pendingProps,T=a.elementType===S?T:bn(S,T),Ef(i,a,S,T,p);case 1:return S=a.type,T=a.pendingProps,T=a.elementType===S?T:bn(S,T),Sv(i,a,S,T,p);case 3:e:{if(kv(a),i===null)throw Error(s(387));S=a.pendingProps,D=a.memoizedState,T=D.element,$0(i,a),pd(a,S,null,p);var V=a.memoizedState;if(S=V.element,D.isDehydrated)if(D={element:S,isDehydrated:!1,cache:V.cache,pendingSuspenseBoundaries:V.pendingSuspenseBoundaries,transitions:V.transitions},a.updateQueue.baseState=D,a.memoizedState=D,a.flags&256){T=pa(Error(s(423)),a),a=jv(i,a,S,p,T);break e}else if(S!==T){T=pa(Error(s(424)),a),a=jv(i,a,S,p,T);break e}else for($s=Ni(a.stateNode.containerInfo.firstChild),Bs=a,nr=!0,yn=null,p=F0(a,null,S,p),a.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(da(),S===T){a=li(i,a,p);break e}ms(i,a,S,p)}a=a.child}return a;case 5:return W0(a),i===null&&sf(a),S=a.type,T=a.pendingProps,D=i!==null?i.memoizedProps:null,V=T.children,Kh(S,T)?V=null:D!==null&&Kh(S,D)&&(a.flags|=32),Cv(i,a),ms(i,a,V,p),a.child;case 6:return i===null&&sf(a),null;case 13:return Nv(i,a,p);case 4:return hf(a,a.stateNode.containerInfo),S=a.pendingProps,i===null?a.child=ua(a,null,S,p):ms(i,a,S,p),a.child;case 11:return S=a.type,T=a.pendingProps,T=a.elementType===S?T:bn(S,T),yv(i,a,S,T,p);case 7:return ms(i,a,a.pendingProps,p),a.child;case 8:return ms(i,a,a.pendingProps.children,p),a.child;case 12:return ms(i,a,a.pendingProps.children,p),a.child;case 10:e:{if(S=a.type._context,T=a.pendingProps,D=a.memoizedProps,V=T.value,Gt(hd,S._currentValue),S._currentValue=V,D!==null)if(vn(D.value,V)){if(D.children===T.children&&!Cs.current){a=li(i,a,p);break e}}else for(D=a.child,D!==null&&(D.return=a);D!==null;){var ee=D.dependencies;if(ee!==null){V=D.child;for(var ie=ee.firstContext;ie!==null;){if(ie.context===S){if(D.tag===1){ie=ai(-1,p&-p),ie.tag=2;var ge=D.updateQueue;if(ge!==null){ge=ge.shared;var ke=ge.pending;ke===null?ie.next=ie:(ie.next=ke.next,ke.next=ie),ge.pending=ie}}D.lanes|=p,ie=D.alternate,ie!==null&&(ie.lanes|=p),cf(D.return,p,a),ee.lanes|=p;break}ie=ie.next}}else if(D.tag===10)V=D.type===a.type?null:D.child;else if(D.tag===18){if(V=D.return,V===null)throw Error(s(341));V.lanes|=p,ee=V.alternate,ee!==null&&(ee.lanes|=p),cf(V,p,a),V=D.sibling}else V=D.child;if(V!==null)V.return=D;else for(V=D;V!==null;){if(V===a){V=null;break}if(D=V.sibling,D!==null){D.return=V.return,V=D;break}V=V.return}D=V}ms(i,a,T.children,p),a=a.child}return a;case 9:return T=a.type,S=a.pendingProps.children,fa(a,p),T=en(T),S=S(T),a.flags|=1,ms(i,a,S,p),a.child;case 14:return S=a.type,T=bn(S,a.pendingProps),T=bn(S.type,T),bv(i,a,S,T,p);case 15:return wv(i,a,a.type,a.pendingProps,p);case 17:return S=a.type,T=a.pendingProps,T=a.elementType===S?T:bn(S,T),Sd(i,a),a.tag=1,Ss(S)?(i=!0,od(a)):i=!1,fa(a,p),hv(a,S,T),kf(a,S,T,p),Pf(null,a,S,!0,i,p);case 19:return Pv(i,a,p);case 22:return _v(i,a,p)}throw Error(s(156,a.tag))};function Zv(i,a){return Uo(i,a)}function WE(i,a,p,S){this.tag=i,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sn(i,a,p,S){return new WE(i,a,p,S)}function Yf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function VE(i){if(typeof i=="function")return Yf(i)?1:0;if(i!=null){if(i=i.$$typeof,i===B)return 11;if(i===H)return 14}return 2}function Fi(i,a){var p=i.alternate;return p===null?(p=sn(i.tag,a,i.key,i.mode),p.elementType=i.elementType,p.type=i.type,p.stateNode=i.stateNode,p.alternate=i,i.alternate=p):(p.pendingProps=a,p.type=i.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=i.flags&14680064,p.childLanes=i.childLanes,p.lanes=i.lanes,p.child=i.child,p.memoizedProps=i.memoizedProps,p.memoizedState=i.memoizedState,p.updateQueue=i.updateQueue,a=i.dependencies,p.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},p.sibling=i.sibling,p.index=i.index,p.ref=i.ref,p}function Id(i,a,p,S,T,D){var V=2;if(S=i,typeof i=="function")Yf(i)&&(V=1);else if(typeof i=="string")V=5;else e:switch(i){case A:return Co(p.children,T,D,a);case N:V=8,T|=8;break;case M:return i=sn(12,p,a,T|2),i.elementType=M,i.lanes=D,i;case z:return i=sn(13,p,a,T),i.elementType=z,i.lanes=D,i;case Y:return i=sn(19,p,a,T),i.elementType=Y,i.lanes=D,i;case X:return Ld(p,T,D,a);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case I:V=10;break e;case L:V=9;break e;case B:V=11;break e;case H:V=14;break e;case U:V=16,S=null;break e}throw Error(s(130,i==null?i:typeof i,""))}return a=sn(V,p,a,T),a.elementType=i,a.type=S,a.lanes=D,a}function Co(i,a,p,S){return i=sn(7,i,S,a),i.lanes=p,i}function Ld(i,a,p,S){return i=sn(22,i,S,a),i.elementType=X,i.lanes=p,i.stateNode={isHidden:!1},i}function Jf(i,a,p){return i=sn(6,i,null,a),i.lanes=p,i}function Xf(i,a,p){return a=sn(4,i.children!==null?i.children:[],i.key,a),a.lanes=p,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}function UE(i,a,p,S,T){this.tag=a,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xs(0),this.expirationTimes=Xs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xs(0),this.identifierPrefix=S,this.onRecoverableError=T,this.mutableSourceEagerHydrationData=null}function Qf(i,a,p,S,T,D,V,ee,ie){return i=new UE(i,a,p,ee,ie),a===1?(a=1,D===!0&&(a|=8)):a=0,D=sn(3,null,null,a),i.current=D,D.stateNode=i,D.memoizedState={element:S,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},uf(D),i}function GE(i,a,p){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:S==null?null:""+S,children:i,containerInfo:a,implementation:p}}function ey(i){if(!i)return Pi;i=i._reactInternals;e:{if(mn(i)!==i||i.tag!==1)throw Error(s(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(Ss(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(s(171))}if(i.tag===1){var p=i.type;if(Ss(p))return E0(i,p,a)}return a}function ty(i,a,p,S,T,D,V,ee,ie){return i=Qf(p,S,!0,i,T,D,V,ee,ie),i.context=ey(null),p=i.current,S=ps(),T=Li(p),D=ai(S,T),D.callback=a??null,Ri(p,D,T),i.current.lanes=T,Rn(i,T,S),Ns(i,S),i}function Od(i,a,p,S){var T=a.current,D=ps(),V=Li(T);return p=ey(p),a.context===null?a.context=p:a.pendingContext=p,a=ai(D,V),a.payload={element:i},S=S===void 0?null:S,S!==null&&(a.callback=S),i=Ri(T,a,V),i!==null&&(Cn(i,T,V,D),md(i,T,V)),V}function Fd(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function ry(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var p=i.retryLane;i.retryLane=p!==0&&p<a?p:a}}function Zf(i,a){ry(i,a),(i=i.alternate)&&ry(i,a)}function qE(){return null}var sy=typeof reportError=="function"?reportError:function(i){console.error(i)};function em(i){this._internalRoot=i}Bd.prototype.render=em.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(s(409));Od(i,a,null,null)},Bd.prototype.unmount=em.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;bo(function(){Od(null,i,null,null)}),a[ri]=null}};function Bd(i){this._internalRoot=i}Bd.prototype.unstable_scheduleHydration=function(i){if(i){var a=hl();i={blockedOn:null,target:i,priority:a};for(var p=0;p<Rt.length&&a!==0&&a<Rt[p].priority;p++);Rt.splice(p,0,i),p===0&&Ir(i)}};function tm(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function $d(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function ny(){}function KE(i,a,p,S,T){if(T){if(typeof S=="function"){var D=S;S=function(){var ge=Fd(V);D.call(ge)}}var V=ty(a,S,i,0,null,!1,!1,"",ny);return i._reactRootContainer=V,i[ri]=V.current,_l(i.nodeType===8?i.parentNode:i),bo(),V}for(;T=i.lastChild;)i.removeChild(T);if(typeof S=="function"){var ee=S;S=function(){var ge=Fd(ie);ee.call(ge)}}var ie=Qf(i,0,!1,null,null,!1,!1,"",ny);return i._reactRootContainer=ie,i[ri]=ie.current,_l(i.nodeType===8?i.parentNode:i),bo(function(){Od(a,ie,p,S)}),ie}function zd(i,a,p,S,T){var D=p._reactRootContainer;if(D){var V=D;if(typeof T=="function"){var ee=T;T=function(){var ie=Fd(V);ee.call(ie)}}Od(a,V,i,T)}else V=KE(p,a,i,T,S);return Fd(V)}dl=function(i){switch(i.tag){case 3:var a=i.stateNode;if(a.current.memoizedState.isDehydrated){var p=jt(a.pendingLanes);p!==0&&(Yo(a,p|1),Ns(a,Xt()),(At&6)===0&&(va=Xt()+500,Ai()))}break;case 13:bo(function(){var S=oi(i,1);if(S!==null){var T=ps();Cn(S,i,1,T)}}),Zf(i,1)}},Jo=function(i){if(i.tag===13){var a=oi(i,134217728);if(a!==null){var p=ps();Cn(a,i,134217728,p)}Zf(i,134217728)}},ul=function(i){if(i.tag===13){var a=Li(i),p=oi(i,a);if(p!==null){var S=ps();Cn(p,i,a,S)}Zf(i,a)}},hl=function(){return Pt},fl=function(i,a){var p=Pt;try{return Pt=i,a()}finally{Pt=p}},us=function(i,a,p){switch(a){case"input":if(be(i,p),a=p.name,p.type==="radio"&&a!=null){for(p=i;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<p.length;a++){var S=p[a];if(S!==i&&S.form===i.form){var T=nd(S);if(!T)throw Error(s(90));le(S),be(S,T)}}}break;case"textarea":_e(i,p);break;case"select":a=p.value,a!=null&&je(i,!!p.multiple,a,!1)}},rr=Gf,ar=bo;var YE={usingClientEntryPoint:!1,Events:[kl,ia,nd,it,zt,Gf]},Bl={findFiberByHostInstance:ho,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},JE={bundleType:Bl.bundleType,version:Bl.version,rendererPackageName:Bl.rendererPackageName,rendererConfig:Bl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:k.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Vo(i),i===null?null:i.stateNode},findFiberByHostInstance:Bl.findFiberByHostInstance||qE,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 Hd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hd.isDisabled&&Hd.supportsFiber)try{Zn=Hd.inject(JE),fs=Hd}catch{}}return Es.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=YE,Es.createPortal=function(i,a){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tm(a))throw Error(s(200));return GE(i,a,null,p)},Es.createRoot=function(i,a){if(!tm(i))throw Error(s(299));var p=!1,S="",T=sy;return a!=null&&(a.unstable_strictMode===!0&&(p=!0),a.identifierPrefix!==void 0&&(S=a.identifierPrefix),a.onRecoverableError!==void 0&&(T=a.onRecoverableError)),a=Qf(i,1,!1,null,null,p,!1,S,T),i[ri]=a.current,_l(i.nodeType===8?i.parentNode:i),new em(a)},Es.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=Vo(a),i=i===null?null:i.stateNode,i},Es.flushSync=function(i){return bo(i)},Es.hydrate=function(i,a,p){if(!$d(a))throw Error(s(200));return zd(null,i,a,!0,p)},Es.hydrateRoot=function(i,a,p){if(!tm(i))throw Error(s(405));var S=p!=null&&p.hydratedSources||null,T=!1,D="",V=sy;if(p!=null&&(p.unstable_strictMode===!0&&(T=!0),p.identifierPrefix!==void 0&&(D=p.identifierPrefix),p.onRecoverableError!==void 0&&(V=p.onRecoverableError)),a=ty(a,null,i,1,p??null,T,!1,D,V),i[ri]=a.current,_l(i),S)for(i=0;i<S.length;i++)p=S[i],T=p._getVersion,T=T(p._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[p,T]:a.mutableSourceEagerHydrationData.push(p,T);return new Bd(a)},Es.render=function(i,a,p){if(!$d(a))throw Error(s(200));return zd(null,i,a,!1,p)},Es.unmountComponentAtNode=function(i){if(!$d(i))throw Error(s(40));return i._reactRootContainer?(bo(function(){zd(null,null,i,!1,function(){i._reactRootContainer=null,i[ri]=null})}),!0):!1},Es.unstable_batchedUpdates=Gf,Es.unstable_renderSubtreeIntoContainer=function(i,a,p,S){if(!$d(p))throw Error(s(200));if(i==null||i._reactInternals===void 0)throw Error(s(38));return zd(i,a,p,!1,S)},Es.version="18.3.1-next-f1338f8080-20240426",Es}var hy;function w_(){if(hy)return nm.exports;hy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),nm.exports=nP(),nm.exports}var fy;function iP(){if(fy)return Wd;fy=1;var e=w_();return Wd.createRoot=e.createRoot,Wd.hydrateRoot=e.hydrateRoot,Wd}var oP=iP();const aP=wc(oP);var _c=w_();const __=wc(_c);function lP(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}const cP=e=>{switch(e){case"success":return hP;case"info":return mP;case"warning":return fP;case"error":return pP;default:return null}},dP=Array(12).fill(0),uP=({visible:e,className:t})=>Pe.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Pe.createElement("div",{className:"sonner-spinner"},dP.map((s,n)=>Pe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),hP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Pe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),fP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Pe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),mP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),pP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),gP=Pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Pe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Pe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),xP=()=>{const[e,t]=Pe.useState(document.hidden);return Pe.useEffect(()=>{const s=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),e};let Zm=1;class vP{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const s=this.subscribers.indexOf(t);this.subscribers.splice(s,1)}),this.publish=t=>{this.subscribers.forEach(s=>s(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var s;const{message:n,...o}=t,c=typeof(t==null?void 0:t.id)=="number"||((s=t.id)==null?void 0:s.length)>0?t.id:Zm++,u=this.toasts.find(d=>d.id===c),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(c)&&this.dismissedToasts.delete(c),u?this.toasts=this.toasts.map(d=>d.id===c?(this.publish({...d,...t,id:c,title:n}),{...d,...t,id:c,dismissible:l,title:n}):d):this.addToast({title:n,...o,dismissible:l,id:c}),c},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(s=>s({id:t,dismiss:!0})))):this.toasts.forEach(s=>{this.subscribers.forEach(n=>n({id:s.id,dismiss:!0}))}),t),this.message=(t,s)=>this.create({...s,message:t}),this.error=(t,s)=>this.create({...s,message:t,type:"error"}),this.success=(t,s)=>this.create({...s,type:"success",message:t}),this.info=(t,s)=>this.create({...s,type:"info",message:t}),this.warning=(t,s)=>this.create({...s,type:"warning",message:t}),this.loading=(t,s)=>this.create({...s,type:"loading",message:t}),this.promise=(t,s)=>{if(!s)return;let n;s.loading!==void 0&&(n=this.create({...s,promise:t,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let c=n!==void 0,u;const l=o.then(async f=>{if(u=["resolve",f],Pe.isValidElement(f))c=!1,this.create({id:n,type:"default",message:f});else if(bP(f)&&!f.ok){c=!1;const h=typeof s.error=="function"?await s.error(`HTTP error! status: ${f.status}`):s.error,x=typeof s.description=="function"?await s.description(`HTTP error! status: ${f.status}`):s.description,j=typeof h=="object"&&!Pe.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:x,...j})}else if(f instanceof Error){c=!1;const h=typeof s.error=="function"?await s.error(f):s.error,x=typeof s.description=="function"?await s.description(f):s.description,j=typeof h=="object"&&!Pe.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:x,...j})}else if(s.success!==void 0){c=!1;const h=typeof s.success=="function"?await s.success(f):s.success,x=typeof s.description=="function"?await s.description(f):s.description,j=typeof h=="object"&&!Pe.isValidElement(h)?h:{message:h};this.create({id:n,type:"success",description:x,...j})}}).catch(async f=>{if(u=["reject",f],s.error!==void 0){c=!1;const m=typeof s.error=="function"?await s.error(f):s.error,h=typeof s.description=="function"?await s.description(f):s.description,w=typeof m=="object"&&!Pe.isValidElement(m)?m:{message:m};this.create({id:n,type:"error",description:h,...w})}}).finally(()=>{c&&(this.dismiss(n),n=void 0),s.finally==null||s.finally.call(s)}),d=()=>new Promise((f,m)=>l.then(()=>u[0]==="reject"?m(u[1]):f(u[1])).catch(m));return typeof n!="string"&&typeof n!="number"?{unwrap:d}:Object.assign(n,{unwrap:d})},this.custom=(t,s)=>{const n=(s==null?void 0:s.id)||Zm++;return this.create({jsx:t(n),id:n,...s}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const As=new vP,yP=(e,t)=>{const s=(t==null?void 0:t.id)||Zm++;return As.addToast({title:e,...t,id:s}),s},bP=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",wP=yP,_P=()=>As.toasts,CP=()=>As.getActiveToasts(),K=Object.assign(wP,{success:As.success,info:As.info,warning:As.warning,error:As.error,custom:As.custom,message:As.message,promise:As.promise,dismiss:As.dismiss,loading:As.loading},{getHistory:_P,getToasts:CP});lP("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Vd(e){return e.label!==void 0}const SP=3,kP="24px",jP="16px",my=4e3,NP=356,EP=14,PP=45,AP=200;function On(...e){return e.filter(Boolean).join(" ")}function TP(e){const[t,s]=e.split("-"),n=[];return t&&n.push(t),s&&n.push(s),n}const RP=e=>{var t,s,n,o,c,u,l,d,f;const{invert:m,toast:h,unstyled:x,interacting:w,setHeights:j,visibleToasts:C,heights:v,index:y,toasts:g,expanded:b,removeToast:k,defaultRichColors:E,closeButton:P,style:A,cancelButtonStyle:N,actionButtonStyle:M,className:I="",descriptionClassName:L="",duration:B,position:z,gap:Y,expandByDefault:H,classNames:U,icons:X,closeButtonAriaLabel:q="Close toast"}=e,[O,R]=Pe.useState(null),[$,G]=Pe.useState(null),[F,te]=Pe.useState(!1),[ce,fe]=Pe.useState(!1),[J,W]=Pe.useState(!1),[ae,ne]=Pe.useState(!1),[Z,le]=Pe.useState(!1),[Ce,Le]=Pe.useState(0),[Ge,me]=Pe.useState(0),be=Pe.useRef(h.duration||B||my),Be=Pe.useRef(null),Ke=Pe.useRef(null),Qe=y===0,je=y+1<=C,we=h.type,ve=h.dismissible!==!1,_e=h.className||"",Oe=h.descriptionClassName||"",de=Pe.useMemo(()=>v.findIndex(it=>it.toastId===h.id)||0,[v,h.id]),ye=Pe.useMemo(()=>{var it;return(it=h.closeButton)!=null?it:P},[h.closeButton,P]),Re=Pe.useMemo(()=>h.duration||B||my,[h.duration,B]),ze=Pe.useRef(0),Je=Pe.useRef(0),Et=Pe.useRef(0),at=Pe.useRef(null),[ur,Rr]=z.split("-"),Wr=Pe.useMemo(()=>v.reduce((it,zt,rr)=>rr>=de?it:it+zt.height,0),[v,de]),Jt=xP(),Cr=h.invert||m,Wt=we==="loading";Je.current=Pe.useMemo(()=>de*Y+Wr,[de,Wr]),Pe.useEffect(()=>{be.current=Re},[Re]),Pe.useEffect(()=>{te(!0)},[]),Pe.useEffect(()=>{const it=Ke.current;if(it){const zt=it.getBoundingClientRect().height;return me(zt),j(rr=>[{toastId:h.id,height:zt,position:h.position},...rr]),()=>j(rr=>rr.filter(ar=>ar.toastId!==h.id))}},[j,h.id]),Pe.useLayoutEffect(()=>{if(!F)return;const it=Ke.current,zt=it.style.height;it.style.height="auto";const rr=it.getBoundingClientRect().height;it.style.height=zt,me(rr),j(ar=>ar.find(Vt=>Vt.toastId===h.id)?ar.map(Vt=>Vt.toastId===h.id?{...Vt,height:rr}:Vt):[{toastId:h.id,height:rr,position:h.position},...ar])},[F,h.title,h.description,j,h.id,h.jsx,h.action,h.cancel]);const yr=Pe.useCallback(()=>{fe(!0),Le(Je.current),j(it=>it.filter(zt=>zt.toastId!==h.id)),setTimeout(()=>{k(h)},AP)},[h,k,j,Je]);Pe.useEffect(()=>{if(h.promise&&we==="loading"||h.duration===1/0||h.type==="loading")return;let it;return b||w||Jt?(()=>{if(Et.current<ze.current){const ar=new Date().getTime()-ze.current;be.current=be.current-ar}Et.current=new Date().getTime()})():(()=>{be.current!==1/0&&(ze.current=new Date().getTime(),it=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),yr()},be.current))})(),()=>clearTimeout(it)},[b,w,h,we,Jt,yr]),Pe.useEffect(()=>{h.delete&&(yr(),h.onDismiss==null||h.onDismiss.call(h,h))},[yr,h.delete]);function us(){var it;if(X!=null&&X.loading){var zt;return Pe.createElement("div",{className:On(U==null?void 0:U.loader,h==null||(zt=h.classNames)==null?void 0:zt.loader,"sonner-loader"),"data-visible":we==="loading"},X.loading)}return Pe.createElement(uP,{className:On(U==null?void 0:U.loader,h==null||(it=h.classNames)==null?void 0:it.loader),visible:we==="loading"})}const Xr=h.icon||(X==null?void 0:X[we])||cP(we);var Ls,Os;return Pe.createElement("li",{tabIndex:0,ref:Ke,className:On(I,_e,U==null?void 0:U.toast,h==null||(t=h.classNames)==null?void 0:t.toast,U==null?void 0:U.default,U==null?void 0:U[we],h==null||(s=h.classNames)==null?void 0:s[we]),"data-sonner-toast":"","data-rich-colors":(Ls=h.richColors)!=null?Ls:E,"data-styled":!(h.jsx||h.unstyled||x),"data-mounted":F,"data-promise":!!h.promise,"data-swiped":Z,"data-removed":ce,"data-visible":je,"data-y-position":ur,"data-x-position":Rr,"data-index":y,"data-front":Qe,"data-swiping":J,"data-dismissible":ve,"data-type":we,"data-invert":Cr,"data-swipe-out":ae,"data-swipe-direction":$,"data-expanded":!!(b||H&&F),"data-testid":h.testId,style:{"--index":y,"--toasts-before":y,"--z-index":g.length-y,"--offset":`${ce?Ce:Je.current}px`,"--initial-height":H?"auto":`${Ge}px`,...A,...h.style},onDragEnd:()=>{W(!1),R(null),at.current=null},onPointerDown:it=>{it.button!==2&&(Wt||!ve||(Be.current=new Date,Le(Je.current),it.target.setPointerCapture(it.pointerId),it.target.tagName!=="BUTTON"&&(W(!0),at.current={x:it.clientX,y:it.clientY})))},onPointerUp:()=>{var it,zt,rr;if(ae||!ve)return;at.current=null;const ar=Number(((it=Ke.current)==null?void 0:it.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ws=Number(((zt=Ke.current)==null?void 0:zt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Vt=new Date().getTime()-((rr=Be.current)==null?void 0:rr.getTime()),Ut=O==="x"?ar:ws,Vr=Math.abs(Ut)/Vt;if(Math.abs(Ut)>=PP||Vr>.11){Le(Je.current),h.onDismiss==null||h.onDismiss.call(h,h),G(O==="x"?ar>0?"right":"left":ws>0?"down":"up"),yr(),ne(!0);return}else{var ut,hr;(ut=Ke.current)==null||ut.style.setProperty("--swipe-amount-x","0px"),(hr=Ke.current)==null||hr.style.setProperty("--swipe-amount-y","0px")}le(!1),W(!1),R(null)},onPointerMove:it=>{var zt,rr,ar;if(!at.current||!ve||((zt=window.getSelection())==null?void 0:zt.toString().length)>0)return;const Vt=it.clientY-at.current.y,Ut=it.clientX-at.current.x;var Vr;const ut=(Vr=e.swipeDirections)!=null?Vr:TP(z);!O&&(Math.abs(Ut)>1||Math.abs(Vt)>1)&&R(Math.abs(Ut)>Math.abs(Vt)?"x":"y");let hr={x:0,y:0};const hs=Qr=>1/(1.5+Math.abs(Qr)/20);if(O==="y"){if(ut.includes("top")||ut.includes("bottom"))if(ut.includes("top")&&Vt<0||ut.includes("bottom")&&Vt>0)hr.y=Vt;else{const Qr=Vt*hs(Vt);hr.y=Math.abs(Qr)<Math.abs(Vt)?Qr:Vt}}else if(O==="x"&&(ut.includes("left")||ut.includes("right")))if(ut.includes("left")&&Ut<0||ut.includes("right")&&Ut>0)hr.x=Ut;else{const Qr=Ut*hs(Ut);hr.x=Math.abs(Qr)<Math.abs(Ut)?Qr:Ut}(Math.abs(hr.x)>0||Math.abs(hr.y)>0)&&le(!0),(rr=Ke.current)==null||rr.style.setProperty("--swipe-amount-x",`${hr.x}px`),(ar=Ke.current)==null||ar.style.setProperty("--swipe-amount-y",`${hr.y}px`)}},ye&&!h.jsx&&we!=="loading"?Pe.createElement("button",{"aria-label":q,"data-disabled":Wt,"data-close-button":!0,onClick:Wt||!ve?()=>{}:()=>{yr(),h.onDismiss==null||h.onDismiss.call(h,h)},className:On(U==null?void 0:U.closeButton,h==null||(n=h.classNames)==null?void 0:n.closeButton)},(Os=X==null?void 0:X.close)!=null?Os:gP):null,(we||h.icon||h.promise)&&h.icon!==null&&((X==null?void 0:X[we])!==null||h.icon)?Pe.createElement("div",{"data-icon":"",className:On(U==null?void 0:U.icon,h==null||(o=h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||us():null,h.type!=="loading"?Xr:null):null,Pe.createElement("div",{"data-content":"",className:On(U==null?void 0:U.content,h==null||(c=h.classNames)==null?void 0:c.content)},Pe.createElement("div",{"data-title":"",className:On(U==null?void 0:U.title,h==null||(u=h.classNames)==null?void 0:u.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?Pe.createElement("div",{"data-description":"",className:On(L,Oe,U==null?void 0:U.description,h==null||(l=h.classNames)==null?void 0:l.description)},typeof h.description=="function"?h.description():h.description):null),Pe.isValidElement(h.cancel)?h.cancel:h.cancel&&Vd(h.cancel)?Pe.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||N,onClick:it=>{Vd(h.cancel)&&ve&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,it),yr())},className:On(U==null?void 0:U.cancelButton,h==null||(d=h.classNames)==null?void 0:d.cancelButton)},h.cancel.label):null,Pe.isValidElement(h.action)?h.action:h.action&&Vd(h.action)?Pe.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||M,onClick:it=>{Vd(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,it),!it.defaultPrevented&&yr())},className:On(U==null?void 0:U.actionButton,h==null||(f=h.classNames)==null?void 0:f.actionButton)},h.action.label):null)};function py(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function MP(e,t){const s={};return[e,t].forEach((n,o)=>{const c=o===1,u=c?"--mobile-offset":"--offset",l=c?jP:kP;function d(f){["top","right","bottom","left"].forEach(m=>{s[`${u}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof n=="number"||typeof n=="string"?d(n):typeof n=="object"?["top","right","bottom","left"].forEach(f=>{n[f]===void 0?s[`${u}-${f}`]=l:s[`${u}-${f}`]=typeof n[f]=="number"?`${n[f]}px`:n[f]}):d(l)}),s}const DP=Pe.forwardRef(function(t,s){const{id:n,invert:o,position:c="bottom-right",hotkey:u=["altKey","KeyT"],expand:l,closeButton:d,className:f,offset:m,mobileOffset:h,theme:x="light",richColors:w,duration:j,style:C,visibleToasts:v=SP,toastOptions:y,dir:g=py(),gap:b=EP,icons:k,containerAriaLabel:E="Notifications"}=t,[P,A]=Pe.useState([]),N=Pe.useMemo(()=>n?P.filter(F=>F.toasterId===n):P.filter(F=>!F.toasterId),[P,n]),M=Pe.useMemo(()=>Array.from(new Set([c].concat(N.filter(F=>F.position).map(F=>F.position)))),[N,c]),[I,L]=Pe.useState([]),[B,z]=Pe.useState(!1),[Y,H]=Pe.useState(!1),[U,X]=Pe.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=Pe.useRef(null),O=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=Pe.useRef(null),$=Pe.useRef(!1),G=Pe.useCallback(F=>{A(te=>{var ce;return(ce=te.find(fe=>fe.id===F.id))!=null&&ce.delete||As.dismiss(F.id),te.filter(({id:fe})=>fe!==F.id)})},[]);return Pe.useEffect(()=>As.subscribe(F=>{if(F.dismiss){requestAnimationFrame(()=>{A(te=>te.map(ce=>ce.id===F.id?{...ce,delete:!0}:ce))});return}setTimeout(()=>{__.flushSync(()=>{A(te=>{const ce=te.findIndex(fe=>fe.id===F.id);return ce!==-1?[...te.slice(0,ce),{...te[ce],...F},...te.slice(ce+1)]:[F,...te]})})})}),[P]),Pe.useEffect(()=>{if(x!=="system"){X(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?X("dark"):X("light")),typeof window>"u")return;const F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:te})=>{X(te?"dark":"light")})}catch{F.addListener(({matches:ce})=>{try{X(ce?"dark":"light")}catch(fe){console.error(fe)}})}},[x]),Pe.useEffect(()=>{P.length<=1&&z(!1)},[P]),Pe.useEffect(()=>{const F=te=>{var ce;if(u.every(W=>te[W]||te.code===W)){var J;z(!0),(J=q.current)==null||J.focus()}te.code==="Escape"&&(document.activeElement===q.current||(ce=q.current)!=null&&ce.contains(document.activeElement))&&z(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[u]),Pe.useEffect(()=>{if(q.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,$.current=!1)}},[q.current]),Pe.createElement("section",{ref:s,"aria-label":`${E} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((F,te)=>{var ce;const[fe,J]=F.split("-");return N.length?Pe.createElement("ol",{key:F,dir:g==="auto"?py():g,tabIndex:-1,ref:q,className:f,"data-sonner-toaster":!0,"data-sonner-theme":U,"data-y-position":fe,"data-x-position":J,style:{"--front-toast-height":`${((ce=I[0])==null?void 0:ce.height)||0}px`,"--width":`${NP}px`,"--gap":`${b}px`,...C,...MP(m,h)},onBlur:W=>{$.current&&!W.currentTarget.contains(W.relatedTarget)&&($.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||$.current||($.current=!0,R.current=W.relatedTarget)},onMouseEnter:()=>z(!0),onMouseMove:()=>z(!0),onMouseLeave:()=>{Y||z(!1)},onDragEnd:()=>z(!1),onPointerDown:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},N.filter(W=>!W.position&&te===0||W.position===F).map((W,ae)=>{var ne,Z;return Pe.createElement(RP,{key:W.id,icons:k,index:ae,toast:W,defaultRichColors:w,duration:(ne=y==null?void 0:y.duration)!=null?ne:j,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:o,visibleToasts:v,closeButton:(Z=y==null?void 0:y.closeButton)!=null?Z:d,interacting:Y,position:F,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,closeButtonAriaLabel:y==null?void 0:y.closeButtonAriaLabel,removeToast:G,toasts:N.filter(le=>le.position==W.position),heights:I.filter(le=>le.position==W.position),setHeights:L,expandByDefault:l,gap:b,expanded:B,swipeDirections:t.swipeDirections})})):null}))}),Yp=_.createContext({});function Jp(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const Hu=_.createContext(null),Xp=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class IP extends _.Component{getSnapshotBeforeUpdate(t){const s=this.props.childRef.current;if(s&&t.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=s.offsetHeight||0,n.width=s.offsetWidth||0,n.top=s.offsetTop,n.left=s.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function LP({children:e,isPresent:t}){const s=_.useId(),n=_.useRef(null),o=_.useRef({width:0,height:0,top:0,left:0}),{nonce:c}=_.useContext(Xp);return _.useInsertionEffect(()=>{const{width:u,height:l,top:d,left:f}=o.current;if(t||!n.current||!u||!l)return;n.current.dataset.motionPopId=s;const m=document.createElement("style");return c&&(m.nonce=c),document.head.appendChild(m),m.sheet&&m.sheet.insertRule(`
41
41
  [data-motion-pop-id="${s}"] {
42
42
  position: absolute !important;
43
43
  width: ${u}px !important;
@@ -581,7 +581,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
581
581
  `)))),this.register(this._terminal.onA11yTab((P=>this._handleTab(P)))),this.register(this._terminal.onKey((P=>this._handleKey(P.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,w.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(g){for(let b=0;b<g;b++)this._handleChar(" ")}_handleChar(g){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==g&&(this._charsToAnnounce+=g):this._charsToAnnounce+=g,g===`
582
582
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(g){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(g)||this._charsToConsume.push(g)}_refreshRows(g,b){this._liveRegionDebouncer.refresh(g,b,this._terminal.rows)}_renderRows(g,b){const k=this._terminal.buffer,E=k.lines.length.toString();for(let P=g;P<=b;P++){const A=k.lines.get(k.ydisp+P),N=[],M=(A==null?void 0:A.translateToString(!0,void 0,void 0,N))||"",I=(k.ydisp+P+1).toString(),L=this._rowElements[P];L&&(M.length===0?(L.innerText=" ",this._rowColumns.set(L,[0,1])):(L.textContent=M,this._rowColumns.set(L,N)),L.setAttribute("aria-posinset",I),L.setAttribute("aria-setsize",E))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(g,b){const k=g.target,E=this._rowElements[b===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(b===0?"1":`${this._terminal.buffer.lines.length}`)||g.relatedTarget!==E)return;let P,A;if(b===0?(P=k,A=this._rowElements.pop(),this._rowContainer.removeChild(A)):(P=this._rowElements.shift(),A=k,this._rowContainer.removeChild(P)),P.removeEventListener("focus",this._topBoundaryFocusListener),A.removeEventListener("focus",this._bottomBoundaryFocusListener),b===0){const N=this._createAccessibilityTreeNode();this._rowElements.unshift(N),this._rowContainer.insertAdjacentElement("afterbegin",N)}else{const N=this._createAccessibilityTreeNode();this._rowElements.push(N),this._rowContainer.appendChild(N)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(b===0?-1:1),this._rowElements[b===0?1:this._rowElements.length-2].focus(),g.preventDefault(),g.stopImmediatePropagation()}_handleSelectionChange(){var M;if(this._rowElements.length===0)return;const g=document.getSelection();if(!g)return;if(g.isCollapsed)return void(this._rowContainer.contains(g.anchorNode)&&this._terminal.clearSelection());if(!g.anchorNode||!g.focusNode)return void console.error("anchorNode and/or focusNode are null");let b={node:g.anchorNode,offset:g.anchorOffset},k={node:g.focusNode,offset:g.focusOffset};if((b.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||b.node===k.node&&b.offset>k.offset)&&([b,k]=[k,b]),b.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(b={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(b.node))return;const E=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(E)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:E,offset:((M=E.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(k.node))return;const P=({node:I,offset:L})=>{const B=I instanceof Text?I.parentNode:I;let z=parseInt(B==null?void 0:B.getAttribute("aria-posinset"),10)-1;if(isNaN(z))return console.warn("row is invalid. Race condition?"),null;const Y=this._rowColumns.get(B);if(!Y)return console.warn("columns is null. Race condition?"),null;let H=L<Y.length?Y[L]:Y.slice(-1)[0]+1;return H>=this._terminal.cols&&(++z,H=0),{row:z,column:H}},A=P(b),N=P(k);if(A&&N){if(A.row>N.row||A.row===N.row&&A.column>=N.column)throw new Error("invalid range");this._terminal.select(A.column,A.row,(N.row-A.row)*this._terminal.cols-A.column+N.column)}}_handleResize(g){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let b=this._rowContainer.children.length;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);for(;this._rowElements.length>g;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const g=this._coreBrowserService.mainDocument.createElement("div");return g.setAttribute("role","listitem"),g.tabIndex=-1,this._refreshRowDimensions(g),g}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let g=0;g<this._terminal.rows;g++)this._refreshRowDimensions(this._rowElements[g])}}_refreshRowDimensions(g){g.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=y=f([m(1,C.IInstantiationService),m(2,j.ICoreBrowserService),m(3,j.IRenderService)],y)},3614:(u,l)=>{function d(x){return x.replace(/\r?\n/g,"\r")}function f(x,w){return w?"\x1B[200~"+x+"\x1B[201~":x}function m(x,w,j,C){x=f(x=d(x),j.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),j.triggerDataEvent(x,!0),w.value=""}function h(x,w,j){const C=j.getBoundingClientRect(),v=x.clientX-C.left-10,y=x.clientY-C.top-10;w.style.width="20px",w.style.height="20px",w.style.left=`${v}px`,w.style.top=`${y}px`,w.style.zIndex="1000",w.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=d,l.bracketTextForPaste=f,l.copyHandler=function(x,w){x.clipboardData&&x.clipboardData.setData("text/plain",w.selectionText),x.preventDefault()},l.handlePasteEvent=function(x,w,j,C){x.stopPropagation(),x.clipboardData&&m(x.clipboardData.getData("text/plain"),w,j,C)},l.paste=m,l.moveTextAreaUnderMouseCursor=h,l.rightClickHandler=function(x,w,j,C,v){h(x,w,j),v&&C.rightClickSelect(x),w.value=C.selectionText,w.select()}},7239:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=d(1505);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(m,h,x){this._css.set(m,h,x)}getCss(m,h){return this._css.get(m,h)}setColor(m,h,x){this._color.set(m,h,x)}getColor(m,h){return this._color.get(m,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(d,f,m,h){d.addEventListener(f,m,h);let x=!1;return{dispose:()=>{x||(x=!0,d.removeEventListener(f,m,h))}}}},3551:function(u,l,d){var f=this&&this.__decorate||function(y,g,b,k){var E,P=arguments.length,A=P<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,g,b,k);else for(var N=y.length-1;N>=0;N--)(E=y[N])&&(A=(P<3?E(A):P>3?E(g,b,A):E(g,b))||A);return P>3&&A&&Object.defineProperty(g,b,A),A},m=this&&this.__param||function(y,g){return function(b,k){g(b,k,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const h=d(3656),x=d(8460),w=d(844),j=d(2585),C=d(4725);let v=l.Linkifier=class extends w.Disposable{get currentLink(){return this._currentLink}constructor(y,g,b,k,E){super(),this._element=y,this._mouseService=g,this._renderService=b,this._bufferService=k,this._linkProviderService=E,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new x.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new x.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,w.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,w.toDisposable)((()=>{var P;this._lastMouseEvent=void 0,(P=this._activeProviderReplies)==null||P.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(y){this._lastMouseEvent=y;const g=this._positionFromMouseEvent(y,this._element,this._mouseService);if(!g)return;this._isMouseOut=!1;const b=y.composedPath();for(let k=0;k<b.length;k++){const E=b[k];if(E.classList.contains("xterm"))break;if(E.classList.contains("xterm-hover"))return}this._lastBufferCell&&g.x===this._lastBufferCell.x&&g.y===this._lastBufferCell.y||(this._handleHover(g),this._lastBufferCell=g)}_handleHover(y){if(this._activeLine!==y.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(y,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,y)||(this._clearCurrentLink(),this._askForLink(y,!0))}_askForLink(y,g){var k,E;this._activeProviderReplies&&g||((k=this._activeProviderReplies)==null||k.forEach((P=>{P==null||P.forEach((A=>{A.link.dispose&&A.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=y.y);let b=!1;for(const[P,A]of this._linkProviderService.linkProviders.entries())g?(E=this._activeProviderReplies)!=null&&E.get(P)&&(b=this._checkLinkProviderResult(P,y,b)):A.provideLinks(y.y,(N=>{var I,L;if(this._isMouseOut)return;const M=N==null?void 0:N.map((B=>({link:B})));(I=this._activeProviderReplies)==null||I.set(P,M),b=this._checkLinkProviderResult(P,y,b),((L=this._activeProviderReplies)==null?void 0:L.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(y.y,this._activeProviderReplies)}))}_removeIntersectingLinks(y,g){const b=new Set;for(let k=0;k<g.size;k++){const E=g.get(k);if(E)for(let P=0;P<E.length;P++){const A=E[P],N=A.link.range.start.y<y?0:A.link.range.start.x,M=A.link.range.end.y>y?this._bufferService.cols:A.link.range.end.x;for(let I=N;I<=M;I++){if(b.has(I)){E.splice(P--,1);break}b.add(I)}}}}_checkLinkProviderResult(y,g,b){var P;if(!this._activeProviderReplies)return b;const k=this._activeProviderReplies.get(y);let E=!1;for(let A=0;A<y;A++)this._activeProviderReplies.has(A)&&!this._activeProviderReplies.get(A)||(E=!0);if(!E&&k){const A=k.find((N=>this._linkAtPosition(N.link,g)));A&&(b=!0,this._handleNewLink(A))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!b)for(let A=0;A<this._activeProviderReplies.size;A++){const N=(P=this._activeProviderReplies.get(A))==null?void 0:P.find((M=>this._linkAtPosition(M.link,g)));if(N){b=!0,this._handleNewLink(N);break}}return b}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(y){if(!this._currentLink)return;const g=this._positionFromMouseEvent(y,this._element,this._mouseService);g&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,g)&&this._currentLink.link.activate(y,this._currentLink.link.text)}_clearCurrentLink(y,g){this._currentLink&&this._lastMouseEvent&&(!y||!g||this._currentLink.link.range.start.y>=y&&this._currentLink.link.range.end.y<=g)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,w.disposeArray)(this._linkCacheDisposables))}_handleNewLink(y){if(!this._lastMouseEvent)return;const g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._linkAtPosition(y.link,g)&&(this._currentLink=y,this._currentLink.state={decorations:{underline:y.link.decorations===void 0||y.link.decorations.underline,pointerCursor:y.link.decorations===void 0||y.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,y.link,this._lastMouseEvent),y.link.decorations={},Object.defineProperties(y.link.decorations,{pointerCursor:{get:()=>{var b,k;return(k=(b=this._currentLink)==null?void 0:b.state)==null?void 0:k.decorations.pointerCursor},set:b=>{var k;(k=this._currentLink)!=null&&k.state&&this._currentLink.state.decorations.pointerCursor!==b&&(this._currentLink.state.decorations.pointerCursor=b,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",b))}},underline:{get:()=>{var b,k;return(k=(b=this._currentLink)==null?void 0:b.state)==null?void 0:k.decorations.underline},set:b=>{var k,E,P;(k=this._currentLink)!=null&&k.state&&((P=(E=this._currentLink)==null?void 0:E.state)==null?void 0:P.decorations.underline)!==b&&(this._currentLink.state.decorations.underline=b,this._currentLink.state.isHovered&&this._fireUnderlineEvent(y.link,b))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((b=>{if(!this._currentLink)return;const k=b.start===0?0:b.start+1+this._bufferService.buffer.ydisp,E=this._bufferService.buffer.ydisp+1+b.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=E&&(this._clearCurrentLink(k,E),this._lastMouseEvent)){const P=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);P&&this._askForLink(P,!1)}}))))}_linkHover(y,g,b){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!0),this._currentLink.state.decorations.pointerCursor&&y.classList.add("xterm-cursor-pointer")),g.hover&&g.hover(b,g.text)}_fireUnderlineEvent(y,g){const b=y.range,k=this._bufferService.buffer.ydisp,E=this._createLinkUnderlineEvent(b.start.x-1,b.start.y-k-1,b.end.x,b.end.y-k-1,void 0);(g?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(E)}_linkLeave(y,g,b){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!1),this._currentLink.state.decorations.pointerCursor&&y.classList.remove("xterm-cursor-pointer")),g.leave&&g.leave(b,g.text)}_linkAtPosition(y,g){const b=y.range.start.y*this._bufferService.cols+y.range.start.x,k=y.range.end.y*this._bufferService.cols+y.range.end.x,E=g.y*this._bufferService.cols+g.x;return b<=E&&E<=k}_positionFromMouseEvent(y,g,b){const k=b.getCoords(y,g,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(y,g,b,k,E){return{x1:y,y1:g,x2:b,y2:k,cols:this._bufferService.cols,fg:E}}};l.Linkifier=v=f([m(1,C.IMouseService),m(2,C.IRenderService),m(3,j.IBufferService),m(4,C.ILinkProviderService)],v)},9042:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(u,l,d){var f=this&&this.__decorate||function(C,v,y,g){var b,k=arguments.length,E=k<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,y):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(C,v,y,g);else for(var P=C.length-1;P>=0;P--)(b=C[P])&&(E=(k<3?b(E):k>3?b(v,y,E):b(v,y))||E);return k>3&&E&&Object.defineProperty(v,y,E),E},m=this&&this.__param||function(C,v){return function(y,g){v(y,g,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const h=d(511),x=d(2585);let w=l.OscLinkProvider=class{constructor(C,v,y){this._bufferService=C,this._optionsService=v,this._oscLinkService=y}provideLinks(C,v){var M;const y=this._bufferService.buffer.lines.get(C-1);if(!y)return void v(void 0);const g=[],b=this._optionsService.rawOptions.linkHandler,k=new h.CellData,E=y.getTrimmedLength();let P=-1,A=-1,N=!1;for(let I=0;I<E;I++)if(A!==-1||y.hasContent(I)){if(y.loadCell(I,k),k.hasExtendedAttrs()&&k.extended.urlId){if(A===-1){A=I,P=k.extended.urlId;continue}N=k.extended.urlId!==P}else A!==-1&&(N=!0);if(N||A!==-1&&I===E-1){const L=(M=this._oscLinkService.getLinkData(P))==null?void 0:M.uri;if(L){const B={start:{x:A+1,y:C},end:{x:I+(N||I!==E-1?0:1),y:C}};let z=!1;if(!(b!=null&&b.allowNonHttpProtocols))try{const Y=new URL(L);["http:","https:"].includes(Y.protocol)||(z=!0)}catch{z=!0}z||g.push({text:L,range:B,activate:(Y,H)=>b?b.activate(Y,H,B):j(0,H),hover:(Y,H)=>{var U;return(U=b==null?void 0:b.hover)==null?void 0:U.call(b,Y,H,B)},leave:(Y,H)=>{var U;return(U=b==null?void 0:b.leave)==null?void 0:U.call(b,Y,H,B)}})}N=!1,k.hasExtendedAttrs()&&k.extended.urlId?(A=I,P=k.extended.urlId):(A=-1,P=-1)}}v(g)}};function j(C,v){if(confirm(`Do you want to navigate to ${v}?
583
583
 
584
- WARNING: This link could potentially be dangerous`)){const y=window.open();if(y){try{y.opener=null}catch{}y.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=w=f([m(0,x.IBufferService),m(1,x.IOptionsService),m(2,x.IOscLinkService)],w)},6193:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(d,f){this._renderCallback=d,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,f,m){this._rowCount=m,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=d(3614),m=d(3656),h=d(3551),x=d(9042),w=d(3730),j=d(1680),C=d(3107),v=d(5744),y=d(2950),g=d(1296),b=d(428),k=d(4269),E=d(5114),P=d(8934),A=d(3230),N=d(9312),M=d(4725),I=d(6731),L=d(8055),B=d(8969),z=d(8460),Y=d(844),H=d(6114),U=d(8437),X=d(2584),q=d(7399),O=d(5941),R=d(9074),$=d(2585),G=d(5435),F=d(4567),te=d(779);class ce extends B.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(J={}){super(J),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Y.MutableDisposable),this._onCursorMove=this.register(new z.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new z.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new z.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new z.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new z.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new z.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new z.EventEmitter),this._onBlur=this.register(new z.EventEmitter),this._onA11yCharEmitter=this.register(new z.EventEmitter),this._onA11yTabEmitter=this.register(new z.EventEmitter),this._onWillOpen=this.register(new z.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(R.DecorationService),this._instantiationService.setService($.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(te.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(w.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((W,ae)=>this.refresh(W,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((W=>this._reportWindowsOptions(W)))),this.register(this._inputHandler.onColor((W=>this._handleColorEvent(W)))),this.register((0,z.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,z.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,z.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,z.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((W=>this._afterResize(W.cols,W.rows)))),this.register((0,Y.toDisposable)((()=>{var W,ae;this._customKeyEventHandler=void 0,(ae=(W=this.element)==null?void 0:W.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(J){if(this._themeService)for(const W of J){let ae,ne="";switch(W.index){case 256:ae="foreground",ne="10";break;case 257:ae="background",ne="11";break;case 258:ae="cursor",ne="12";break;default:ae="ansi",ne="4;"+W.index}switch(W.type){case 0:const Z=L.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[W.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ne};${(0,O.toRgbString)(Z)}${X.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((le=>le.ansi[W.index]=L.channels.toColor(...W.color)));else{const le=ae;this._themeService.modifyColors((Ce=>Ce[le]=L.channels.toColor(...W.color)))}break;case 2:this._themeService.restoreColor(W.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(J){J?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(J){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var J;return(J=this.textarea)==null?void 0:J.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const J=this.buffer.ybase+this.buffer.y,W=this.buffer.lines.get(J);if(!W)return;const ae=Math.min(this.buffer.x,this.cols-1),ne=this._renderService.dimensions.css.cell.height,Z=W.getWidth(ae),le=this._renderService.dimensions.css.cell.width*Z,Ce=this.buffer.y*this._renderService.dimensions.css.cell.height,Le=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Le+"px",this.textarea.style.top=Ce+"px",this.textarea.style.width=le+"px",this.textarea.style.height=ne+"px",this.textarea.style.lineHeight=ne+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,m.addDisposableDomListener)(this.element,"copy",(W=>{this.hasSelection()&&(0,f.copyHandler)(W,this._selectionService)})));const J=W=>(0,f.handlePasteEvent)(W,this.textarea,this.coreService,this.optionsService);this.register((0,m.addDisposableDomListener)(this.textarea,"paste",J)),this.register((0,m.addDisposableDomListener)(this.element,"paste",J)),H.isFirefox?this.register((0,m.addDisposableDomListener)(this.element,"mousedown",(W=>{W.button===2&&(0,f.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,m.addDisposableDomListener)(this.element,"contextmenu",(W=>{(0,f.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),H.isLinux&&this.register((0,m.addDisposableDomListener)(this.element,"auxclick",(W=>{W.button===1&&(0,f.moveTextAreaUnderMouseCursor)(W,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,m.addDisposableDomListener)(this.textarea,"keyup",(J=>this._keyUp(J)),!0)),this.register((0,m.addDisposableDomListener)(this.textarea,"keydown",(J=>this._keyDown(J)),!0)),this.register((0,m.addDisposableDomListener)(this.textarea,"keypress",(J=>this._keyPress(J)),!0)),this.register((0,m.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,m.addDisposableDomListener)(this.textarea,"compositionupdate",(J=>this._compositionHelper.compositionupdate(J)))),this.register((0,m.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,m.addDisposableDomListener)(this.textarea,"input",(J=>this._inputEvent(J)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(J){var ae;if(!J)throw new Error("Terminal requires a parent element.");if(J.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ae=this.element)==null?void 0:ae.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=J.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),J.appendChild(this.element);const W=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),W.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,m.addDisposableDomListener)(this.screenElement,"mousemove",(ne=>this.updateCursorStyle(ne)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),W.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",x.promptLabel),H.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(E.CoreBrowserService,this.textarea,J.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,m.addDisposableDomListener)(this.textarea,"focus",(ne=>this._handleTextAreaFocus(ne)))),this.register((0,m.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(b.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(A.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ne=>this._onRender.fire(ne)))),this.onResize((ne=>this._renderService.resize(ne.cols,ne.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(y.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(P.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(W);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(j.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(N.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ne=>this._renderService.handleSelectionChanged(ne.start,ne.end,ne.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ne=>{this.textarea.value=ne,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ne=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,m.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,m.addDisposableDomListener)(this.element,"mousedown",(ne=>this._selectionService.handleMouseDown(ne)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ne=>this._handleScreenReaderModeOptionChange(ne)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ne=>{!this._overviewRulerRenderer&&ne&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(g.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const J=this,W=this.element;function ae(le){const Ce=J._mouseService.getMouseReportCoords(le,J.screenElement);if(!Ce)return!1;let Le,Ge;switch(le.overrideType||le.type){case"mousemove":Ge=32,le.buttons===void 0?(Le=3,le.button!==void 0&&(Le=le.button<3?le.button:3)):Le=1&le.buttons?0:4&le.buttons?1:2&le.buttons?2:3;break;case"mouseup":Ge=0,Le=le.button<3?le.button:3;break;case"mousedown":Ge=1,Le=le.button<3?le.button:3;break;case"wheel":if(J._customWheelEventHandler&&J._customWheelEventHandler(le)===!1||J.viewport.getLinesScrolled(le)===0)return!1;Ge=le.deltaY<0?0:1,Le=4;break;default:return!1}return!(Ge===void 0||Le===void 0||Le>4)&&J.coreMouseService.triggerMouseEvent({col:Ce.col,row:Ce.row,x:Ce.x,y:Ce.y,button:Le,action:Ge,ctrl:le.ctrlKey,alt:le.altKey,shift:le.shiftKey})}const ne={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:le=>(ae(le),le.buttons||(this._document.removeEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.removeEventListener("mousemove",ne.mousedrag)),this.cancel(le)),wheel:le=>(ae(le),this.cancel(le,!0)),mousedrag:le=>{le.buttons&&ae(le)},mousemove:le=>{le.buttons||ae(le)}};this.register(this.coreMouseService.onProtocolChange((le=>{le?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(le)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&le?ne.mousemove||(W.addEventListener("mousemove",Z.mousemove),ne.mousemove=Z.mousemove):(W.removeEventListener("mousemove",ne.mousemove),ne.mousemove=null),16&le?ne.wheel||(W.addEventListener("wheel",Z.wheel,{passive:!1}),ne.wheel=Z.wheel):(W.removeEventListener("wheel",ne.wheel),ne.wheel=null),2&le?ne.mouseup||(ne.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",ne.mouseup),ne.mouseup=null),4&le?ne.mousedrag||(ne.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",ne.mousedrag),ne.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,m.addDisposableDomListener)(W,"mousedown",(le=>{if(le.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(le))return ae(le),ne.mouseup&&this._document.addEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.addEventListener("mousemove",ne.mousedrag),this.cancel(le)}))),this.register((0,m.addDisposableDomListener)(W,"wheel",(le=>{if(!ne.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(le)===!1)return!1;if(!this.buffer.hasScrollback){const Ce=this.viewport.getLinesScrolled(le);if(Ce===0)return;const Le=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(le.deltaY<0?"A":"B");let Ge="";for(let me=0;me<Math.abs(Ce);me++)Ge+=Le;return this.coreService.triggerDataEvent(Ge,!0),this.cancel(le,!0)}return this.viewport.handleWheel(le)?this.cancel(le):void 0}}),{passive:!1})),this.register((0,m.addDisposableDomListener)(W,"touchstart",(le=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(le),this.cancel(le)}),{passive:!0})),this.register((0,m.addDisposableDomListener)(W,"touchmove",(le=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(le)?void 0:this.cancel(le)}),{passive:!1}))}refresh(J,W){var ae;(ae=this._renderService)==null||ae.refreshRows(J,W)}updateCursorStyle(J){var W;(W=this._selectionService)!=null&&W.shouldColumnSelect(J)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(J,W,ae=0){var ne;ae===1?(super.scrollLines(J,W,ae),this.refresh(0,this.rows-1)):(ne=this.viewport)==null||ne.scrollLines(J)}paste(J){(0,f.paste)(J,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(J){this._customKeyEventHandler=J}attachCustomWheelEventHandler(J){this._customWheelEventHandler=J}registerLinkProvider(J){return this._linkProviderService.registerLinkProvider(J)}registerCharacterJoiner(J){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const W=this._characterJoinerService.register(J);return this.refresh(0,this.rows-1),W}deregisterCharacterJoiner(J){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(J)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(J){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+J)}registerDecoration(J){return this._decorationService.registerDecoration(J)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(J,W,ae){this._selectionService.setSelection(J,W,ae)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var J;(J=this._selectionService)==null||J.clearSelection()}selectAll(){var J;(J=this._selectionService)==null||J.selectAll()}selectLines(J,W){var ae;(ae=this._selectionService)==null||ae.selectLines(J,W)}_keyDown(J){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(J)===!1)return!1;const W=this.browser.isMac&&this.options.macOptionIsMeta&&J.altKey;if(!W&&!this._compositionHelper.keydown(J))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;W||J.key!=="Dead"&&J.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,q.evaluateKeyboardEvent)(J,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(J),ae.type===3||ae.type===2){const ne=this.rows-1;return this.scrollLines(ae.type===2?-ne:ne),this.cancel(J,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,J)||(ae.cancel&&this.cancel(J,!0),!ae.key||!!(J.key&&!J.ctrlKey&&!J.altKey&&!J.metaKey&&J.key.length===1&&J.key.charCodeAt(0)>=65&&J.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==X.C0.ETX&&ae.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:J}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||J.altKey||J.ctrlKey?this.cancel(J,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(J,W){const ae=J.isMac&&!this.options.macOptionIsMeta&&W.altKey&&!W.ctrlKey&&!W.metaKey||J.isWindows&&W.altKey&&W.ctrlKey&&!W.metaKey||J.isWindows&&W.getModifierState("AltGraph");return W.type==="keypress"?ae:ae&&(!W.keyCode||W.keyCode>47)}_keyUp(J){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(J)===!1||((function(W){return W.keyCode===16||W.keyCode===17||W.keyCode===18})(J)||this.focus(),this.updateCursorStyle(J),this._keyPressHandled=!1)}_keyPress(J){let W;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(J)===!1)return!1;if(this.cancel(J),J.charCode)W=J.charCode;else if(J.which===null||J.which===void 0)W=J.keyCode;else{if(J.which===0||J.charCode===0)return!1;W=J.which}return!(!W||(J.altKey||J.ctrlKey||J.metaKey)&&!this._isThirdLevelShift(this.browser,J)||(W=String.fromCharCode(W),this._onKey.fire({key:W,domEvent:J}),this._showCursor(),this.coreService.triggerDataEvent(W,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(J){if(J.data&&J.inputType==="insertText"&&(!J.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const W=J.data;return this.coreService.triggerDataEvent(W,!0),this.cancel(J),!0}return!1}resize(J,W){J!==this.cols||W!==this.rows?super.resize(J,W):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(J,W){var ae,ne;(ae=this._charSizeService)==null||ae.measure(),(ne=this.viewport)==null||ne.syncScrollArea(!0)}clear(){var J;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let W=1;W<this.rows;W++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(J=this.viewport)==null||J.reset(),this.refresh(0,this.rows-1)}}reset(){var W,ae;this.options.rows=this.rows,this.options.cols=this.cols;const J=this._customKeyEventHandler;this._setup(),super.reset(),(W=this._selectionService)==null||W.reset(),this._decorationService.reset(),(ae=this.viewport)==null||ae.reset(),this._customKeyEventHandler=J,this.refresh(0,this.rows-1)}clearTextureAtlas(){var J;(J=this._renderService)==null||J.clearTextureAtlas()}_reportFocus(){var J;(J=this.element)!=null&&J.classList.contains("focus")?this.coreService.triggerDataEvent(X.C0.ESC+"[I"):this.coreService.triggerDataEvent(X.C0.ESC+"[O")}_reportWindowsOptions(J){if(this._renderService)switch(J){case G.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const W=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[4;${ae};${W}t`);break;case G.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ne=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[6;${Z};${ne}t`)}}cancel(J,W){if(this.options.cancelEvents||W)return J.preventDefault(),J.stopPropagation(),!1}}l.Terminal=ce},9924:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(d,f=1e3){this._renderCallback=d,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,f,m){this._rowCount=m,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const x=h-this._lastRefreshMs,w=this._debounceThresholdMS-x;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),w)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f)}}},1680:function(u,l,d){var f=this&&this.__decorate||function(y,g,b,k){var E,P=arguments.length,A=P<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,g,b,k);else for(var N=y.length-1;N>=0;N--)(E=y[N])&&(A=(P<3?E(A):P>3?E(g,b,A):E(g,b))||A);return P>3&&A&&Object.defineProperty(g,b,A),A},m=this&&this.__param||function(y,g){return function(b,k){g(b,k,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const h=d(3656),x=d(4725),w=d(8460),j=d(844),C=d(2585);let v=l.Viewport=class extends j.Disposable{constructor(y,g,b,k,E,P,A,N){super(),this._viewportElement=y,this._scrollArea=g,this._bufferService=b,this._optionsService=k,this._charSizeService=E,this._renderService=P,this._coreBrowserService=A,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(N.colors),this.register(N.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(y){this._viewportElement.style.backgroundColor=y.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(y){if(y)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const g=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==g&&(this._lastRecordedBufferHeight=g,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const y=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==y&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=y),this._refreshAnimationFrame=null}syncScrollArea(y=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(y);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(y)}_handleScroll(y){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const g=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:g,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const y=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(y*(this._smoothScrollState.target-this._smoothScrollState.origin)),y<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(y,g){const b=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(g<0&&this._viewportElement.scrollTop!==0||g>0&&b<this._lastRecordedBufferHeight)||(y.cancelable&&y.preventDefault(),!1)}handleWheel(y){const g=this._getPixelsScrolled(y);return g!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+g:this._smoothScrollState.target+=g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=g,this._bubbleScroll(y,g))}scrollLines(y){if(y!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const g=y*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!1})}_getPixelsScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let g=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_LINE?g*=this._currentRowHeight:y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._currentRowHeight*this._bufferService.rows),g}getBufferElements(y,g){var N;let b,k="";const E=[],P=g??this._bufferService.buffer.lines.length,A=this._bufferService.buffer.lines;for(let M=y;M<P;M++){const I=A.get(M);if(!I)continue;const L=(N=A.get(M+1))==null?void 0:N.isWrapped;if(k+=I.translateToString(!L),!L||M===A.length-1){const B=document.createElement("div");B.textContent=k,E.push(B),k.length>0&&(b=B),k=""}}return{bufferElements:E,cursorElement:b}}getLinesScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let g=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(g/=this._currentRowHeight+0,this._wheelPartialScroll+=g,g=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._bufferService.rows),g}_applyScrollModifier(y,g){const b=this._optionsService.rawOptions.fastScrollModifier;return b==="alt"&&g.altKey||b==="ctrl"&&g.ctrlKey||b==="shift"&&g.shiftKey?y*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:y*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(y){this._lastTouchY=y.touches[0].pageY}handleTouchMove(y){const g=this._lastTouchY-y.touches[0].pageY;return this._lastTouchY=y.touches[0].pageY,g!==0&&(this._viewportElement.scrollTop+=g,this._bubbleScroll(y,g))}};l.Viewport=v=f([m(2,C.IBufferService),m(3,C.IOptionsService),m(4,x.ICharSizeService),m(5,x.IRenderService),m(6,x.ICoreBrowserService),m(7,x.IThemeService)],v)},3107:function(u,l,d){var f=this&&this.__decorate||function(C,v,y,g){var b,k=arguments.length,E=k<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,y):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(C,v,y,g);else for(var P=C.length-1;P>=0;P--)(b=C[P])&&(E=(k<3?b(E):k>3?b(v,y,E):b(v,y))||E);return k>3&&E&&Object.defineProperty(v,y,E),E},m=this&&this.__param||function(C,v){return function(y,g){v(y,g,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const h=d(4725),x=d(844),w=d(2585);let j=l.BufferDecorationRenderer=class extends x.Disposable{constructor(C,v,y,g,b){super(),this._screenElement=C,this._bufferService=v,this._coreBrowserService=y,this._decorationService=g,this._renderService=b,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((k=>this._removeDecoration(k)))),this.register((0,x.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var g;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((g=C==null?void 0:C.options)==null?void 0:g.layer)==="top"),v.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",v.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const y=C.options.x??0;return y&&y>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(C,v),v}_refreshStyle(C){const v=C.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let y=this._decorationElements.get(C);y||(y=this._createElement(C),C.element=y,this._decorationElements.set(C,y),this._container.appendChild(y),C.onDispose((()=>{this._decorationElements.delete(C),y.remove()}))),y.style.top=v*this._renderService.dimensions.css.cell.height+"px",y.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(y)}}_refreshXPosition(C,v=C.element){if(!v)return;const y=C.options.x??0;(C.options.anchor||"left")==="right"?v.style.right=y?y*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=y?y*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var v;(v=this._decorationElements.get(C))==null||v.remove(),this._decorationElements.delete(C),C.dispose()}};l.BufferDecorationRenderer=j=f([m(1,w.IBufferService),m(2,h.ICoreBrowserService),m(3,w.IDecorationService),m(4,h.IRenderService)],j)},5871:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(d){if(d.options.overviewRulerOptions){for(const f of this._zones)if(f.color===d.options.overviewRulerOptions.color&&f.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,d.marker.line))return;if(this._lineAdjacentToZone(f,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(f,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,f){return f>=d.startBufferLine&&f<=d.endBufferLine}_lineAdjacentToZone(d,f,m){return f>=d.startBufferLine-this._linePadding[m||"full"]&&f<=d.endBufferLine+this._linePadding[m||"full"]}_addLineToZone(d,f){d.startBufferLine=Math.min(d.startBufferLine,f),d.endBufferLine=Math.max(d.endBufferLine,f)}}},5744:function(u,l,d){var f=this&&this.__decorate||function(b,k,E,P){var A,N=arguments.length,M=N<3?k:P===null?P=Object.getOwnPropertyDescriptor(k,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(b,k,E,P);else for(var I=b.length-1;I>=0;I--)(A=b[I])&&(M=(N<3?A(M):N>3?A(k,E,M):A(k,E))||M);return N>3&&M&&Object.defineProperty(k,E,M),M},m=this&&this.__param||function(b,k){return function(E,P){k(E,P,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const h=d(5871),x=d(4725),w=d(844),j=d(2585),C={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0};let g=l.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(b,k,E,P,A,N,M){var L;super(),this._viewportElement=b,this._screenElement=k,this._bufferService=E,this._decorationService=P,this._renderService=A,this._optionsService=N,this._coreBrowserService=M,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(L=this._viewportElement.parentElement)==null||L.insertBefore(this._canvas,this._viewportElement);const I=this._canvas.getContext("2d");if(!I)throw new Error("Ctx cannot be null");this._ctx=I,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.toDisposable)((()=>{var B;(B=this._canvas)==null||B.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const b=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=b,v.center=k,v.right=b,this._refreshDrawHeightConstants(),y.full=0,y.left=0,y.center=v.left,y.right=v.left+v.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const b=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(b,12),6)*this._coreBrowserService.dpr);C.left=k,C.center=k,C.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const b=this._colorZoneStore.zones;for(const k of b)k.position!=="full"&&this._renderColorZone(k);for(const k of b)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(b){this._ctx.fillStyle=b.color,this._ctx.fillRect(y[b.position||"full"],Math.round((this._canvas.height-1)*(b.startBufferLine/this._bufferService.buffers.active.lines.length)-C[b.position||"full"]/2),v[b.position||"full"],Math.round((this._canvas.height-1)*((b.endBufferLine-b.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[b.position||"full"]))}_queueRefresh(b,k){this._shouldUpdateDimensions=b||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=g=f([m(2,j.IBufferService),m(3,j.IDecorationService),m(4,x.IRenderService),m(5,j.IOptionsService),m(6,x.ICoreBrowserService)],g)},2950:function(u,l,d){var f=this&&this.__decorate||function(C,v,y,g){var b,k=arguments.length,E=k<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,y):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(C,v,y,g);else for(var P=C.length-1;P>=0;P--)(b=C[P])&&(E=(k<3?b(E):k>3?b(v,y,E):b(v,y))||E);return k>3&&E&&Object.defineProperty(v,y,E),E},m=this&&this.__param||function(C,v){return function(y,g){v(y,g,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const h=d(4725),x=d(2585),w=d(2584);let j=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,v,y,g,b,k){this._textarea=C,this._compositionView=v,this._bufferService=y,this._optionsService=g,this._coreService=b,this._renderService=k,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let y;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,y=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),y.length>0&&this._coreService.triggerDataEvent(y,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,y=v.replace(C,"");this._dataAlreadySent=y,v.length>C.length?this._coreService.triggerDataEvent(y,!0):v.length<C.length?this._coreService.triggerDataEvent(`${w.C0.DEL}`,!0):v.length===C.length&&v!==C&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),y=this._renderService.dimensions.css.cell.height,g=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,b=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=b+"px",this._compositionView.style.top=g+"px",this._compositionView.style.height=y+"px",this._compositionView.style.lineHeight=y+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=b+"px",this._textarea.style.top=g+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=j=f([m(2,x.IBufferService),m(3,x.IOptionsService),m(4,x.ICoreService),m(5,h.IRenderService)],j)},9806:(u,l)=>{function d(f,m,h){const x=h.getBoundingClientRect(),w=f.getComputedStyle(h),j=parseInt(w.getPropertyValue("padding-left")),C=parseInt(w.getPropertyValue("padding-top"));return[m.clientX-x.left-j,m.clientY-x.top-C]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=d,l.getCoords=function(f,m,h,x,w,j,C,v,y){if(!j)return;const g=d(f,m,h);return g?(g[0]=Math.ceil((g[0]+(y?C/2:0))/C),g[1]=Math.ceil(g[1]/v),g[0]=Math.min(Math.max(g[0],1),x+(y?1:0)),g[1]=Math.min(Math.max(g[1],1),w),g):void 0}},9504:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=d(2584);function m(v,y,g,b){const k=v-h(v,g),E=y-h(y,g),P=Math.abs(k-E)-(function(A,N,M){let I=0;const L=A-h(A,M),B=N-h(N,M);for(let z=0;z<Math.abs(L-B);z++){const Y=x(A,N)==="A"?-1:1,H=M.buffer.lines.get(L+Y*z);H!=null&&H.isWrapped&&I++}return I})(v,y,g);return C(P,j(x(v,y),b))}function h(v,y){let g=0,b=y.buffer.lines.get(v),k=b==null?void 0:b.isWrapped;for(;k&&v>=0&&v<y.rows;)g++,b=y.buffer.lines.get(--v),k=b==null?void 0:b.isWrapped;return g}function x(v,y){return v>y?"A":"B"}function w(v,y,g,b,k,E){let P=v,A=y,N="";for(;P!==g||A!==b;)P+=k?1:-1,k&&P>E.cols-1?(N+=E.buffer.translateBufferLineToString(A,!1,v,P),P=0,v=0,A++):!k&&P<0&&(N+=E.buffer.translateBufferLineToString(A,!1,0,v+1),P=E.cols-1,v=P,A--);return N+E.buffer.translateBufferLineToString(A,!1,v,P)}function j(v,y){const g=y?"O":"[";return f.C0.ESC+g+v}function C(v,y){v=Math.floor(v);let g="";for(let b=0;b<v;b++)g+=y;return g}l.moveToCellSequence=function(v,y,g,b){const k=g.buffer.x,E=g.buffer.y;if(!g.buffer.hasScrollback)return(function(N,M,I,L,B,z){return m(M,L,B,z).length===0?"":C(w(N,M,N,M-h(M,B),!1,B).length,j("D",z))})(k,E,0,y,g,b)+m(E,y,g,b)+(function(N,M,I,L,B,z){let Y;Y=m(M,L,B,z).length>0?L-h(L,B):M;const H=L,U=(function(X,q,O,R,$,G){let F;return F=m(O,R,$,G).length>0?R-h(R,$):q,X<O&&F<=R||X>=O&&F<R?"C":"D"})(N,M,I,L,B,z);return C(w(N,Y,I,H,U==="C",B).length,j(U,z))})(k,E,v,y,g,b);let P;if(E===y)return P=k>v?"D":"C",C(Math.abs(k-v),j(P,b));P=E>y?"D":"C";const A=Math.abs(E-y);return C((function(N,M){return M.cols-N})(E>y?v:k,g)+(A-1)*g.cols+1+((E>y?k:v)-1),j(P,b))}},1296:function(u,l,d){var f=this&&this.__decorate||function(z,Y,H,U){var X,q=arguments.length,O=q<3?Y:U===null?U=Object.getOwnPropertyDescriptor(Y,H):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(z,Y,H,U);else for(var R=z.length-1;R>=0;R--)(X=z[R])&&(O=(q<3?X(O):q>3?X(Y,H,O):X(Y,H))||O);return q>3&&O&&Object.defineProperty(Y,H,O),O},m=this&&this.__param||function(z,Y){return function(H,U){Y(H,U,z)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const h=d(3787),x=d(2550),w=d(2223),j=d(6171),C=d(6052),v=d(4725),y=d(8055),g=d(8460),b=d(844),k=d(2585),E="xterm-dom-renderer-owner-",P="xterm-rows",A="xterm-fg-",N="xterm-bg-",M="xterm-focus",I="xterm-selection";let L=1,B=l.DomRenderer=class extends b.Disposable{constructor(z,Y,H,U,X,q,O,R,$,G,F,te,ce){super(),this._terminal=z,this._document=Y,this._element=H,this._screenElement=U,this._viewportElement=X,this._helperContainer=q,this._linkifier2=O,this._charSizeService=$,this._optionsService=G,this._bufferService=F,this._coreBrowserService=te,this._themeService=ce,this._terminalClass=L++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new g.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(P),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(I),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,j.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((fe=>this._injectCss(fe)))),this._injectCss(this._themeService.colors),this._rowFactory=R.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(E+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((fe=>this._handleLinkHover(fe)))),this.register(this._linkifier2.onHideLinkUnderline((fe=>this._handleLinkLeave(fe)))),this.register((0,b.toDisposable)((()=>{this._element.classList.remove(E+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new x.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const z=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*z,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*z),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/z),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/z),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Y=`${this._terminalSelector} .${P} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Y,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(z){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Y=`${this._terminalSelector} .${P} { color: ${z.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Y+=`${this._terminalSelector} .${P} .xterm-dim { color: ${y.color.multiplyOpacity(z.foreground,.5).css};}`,Y+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const H=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;Y+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,Y+=`@keyframes ${U} { 50% { box-shadow: none; }}`,Y+=`@keyframes ${X} { 0% { background-color: ${z.cursor.css}; color: ${z.cursorAccent.css}; } 50% { background-color: inherit; color: ${z.cursor.css}; }}`,Y+=`${this._terminalSelector} .${P}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${P}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${P}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-block { background-color: ${z.cursor.css}; color: ${z.cursorAccent.css};}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${z.cursor.css} !important; color: ${z.cursorAccent.css} !important;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${z.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${z.cursor.css} inset;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${z.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Y+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${z.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${z.selectionInactiveBackgroundOpaque.css};}`;for(const[q,O]of z.ansi.entries())Y+=`${this._terminalSelector} .${A}${q} { color: ${O.css}; }${this._terminalSelector} .${A}${q}.xterm-dim { color: ${y.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${N}${q} { background-color: ${O.css}; }`;Y+=`${this._terminalSelector} .${A}${w.INVERTED_DEFAULT_COLOR} { color: ${y.color.opaque(z.background).css}; }${this._terminalSelector} .${A}${w.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${y.color.multiplyOpacity(y.color.opaque(z.background),.5).css}; }${this._terminalSelector} .${N}${w.INVERTED_DEFAULT_COLOR} { background-color: ${z.foreground.css}; }`,this._themeStyleElement.textContent=Y}_setDefaultSpacing(){const z=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${z}px`,this._rowFactory.defaultSpacing=z}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(z,Y){for(let H=this._rowElements.length;H<=Y;H++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>Y;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(z,Y){this._refreshRowElements(z,Y),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(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(z,Y,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(z,Y,H),this.renderRows(0,this._bufferService.rows-1),!z||!Y)return;this._selectionRenderModel.update(this._terminal,z,Y,H);const U=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,q=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(q>=this._bufferService.rows||O<0)return;const R=this._document.createDocumentFragment();if(H){const $=z[0]>Y[0];R.appendChild(this._createSelectionElement(q,$?Y[0]:z[0],$?z[0]:Y[0],O-q+1))}else{const $=U===q?z[0]:0,G=q===X?Y[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(q,$,G));const F=O-q-1;if(R.appendChild(this._createSelectionElement(q+1,0,this._bufferService.cols,F)),q!==O){const te=X===O?Y[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(O,0,te))}}this._selectionContainer.appendChild(R)}_createSelectionElement(z,Y,H,U=1){const X=this._document.createElement("div"),q=Y*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(H-Y);return q+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-q),X.style.height=U*this.dimensions.css.cell.height+"px",X.style.top=z*this.dimensions.css.cell.height+"px",X.style.left=`${q}px`,X.style.width=`${O}px`,X}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const z of this._rowElements)z.replaceChildren()}renderRows(z,Y){const H=this._bufferService.buffer,U=H.ybase+H.y,X=Math.min(H.x,this._bufferService.cols-1),q=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,R=this._optionsService.rawOptions.cursorInactiveStyle;for(let $=z;$<=Y;$++){const G=$+H.ydisp,F=this._rowElements[$],te=H.lines.get(G);if(!F||!te)break;F.replaceChildren(...this._rowFactory.createRow(te,G,G===U,O,R,X,q,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${E}${this._terminalClass}`}_handleLinkHover(z){this._setCellUnderline(z.x1,z.x2,z.y1,z.y2,z.cols,!0)}_handleLinkLeave(z){this._setCellUnderline(z.x1,z.x2,z.y1,z.y2,z.cols,!1)}_setCellUnderline(z,Y,H,U,X,q){H<0&&(z=0),U<0&&(Y=0);const O=this._bufferService.rows-1;H=Math.max(Math.min(H,O),0),U=Math.max(Math.min(U,O),0),X=Math.min(X,this._bufferService.cols);const R=this._bufferService.buffer,$=R.ybase+R.y,G=Math.min(R.x,X-1),F=this._optionsService.rawOptions.cursorBlink,te=this._optionsService.rawOptions.cursorStyle,ce=this._optionsService.rawOptions.cursorInactiveStyle;for(let fe=H;fe<=U;++fe){const J=fe+R.ydisp,W=this._rowElements[fe],ae=R.lines.get(J);if(!W||!ae)break;W.replaceChildren(...this._rowFactory.createRow(ae,J,J===$,te,ce,G,F,this.dimensions.css.cell.width,this._widthCache,q?fe===H?z:0:-1,q?(fe===U?Y:X)-1:-1))}}};l.DomRenderer=B=f([m(7,k.IInstantiationService),m(8,v.ICharSizeService),m(9,k.IOptionsService),m(10,k.IBufferService),m(11,v.ICoreBrowserService),m(12,v.IThemeService)],B)},3787:function(u,l,d){var f=this&&this.__decorate||function(P,A,N,M){var I,L=arguments.length,B=L<3?A:M===null?M=Object.getOwnPropertyDescriptor(A,N):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(P,A,N,M);else for(var z=P.length-1;z>=0;z--)(I=P[z])&&(B=(L<3?I(B):L>3?I(A,N,B):I(A,N))||B);return L>3&&B&&Object.defineProperty(A,N,B),B},m=this&&this.__param||function(P,A){return function(N,M){A(N,M,P)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const h=d(2223),x=d(643),w=d(511),j=d(2585),C=d(8055),v=d(4725),y=d(4269),g=d(6171),b=d(3734);let k=l.DomRendererRowFactory=class{constructor(P,A,N,M,I,L,B){this._document=P,this._characterJoinerService=A,this._optionsService=N,this._coreBrowserService=M,this._coreService=I,this._decorationService=L,this._themeService=B,this._workCell=new w.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(P,A,N){this._selectionStart=P,this._selectionEnd=A,this._columnSelectMode=N}createRow(P,A,N,M,I,L,B,z,Y,H,U){const X=[],q=this._characterJoinerService.getJoinedCharacters(A),O=this._themeService.colors;let R,$=P.getNoBgTrimmedLength();N&&$<L+1&&($=L+1);let G=0,F="",te=0,ce=0,fe=0,J=!1,W=0,ae=!1,ne=0;const Z=[],le=H!==-1&&U!==-1;for(let Ce=0;Ce<$;Ce++){P.loadCell(Ce,this._workCell);let Le=this._workCell.getWidth();if(Le===0)continue;let Ge=!1,me=Ce,be=this._workCell;if(q.length>0&&Ce===q[0][0]){Ge=!0;const at=q.shift();be=new y.JoinedCellData(this._workCell,P.translateToString(!0,at[0],at[1]),at[1]-at[0]),me=at[1]-1,Le=be.getWidth()}const Be=this._isCellInSelection(Ce,A),Ke=N&&Ce===L,Qe=le&&Ce>=H&&Ce<=U;let je=!1;this._decorationService.forEachDecorationAtCell(Ce,A,void 0,(at=>{je=!0}));let we=be.getChars()||x.WHITESPACE_CELL_CHAR;if(we===" "&&(be.isUnderline()||be.isOverline())&&(we=" "),ne=Le*z-Y.get(we,be.isBold(),be.isItalic()),R){if(G&&(Be&&ae||!Be&&!ae&&be.bg===te)&&(Be&&ae&&O.selectionForeground||be.fg===ce)&&be.extended.ext===fe&&Qe===J&&ne===W&&!Ke&&!Ge&&!je){be.isInvisible()?F+=x.WHITESPACE_CELL_CHAR:F+=we,G++;continue}G&&(R.textContent=F),R=this._document.createElement("span"),G=0,F=""}else R=this._document.createElement("span");if(te=be.bg,ce=be.fg,fe=be.extended.ext,J=Qe,W=ne,ae=Be,Ge&&L>=Ce&&L<=me&&(L=Ce),!this._coreService.isCursorHidden&&Ke&&this._coreService.isCursorInitialized){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)B&&Z.push("xterm-cursor-blink"),Z.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(be.isBold()&&Z.push("xterm-bold"),be.isItalic()&&Z.push("xterm-italic"),be.isDim()&&Z.push("xterm-dim"),F=be.isInvisible()?x.WHITESPACE_CELL_CHAR:be.getChars()||x.WHITESPACE_CELL_CHAR,be.isUnderline()&&(Z.push(`xterm-underline-${be.extended.underlineStyle}`),F===" "&&(F=" "),!be.isUnderlineColorDefault()))if(be.isUnderlineColorRGB())R.style.textDecorationColor=`rgb(${b.AttributeData.toColorRGB(be.getUnderlineColor()).join(",")})`;else{let at=be.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&be.isBold()&&at<8&&(at+=8),R.style.textDecorationColor=O.ansi[at].css}be.isOverline()&&(Z.push("xterm-overline"),F===" "&&(F=" ")),be.isStrikethrough()&&Z.push("xterm-strikethrough"),Qe&&(R.style.textDecoration="underline");let ve=be.getFgColor(),_e=be.getFgColorMode(),Oe=be.getBgColor(),de=be.getBgColorMode();const ye=!!be.isInverse();if(ye){const at=ve;ve=Oe,Oe=at;const ur=_e;_e=de,de=ur}let De,ze,Je,Et=!1;switch(this._decorationService.forEachDecorationAtCell(Ce,A,void 0,(at=>{at.options.layer!=="top"&&Et||(at.backgroundColorRGB&&(de=50331648,Oe=at.backgroundColorRGB.rgba>>8&16777215,De=at.backgroundColorRGB),at.foregroundColorRGB&&(_e=50331648,ve=at.foregroundColorRGB.rgba>>8&16777215,ze=at.foregroundColorRGB),Et=at.options.layer==="top")})),!Et&&Be&&(De=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,Oe=De.rgba>>8&16777215,de=50331648,Et=!0,O.selectionForeground&&(_e=50331648,ve=O.selectionForeground.rgba>>8&16777215,ze=O.selectionForeground)),Et&&Z.push("xterm-decoration-top"),de){case 16777216:case 33554432:Je=O.ansi[Oe],Z.push(`xterm-bg-${Oe}`);break;case 50331648:Je=C.channels.toColor(Oe>>16,Oe>>8&255,255&Oe),this._addStyle(R,`background-color:#${E((Oe>>>0).toString(16),"0",6)}`);break;default:ye?(Je=O.foreground,Z.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):Je=O.background}switch(De||be.isDim()&&(De=C.color.multiplyOpacity(Je,.5)),_e){case 16777216:case 33554432:be.isBold()&&ve<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ve+=8),this._applyMinimumContrast(R,Je,O.ansi[ve],be,De,void 0)||Z.push(`xterm-fg-${ve}`);break;case 50331648:const at=C.channels.toColor(ve>>16&255,ve>>8&255,255&ve);this._applyMinimumContrast(R,Je,at,be,De,ze)||this._addStyle(R,`color:#${E(ve.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,Je,O.foreground,be,De,ze)||ye&&Z.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}Z.length&&(R.className=Z.join(" "),Z.length=0),Ke||Ge||je?R.textContent=F:G++,ne!==this.defaultSpacing&&(R.style.letterSpacing=`${ne}px`),X.push(R),Ce=me}return R&&G&&(R.textContent=F),X}_applyMinimumContrast(P,A,N,M,I,L){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,g.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const B=this._getContrastCache(M);let z;if(I||L||(z=B.getColor(A.rgba,N.rgba)),z===void 0){const Y=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);z=C.color.ensureContrastRatio(I||A,L||N,Y),B.setColor((I||A).rgba,(L||N).rgba,z??null)}return!!z&&(this._addStyle(P,`color:${z.css}`),!0)}_getContrastCache(P){return P.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(P,A){P.setAttribute("style",`${P.getAttribute("style")||""}${A};`)}_isCellInSelection(P,A){const N=this._selectionStart,M=this._selectionEnd;return!(!N||!M)&&(this._columnSelectMode?N[0]<=M[0]?P>=N[0]&&A>=N[1]&&P<M[0]&&A<=M[1]:P<N[0]&&A>=N[1]&&P>=M[0]&&A<=M[1]:A>N[1]&&A<M[1]||N[1]===M[1]&&A===N[1]&&P>=N[0]&&P<M[0]||N[1]<M[1]&&A===M[1]&&P<M[0]||N[1]<M[1]&&A===N[1]&&P>=N[0])}};function E(P,A,N){for(;P.length<N;)P=A+P;return P}l.DomRendererRowFactory=k=f([m(1,v.ICharacterJoinerService),m(2,j.IOptionsService),m(3,v.ICoreBrowserService),m(4,j.ICoreService),m(5,j.IDecorationService),m(6,v.IThemeService)],k)},2550:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(d,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const m=d.createElement("span");m.classList.add("xterm-char-measure-element");const h=d.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const x=d.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontStyle="italic";const w=d.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontWeight="bold",w.style.fontStyle="italic",this._measureElements=[m,h,x,w],this._container.appendChild(m),this._container.appendChild(h),this._container.appendChild(x),this._container.appendChild(w),f.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(d,f,m,h){d===this._font&&f===this._fontSize&&m===this._weight&&h===this._weightBold||(this._font=d,this._fontSize=f,this._weight=m,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${m}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${m}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(d,f,m){let h=0;if(!f&&!m&&d.length===1&&(h=d.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const j=this._measure(d,0);return j>0&&(this._flat[h]=j),j}let x=d;f&&(x+="B"),m&&(x+="I");let w=this._holey.get(x);if(w===void 0){let j=0;f&&(j|=1),m&&(j|=2),w=this._measure(d,j),w>0&&this._holey.set(x,w)}return w}_measure(d,f){const m=this._measureElements[f];return m.textContent=d.repeat(32),m.offsetWidth/32}}},2223:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=d(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(u,l)=>{function d(m){return 57508<=m&&m<=57558}function f(m){return m>=128512&&m<=128591||m>=127744&&m<=128511||m>=128640&&m<=128767||m>=9728&&m<=9983||m>=9984&&m<=10175||m>=65024&&m<=65039||m>=129280&&m<=129535||m>=127462&&m<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(m){if(!m)throw new Error("value must not be falsy");return m},l.isPowerlineGlyph=d,l.isRestrictedPowerlineGlyph=function(m){return 57520<=m&&m<=57527},l.isEmoji=f,l.allowRescaling=function(m,h,x,w){return h===1&&x>Math.ceil(1.5*w)&&m!==void 0&&m>255&&!f(m)&&!d(m)&&!(function(j){return 57344<=j&&j<=63743})(m)},l.treatGlyphAsBackgroundColor=function(m){return d(m)||(function(h){return 9472<=h&&h<=9631})(m)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(m,h,x=0){return(m-(2*Math.round(h)-x))%(2*Math.round(h))}},6052:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class d{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(m,h,x,w=!1){if(this.selectionStart=h,this.selectionEnd=x,!h||!x||h[0]===x[0]&&h[1]===x[1])return void this.clear();const j=m.buffers.active.ydisp,C=h[1]-j,v=x[1]-j,y=Math.max(C,0),g=Math.min(v,m.rows-1);y>=m.rows||g<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=w,this.viewportStartRow=C,this.viewportEndRow=v,this.viewportCappedStartRow=y,this.viewportCappedEndRow=g,this.startCol=h[0],this.endCol=x[0])}isCellSelected(m,h,x){return!!this.hasSelection&&(x-=m.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&x>=this.viewportCappedStartRow&&h<this.endCol&&x<=this.viewportCappedEndRow:h<this.startCol&&x>=this.viewportCappedStartRow&&h>=this.endCol&&x<=this.viewportCappedEndRow:x>this.viewportStartRow&&x<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&x===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportStartRow&&h>=this.startCol)}}l.createSelectionRenderModel=function(){return new d}},456:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(d){this._bufferService=d,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?d%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)-1]:[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[d,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[Math.max(d,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const d=this.selectionStart,f=this.selectionEnd;return!(!d||!f)&&(d[1]>f[1]||d[1]===f[1]&&d[0]>f[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(u,l,d){var f=this&&this.__decorate||function(g,b,k,E){var P,A=arguments.length,N=A<3?b:E===null?E=Object.getOwnPropertyDescriptor(b,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(g,b,k,E);else for(var M=g.length-1;M>=0;M--)(P=g[M])&&(N=(A<3?P(N):A>3?P(b,k,N):P(b,k))||N);return A>3&&N&&Object.defineProperty(b,k,N),N},m=this&&this.__param||function(g,b){return function(k,E){b(k,E,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const h=d(2585),x=d(8460),w=d(844);let j=l.CharSizeService=class extends w.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(g,b,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new x.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new y(this._optionsService))}catch{this._measureStrategy=this.register(new v(g,b,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const g=this._measureStrategy.measure();g.width===this.width&&g.height===this.height||(this.width=g.width,this.height=g.height,this._onCharSizeChange.fire())}};l.CharSizeService=j=f([m(2,h.IOptionsService)],j);class C extends w.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(b,k){b!==void 0&&b>0&&k!==void 0&&k>0&&(this._result.width=b,this._result.height=k)}}class v extends C{constructor(b,k,E){super(),this._document=b,this._parentElement=k,this._optionsService=E,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class y extends C{constructor(b){super(),this._optionsService=b,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const b=this._ctx.measureText("W");return this._validateAndSet(b.width,b.fontBoundingBoxAscent+b.fontBoundingBoxDescent),this._result}}},4269:function(u,l,d){var f=this&&this.__decorate||function(y,g,b,k){var E,P=arguments.length,A=P<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,g,b,k);else for(var N=y.length-1;N>=0;N--)(E=y[N])&&(A=(P<3?E(A):P>3?E(g,b,A):E(g,b))||A);return P>3&&A&&Object.defineProperty(g,b,A),A},m=this&&this.__param||function(y,g){return function(b,k){g(b,k,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const h=d(3734),x=d(643),w=d(511),j=d(2585);class C extends h.AttributeData{constructor(g,b,k){super(),this.content=0,this.combinedData="",this.fg=g.fg,this.bg=g.bg,this.combinedData=b,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(g){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=C;let v=l.CharacterJoinerService=class Ij{constructor(g){this._bufferService=g,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new w.CellData}register(g){const b={id:this._nextCharacterJoinerId++,handler:g};return this._characterJoiners.push(b),b.id}deregister(g){for(let b=0;b<this._characterJoiners.length;b++)if(this._characterJoiners[b].id===g)return this._characterJoiners.splice(b,1),!0;return!1}getJoinedCharacters(g){if(this._characterJoiners.length===0)return[];const b=this._bufferService.buffer.lines.get(g);if(!b||b.length===0)return[];const k=[],E=b.translateToString(!0);let P=0,A=0,N=0,M=b.getFg(0),I=b.getBg(0);for(let L=0;L<b.getTrimmedLength();L++)if(b.loadCell(L,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==M||this._workCell.bg!==I){if(L-P>1){const B=this._getJoinedRanges(E,N,A,b,P);for(let z=0;z<B.length;z++)k.push(B[z])}P=L,N=A,M=this._workCell.fg,I=this._workCell.bg}A+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-P>1){const L=this._getJoinedRanges(E,N,A,b,P);for(let B=0;B<L.length;B++)k.push(L[B])}return k}_getJoinedRanges(g,b,k,E,P){const A=g.substring(b,k);let N=[];try{N=this._characterJoiners[0].handler(A)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{const I=this._characterJoiners[M].handler(A);for(let L=0;L<I.length;L++)Ij._mergeRanges(N,I[L])}catch(I){console.error(I)}return this._stringRangesToCellRanges(N,E,P),N}_stringRangesToCellRanges(g,b,k){let E=0,P=!1,A=0,N=g[E];if(N){for(let M=k;M<this._bufferService.cols;M++){const I=b.getWidth(M),L=b.getString(M).length||x.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!P&&N[0]<=A&&(N[0]=M,P=!0),N[1]<=A){if(N[1]=M,N=g[++E],!N)break;N[0]<=A?(N[0]=M,P=!0):P=!1}A+=L}}N&&(N[1]=this._bufferService.cols)}}static _mergeRanges(g,b){let k=!1;for(let E=0;E<g.length;E++){const P=g[E];if(k){if(b[1]<=P[0])return g[E-1][1]=b[1],g;if(b[1]<=P[1])return g[E-1][1]=Math.max(b[1],P[1]),g.splice(E,1),g;g.splice(E,1),E--}else{if(b[1]<=P[0])return g.splice(E,0,b),g;if(b[1]<=P[1])return P[0]=Math.min(b[0],P[0]),g;b[0]<P[1]&&(P[0]=Math.min(b[0],P[0]),k=!0)}}return k?g[g.length-1][1]=b[1]:g.push(b),g}};l.CharacterJoinerService=v=f([m(0,j.IBufferService)],v)},5114:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const f=d(844),m=d(8460),h=d(3656);class x extends f.Disposable{constructor(C,v,y){super(),this._textarea=C,this._window=v,this.mainDocument=y,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new w(this._window),this._onDprChange=this.register(new m.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new m.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((g=>this._screenDprMonitor.setWindow(g)))),this.register((0,m.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(C){this._window!==C&&(this._window=C,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}}l.CoreBrowserService=x;class w extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new m.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const f=d(844);class m extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(x){return this.linkProviders.push(x),{dispose:()=>{const w=this.linkProviders.indexOf(x);w!==-1&&this.linkProviders.splice(w,1)}}}}l.LinkProviderService=m},8934:function(u,l,d){var f=this&&this.__decorate||function(j,C,v,y){var g,b=arguments.length,k=b<3?C:y===null?y=Object.getOwnPropertyDescriptor(C,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(j,C,v,y);else for(var E=j.length-1;E>=0;E--)(g=j[E])&&(k=(b<3?g(k):b>3?g(C,v,k):g(C,v))||k);return b>3&&k&&Object.defineProperty(C,v,k),k},m=this&&this.__param||function(j,C){return function(v,y){C(v,y,j)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const h=d(4725),x=d(9806);let w=l.MouseService=class{constructor(j,C){this._renderService=j,this._charSizeService=C}getCoords(j,C,v,y,g){return(0,x.getCoords)(window,j,C,v,y,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,g)}getMouseReportCoords(j,C){const v=(0,x.getCoordsRelativeToElement)(window,j,C);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};l.MouseService=w=f([m(0,h.IRenderService),m(1,h.ICharSizeService)],w)},3230:function(u,l,d){var f=this&&this.__decorate||function(g,b,k,E){var P,A=arguments.length,N=A<3?b:E===null?E=Object.getOwnPropertyDescriptor(b,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(g,b,k,E);else for(var M=g.length-1;M>=0;M--)(P=g[M])&&(N=(A<3?P(N):A>3?P(b,k,N):P(b,k))||N);return A>3&&N&&Object.defineProperty(b,k,N),N},m=this&&this.__param||function(g,b){return function(k,E){b(k,E,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const h=d(6193),x=d(4725),w=d(8460),j=d(844),C=d(7226),v=d(2585);let y=l.RenderService=class extends j.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(g,b,k,E,P,A,N,M){super(),this._rowCount=g,this._charSizeService=E,this._renderer=this.register(new j.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new j.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new w.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new w.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new w.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((I,L)=>this._renderRows(I,L)),N),this.register(this._renderDebouncer),this.register(N.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(A.onResize((()=>this._fullRefresh()))),this.register(A.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(P.onDecorationRegistered((()=>this._fullRefresh()))),this.register(P.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(A.cols,A.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(A.buffer.y,A.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(N.window,b),this.register(N.onWindowChange((I=>this._registerIntersectionObserver(I,b))))}_registerIntersectionObserver(g,b){if("IntersectionObserver"in g){const k=new g.IntersectionObserver((E=>this._handleIntersectionChange(E[E.length-1])),{threshold:0});k.observe(b),this._observerDisposable.value=(0,j.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(g){this._isPaused=g.isIntersecting===void 0?g.intersectionRatio===0:!g.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(g,b,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(g,b,this._rowCount))}_renderRows(g,b){this._renderer.value&&(g=Math.min(g,this._rowCount-1),b=Math.min(b,this._rowCount-1),this._renderer.value.renderRows(g,b),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:g,end:b}),this._onRender.fire({start:g,end:b}),this._isNextRenderRedrawOnly=!0)}resize(g,b){this._rowCount=b,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(g){this._renderer.value=g,this._renderer.value&&(this._renderer.value.onRequestRedraw((b=>this.refreshRows(b.start,b.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(g){return this._renderDebouncer.addRefreshCallback(g)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var g,b;this._renderer.value&&((b=(g=this._renderer.value).clearTextureAtlas)==null||b.call(g),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(g,b){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(g,b)})):this._renderer.value.handleResize(g,b),this._fullRefresh())}handleCharSizeChanged(){var g;(g=this._renderer.value)==null||g.handleCharSizeChanged()}handleBlur(){var g;(g=this._renderer.value)==null||g.handleBlur()}handleFocus(){var g;(g=this._renderer.value)==null||g.handleFocus()}handleSelectionChanged(g,b,k){var E;this._selectionState.start=g,this._selectionState.end=b,this._selectionState.columnSelectMode=k,(E=this._renderer.value)==null||E.handleSelectionChanged(g,b,k)}handleCursorMove(){var g;(g=this._renderer.value)==null||g.handleCursorMove()}clear(){var g;(g=this._renderer.value)==null||g.clear()}};l.RenderService=y=f([m(2,v.IOptionsService),m(3,x.ICharSizeService),m(4,v.IDecorationService),m(5,v.IBufferService),m(6,x.ICoreBrowserService),m(7,x.IThemeService)],y)},9312:function(u,l,d){var f=this&&this.__decorate||function(N,M,I,L){var B,z=arguments.length,Y=z<3?M:L===null?L=Object.getOwnPropertyDescriptor(M,I):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(N,M,I,L);else for(var H=N.length-1;H>=0;H--)(B=N[H])&&(Y=(z<3?B(Y):z>3?B(M,I,Y):B(M,I))||Y);return z>3&&Y&&Object.defineProperty(M,I,Y),Y},m=this&&this.__param||function(N,M){return function(I,L){M(I,L,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const h=d(9806),x=d(9504),w=d(456),j=d(4725),C=d(8460),v=d(844),y=d(6114),g=d(4841),b=d(511),k=d(2585),E=" ",P=new RegExp(E,"g");let A=l.SelectionService=class extends v.Disposable{constructor(N,M,I,L,B,z,Y,H,U){super(),this._element=N,this._screenElement=M,this._linkifier=I,this._bufferService=L,this._coreService=B,this._mouseService=z,this._optionsService=Y,this._renderService=H,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new b.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new w.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!N||!M||N[0]===M[0]&&N[1]===M[1])}get selectionText(){const N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!N||!M)return"";const I=this._bufferService.buffer,L=[];if(this._activeSelectionMode===3){if(N[0]===M[0])return"";const B=N[0]<M[0]?N[0]:M[0],z=N[0]<M[0]?M[0]:N[0];for(let Y=N[1];Y<=M[1];Y++){const H=I.translateBufferLineToString(Y,!0,B,z);L.push(H)}}else{const B=N[1]===M[1]?M[0]:void 0;L.push(I.translateBufferLineToString(N[1],!0,N[0],B));for(let z=N[1]+1;z<=M[1]-1;z++){const Y=I.lines.get(z),H=I.translateBufferLineToString(z,!0);Y!=null&&Y.isWrapped?L[L.length-1]+=H:L.push(H)}if(N[1]!==M[1]){const z=I.lines.get(M[1]),Y=I.translateBufferLineToString(M[1],!0,0,M[0]);z&&z.isWrapped?L[L.length-1]+=Y:L.push(Y)}}return L.map((B=>B.replace(P," "))).join(y.isWindows?`\r
584
+ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y){try{y.opener=null}catch{}y.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=w=f([m(0,x.IBufferService),m(1,x.IOptionsService),m(2,x.IOscLinkService)],w)},6193:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(d,f){this._renderCallback=d,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,f,m){this._rowCount=m,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=d(3614),m=d(3656),h=d(3551),x=d(9042),w=d(3730),j=d(1680),C=d(3107),v=d(5744),y=d(2950),g=d(1296),b=d(428),k=d(4269),E=d(5114),P=d(8934),A=d(3230),N=d(9312),M=d(4725),I=d(6731),L=d(8055),B=d(8969),z=d(8460),Y=d(844),H=d(6114),U=d(8437),X=d(2584),q=d(7399),O=d(5941),R=d(9074),$=d(2585),G=d(5435),F=d(4567),te=d(779);class ce extends B.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(J={}){super(J),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Y.MutableDisposable),this._onCursorMove=this.register(new z.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new z.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new z.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new z.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new z.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new z.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new z.EventEmitter),this._onBlur=this.register(new z.EventEmitter),this._onA11yCharEmitter=this.register(new z.EventEmitter),this._onA11yTabEmitter=this.register(new z.EventEmitter),this._onWillOpen=this.register(new z.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(R.DecorationService),this._instantiationService.setService($.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(te.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(w.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((W,ae)=>this.refresh(W,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((W=>this._reportWindowsOptions(W)))),this.register(this._inputHandler.onColor((W=>this._handleColorEvent(W)))),this.register((0,z.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,z.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,z.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,z.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((W=>this._afterResize(W.cols,W.rows)))),this.register((0,Y.toDisposable)((()=>{var W,ae;this._customKeyEventHandler=void 0,(ae=(W=this.element)==null?void 0:W.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(J){if(this._themeService)for(const W of J){let ae,ne="";switch(W.index){case 256:ae="foreground",ne="10";break;case 257:ae="background",ne="11";break;case 258:ae="cursor",ne="12";break;default:ae="ansi",ne="4;"+W.index}switch(W.type){case 0:const Z=L.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[W.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ne};${(0,O.toRgbString)(Z)}${X.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((le=>le.ansi[W.index]=L.channels.toColor(...W.color)));else{const le=ae;this._themeService.modifyColors((Ce=>Ce[le]=L.channels.toColor(...W.color)))}break;case 2:this._themeService.restoreColor(W.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(J){J?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(J){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var J;return(J=this.textarea)==null?void 0:J.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const J=this.buffer.ybase+this.buffer.y,W=this.buffer.lines.get(J);if(!W)return;const ae=Math.min(this.buffer.x,this.cols-1),ne=this._renderService.dimensions.css.cell.height,Z=W.getWidth(ae),le=this._renderService.dimensions.css.cell.width*Z,Ce=this.buffer.y*this._renderService.dimensions.css.cell.height,Le=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Le+"px",this.textarea.style.top=Ce+"px",this.textarea.style.width=le+"px",this.textarea.style.height=ne+"px",this.textarea.style.lineHeight=ne+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,m.addDisposableDomListener)(this.element,"copy",(W=>{this.hasSelection()&&(0,f.copyHandler)(W,this._selectionService)})));const J=W=>(0,f.handlePasteEvent)(W,this.textarea,this.coreService,this.optionsService);this.register((0,m.addDisposableDomListener)(this.textarea,"paste",J)),this.register((0,m.addDisposableDomListener)(this.element,"paste",J)),H.isFirefox?this.register((0,m.addDisposableDomListener)(this.element,"mousedown",(W=>{W.button===2&&(0,f.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,m.addDisposableDomListener)(this.element,"contextmenu",(W=>{(0,f.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),H.isLinux&&this.register((0,m.addDisposableDomListener)(this.element,"auxclick",(W=>{W.button===1&&(0,f.moveTextAreaUnderMouseCursor)(W,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,m.addDisposableDomListener)(this.textarea,"keyup",(J=>this._keyUp(J)),!0)),this.register((0,m.addDisposableDomListener)(this.textarea,"keydown",(J=>this._keyDown(J)),!0)),this.register((0,m.addDisposableDomListener)(this.textarea,"keypress",(J=>this._keyPress(J)),!0)),this.register((0,m.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,m.addDisposableDomListener)(this.textarea,"compositionupdate",(J=>this._compositionHelper.compositionupdate(J)))),this.register((0,m.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,m.addDisposableDomListener)(this.textarea,"input",(J=>this._inputEvent(J)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(J){var ae;if(!J)throw new Error("Terminal requires a parent element.");if(J.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ae=this.element)==null?void 0:ae.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=J.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),J.appendChild(this.element);const W=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),W.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,m.addDisposableDomListener)(this.screenElement,"mousemove",(ne=>this.updateCursorStyle(ne)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),W.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",x.promptLabel),H.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(E.CoreBrowserService,this.textarea,J.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,m.addDisposableDomListener)(this.textarea,"focus",(ne=>this._handleTextAreaFocus(ne)))),this.register((0,m.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(b.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(A.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ne=>this._onRender.fire(ne)))),this.onResize((ne=>this._renderService.resize(ne.cols,ne.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(y.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(P.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(W);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(j.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(N.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ne=>this._renderService.handleSelectionChanged(ne.start,ne.end,ne.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ne=>{this.textarea.value=ne,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ne=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,m.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,m.addDisposableDomListener)(this.element,"mousedown",(ne=>this._selectionService.handleMouseDown(ne)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ne=>this._handleScreenReaderModeOptionChange(ne)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ne=>{!this._overviewRulerRenderer&&ne&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(g.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const J=this,W=this.element;function ae(le){const Ce=J._mouseService.getMouseReportCoords(le,J.screenElement);if(!Ce)return!1;let Le,Ge;switch(le.overrideType||le.type){case"mousemove":Ge=32,le.buttons===void 0?(Le=3,le.button!==void 0&&(Le=le.button<3?le.button:3)):Le=1&le.buttons?0:4&le.buttons?1:2&le.buttons?2:3;break;case"mouseup":Ge=0,Le=le.button<3?le.button:3;break;case"mousedown":Ge=1,Le=le.button<3?le.button:3;break;case"wheel":if(J._customWheelEventHandler&&J._customWheelEventHandler(le)===!1||J.viewport.getLinesScrolled(le)===0)return!1;Ge=le.deltaY<0?0:1,Le=4;break;default:return!1}return!(Ge===void 0||Le===void 0||Le>4)&&J.coreMouseService.triggerMouseEvent({col:Ce.col,row:Ce.row,x:Ce.x,y:Ce.y,button:Le,action:Ge,ctrl:le.ctrlKey,alt:le.altKey,shift:le.shiftKey})}const ne={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:le=>(ae(le),le.buttons||(this._document.removeEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.removeEventListener("mousemove",ne.mousedrag)),this.cancel(le)),wheel:le=>(ae(le),this.cancel(le,!0)),mousedrag:le=>{le.buttons&&ae(le)},mousemove:le=>{le.buttons||ae(le)}};this.register(this.coreMouseService.onProtocolChange((le=>{le?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(le)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&le?ne.mousemove||(W.addEventListener("mousemove",Z.mousemove),ne.mousemove=Z.mousemove):(W.removeEventListener("mousemove",ne.mousemove),ne.mousemove=null),16&le?ne.wheel||(W.addEventListener("wheel",Z.wheel,{passive:!1}),ne.wheel=Z.wheel):(W.removeEventListener("wheel",ne.wheel),ne.wheel=null),2&le?ne.mouseup||(ne.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",ne.mouseup),ne.mouseup=null),4&le?ne.mousedrag||(ne.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",ne.mousedrag),ne.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,m.addDisposableDomListener)(W,"mousedown",(le=>{if(le.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(le))return ae(le),ne.mouseup&&this._document.addEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.addEventListener("mousemove",ne.mousedrag),this.cancel(le)}))),this.register((0,m.addDisposableDomListener)(W,"wheel",(le=>{if(!ne.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(le)===!1)return!1;if(!this.buffer.hasScrollback){const Ce=this.viewport.getLinesScrolled(le);if(Ce===0)return;const Le=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(le.deltaY<0?"A":"B");let Ge="";for(let me=0;me<Math.abs(Ce);me++)Ge+=Le;return this.coreService.triggerDataEvent(Ge,!0),this.cancel(le,!0)}return this.viewport.handleWheel(le)?this.cancel(le):void 0}}),{passive:!1})),this.register((0,m.addDisposableDomListener)(W,"touchstart",(le=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(le),this.cancel(le)}),{passive:!0})),this.register((0,m.addDisposableDomListener)(W,"touchmove",(le=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(le)?void 0:this.cancel(le)}),{passive:!1}))}refresh(J,W){var ae;(ae=this._renderService)==null||ae.refreshRows(J,W)}updateCursorStyle(J){var W;(W=this._selectionService)!=null&&W.shouldColumnSelect(J)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(J,W,ae=0){var ne;ae===1?(super.scrollLines(J,W,ae),this.refresh(0,this.rows-1)):(ne=this.viewport)==null||ne.scrollLines(J)}paste(J){(0,f.paste)(J,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(J){this._customKeyEventHandler=J}attachCustomWheelEventHandler(J){this._customWheelEventHandler=J}registerLinkProvider(J){return this._linkProviderService.registerLinkProvider(J)}registerCharacterJoiner(J){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const W=this._characterJoinerService.register(J);return this.refresh(0,this.rows-1),W}deregisterCharacterJoiner(J){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(J)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(J){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+J)}registerDecoration(J){return this._decorationService.registerDecoration(J)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(J,W,ae){this._selectionService.setSelection(J,W,ae)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var J;(J=this._selectionService)==null||J.clearSelection()}selectAll(){var J;(J=this._selectionService)==null||J.selectAll()}selectLines(J,W){var ae;(ae=this._selectionService)==null||ae.selectLines(J,W)}_keyDown(J){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(J)===!1)return!1;const W=this.browser.isMac&&this.options.macOptionIsMeta&&J.altKey;if(!W&&!this._compositionHelper.keydown(J))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;W||J.key!=="Dead"&&J.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,q.evaluateKeyboardEvent)(J,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(J),ae.type===3||ae.type===2){const ne=this.rows-1;return this.scrollLines(ae.type===2?-ne:ne),this.cancel(J,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,J)||(ae.cancel&&this.cancel(J,!0),!ae.key||!!(J.key&&!J.ctrlKey&&!J.altKey&&!J.metaKey&&J.key.length===1&&J.key.charCodeAt(0)>=65&&J.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==X.C0.ETX&&ae.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:J}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||J.altKey||J.ctrlKey?this.cancel(J,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(J,W){const ae=J.isMac&&!this.options.macOptionIsMeta&&W.altKey&&!W.ctrlKey&&!W.metaKey||J.isWindows&&W.altKey&&W.ctrlKey&&!W.metaKey||J.isWindows&&W.getModifierState("AltGraph");return W.type==="keypress"?ae:ae&&(!W.keyCode||W.keyCode>47)}_keyUp(J){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(J)===!1||((function(W){return W.keyCode===16||W.keyCode===17||W.keyCode===18})(J)||this.focus(),this.updateCursorStyle(J),this._keyPressHandled=!1)}_keyPress(J){let W;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(J)===!1)return!1;if(this.cancel(J),J.charCode)W=J.charCode;else if(J.which===null||J.which===void 0)W=J.keyCode;else{if(J.which===0||J.charCode===0)return!1;W=J.which}return!(!W||(J.altKey||J.ctrlKey||J.metaKey)&&!this._isThirdLevelShift(this.browser,J)||(W=String.fromCharCode(W),this._onKey.fire({key:W,domEvent:J}),this._showCursor(),this.coreService.triggerDataEvent(W,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(J){if(J.data&&J.inputType==="insertText"&&(!J.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const W=J.data;return this.coreService.triggerDataEvent(W,!0),this.cancel(J),!0}return!1}resize(J,W){J!==this.cols||W!==this.rows?super.resize(J,W):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(J,W){var ae,ne;(ae=this._charSizeService)==null||ae.measure(),(ne=this.viewport)==null||ne.syncScrollArea(!0)}clear(){var J;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let W=1;W<this.rows;W++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(J=this.viewport)==null||J.reset(),this.refresh(0,this.rows-1)}}reset(){var W,ae;this.options.rows=this.rows,this.options.cols=this.cols;const J=this._customKeyEventHandler;this._setup(),super.reset(),(W=this._selectionService)==null||W.reset(),this._decorationService.reset(),(ae=this.viewport)==null||ae.reset(),this._customKeyEventHandler=J,this.refresh(0,this.rows-1)}clearTextureAtlas(){var J;(J=this._renderService)==null||J.clearTextureAtlas()}_reportFocus(){var J;(J=this.element)!=null&&J.classList.contains("focus")?this.coreService.triggerDataEvent(X.C0.ESC+"[I"):this.coreService.triggerDataEvent(X.C0.ESC+"[O")}_reportWindowsOptions(J){if(this._renderService)switch(J){case G.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const W=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[4;${ae};${W}t`);break;case G.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ne=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[6;${Z};${ne}t`)}}cancel(J,W){if(this.options.cancelEvents||W)return J.preventDefault(),J.stopPropagation(),!1}}l.Terminal=ce},9924:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(d,f=1e3){this._renderCallback=d,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,f,m){this._rowCount=m,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const x=h-this._lastRefreshMs,w=this._debounceThresholdMS-x;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),w)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f)}}},1680:function(u,l,d){var f=this&&this.__decorate||function(y,g,b,k){var E,P=arguments.length,A=P<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,g,b,k);else for(var N=y.length-1;N>=0;N--)(E=y[N])&&(A=(P<3?E(A):P>3?E(g,b,A):E(g,b))||A);return P>3&&A&&Object.defineProperty(g,b,A),A},m=this&&this.__param||function(y,g){return function(b,k){g(b,k,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const h=d(3656),x=d(4725),w=d(8460),j=d(844),C=d(2585);let v=l.Viewport=class extends j.Disposable{constructor(y,g,b,k,E,P,A,N){super(),this._viewportElement=y,this._scrollArea=g,this._bufferService=b,this._optionsService=k,this._charSizeService=E,this._renderService=P,this._coreBrowserService=A,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(N.colors),this.register(N.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(y){this._viewportElement.style.backgroundColor=y.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(y){if(y)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const g=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==g&&(this._lastRecordedBufferHeight=g,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const y=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==y&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=y),this._refreshAnimationFrame=null}syncScrollArea(y=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(y);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(y)}_handleScroll(y){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const g=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:g,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const y=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(y*(this._smoothScrollState.target-this._smoothScrollState.origin)),y<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(y,g){const b=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(g<0&&this._viewportElement.scrollTop!==0||g>0&&b<this._lastRecordedBufferHeight)||(y.cancelable&&y.preventDefault(),!1)}handleWheel(y){const g=this._getPixelsScrolled(y);return g!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+g:this._smoothScrollState.target+=g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=g,this._bubbleScroll(y,g))}scrollLines(y){if(y!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const g=y*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!1})}_getPixelsScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let g=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_LINE?g*=this._currentRowHeight:y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._currentRowHeight*this._bufferService.rows),g}getBufferElements(y,g){var N;let b,k="";const E=[],P=g??this._bufferService.buffer.lines.length,A=this._bufferService.buffer.lines;for(let M=y;M<P;M++){const I=A.get(M);if(!I)continue;const L=(N=A.get(M+1))==null?void 0:N.isWrapped;if(k+=I.translateToString(!L),!L||M===A.length-1){const B=document.createElement("div");B.textContent=k,E.push(B),k.length>0&&(b=B),k=""}}return{bufferElements:E,cursorElement:b}}getLinesScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let g=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(g/=this._currentRowHeight+0,this._wheelPartialScroll+=g,g=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._bufferService.rows),g}_applyScrollModifier(y,g){const b=this._optionsService.rawOptions.fastScrollModifier;return b==="alt"&&g.altKey||b==="ctrl"&&g.ctrlKey||b==="shift"&&g.shiftKey?y*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:y*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(y){this._lastTouchY=y.touches[0].pageY}handleTouchMove(y){const g=this._lastTouchY-y.touches[0].pageY;return this._lastTouchY=y.touches[0].pageY,g!==0&&(this._viewportElement.scrollTop+=g,this._bubbleScroll(y,g))}};l.Viewport=v=f([m(2,C.IBufferService),m(3,C.IOptionsService),m(4,x.ICharSizeService),m(5,x.IRenderService),m(6,x.ICoreBrowserService),m(7,x.IThemeService)],v)},3107:function(u,l,d){var f=this&&this.__decorate||function(C,v,y,g){var b,k=arguments.length,E=k<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,y):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(C,v,y,g);else for(var P=C.length-1;P>=0;P--)(b=C[P])&&(E=(k<3?b(E):k>3?b(v,y,E):b(v,y))||E);return k>3&&E&&Object.defineProperty(v,y,E),E},m=this&&this.__param||function(C,v){return function(y,g){v(y,g,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const h=d(4725),x=d(844),w=d(2585);let j=l.BufferDecorationRenderer=class extends x.Disposable{constructor(C,v,y,g,b){super(),this._screenElement=C,this._bufferService=v,this._coreBrowserService=y,this._decorationService=g,this._renderService=b,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((k=>this._removeDecoration(k)))),this.register((0,x.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var g;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((g=C==null?void 0:C.options)==null?void 0:g.layer)==="top"),v.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",v.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const y=C.options.x??0;return y&&y>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(C,v),v}_refreshStyle(C){const v=C.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let y=this._decorationElements.get(C);y||(y=this._createElement(C),C.element=y,this._decorationElements.set(C,y),this._container.appendChild(y),C.onDispose((()=>{this._decorationElements.delete(C),y.remove()}))),y.style.top=v*this._renderService.dimensions.css.cell.height+"px",y.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(y)}}_refreshXPosition(C,v=C.element){if(!v)return;const y=C.options.x??0;(C.options.anchor||"left")==="right"?v.style.right=y?y*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=y?y*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var v;(v=this._decorationElements.get(C))==null||v.remove(),this._decorationElements.delete(C),C.dispose()}};l.BufferDecorationRenderer=j=f([m(1,w.IBufferService),m(2,h.ICoreBrowserService),m(3,w.IDecorationService),m(4,h.IRenderService)],j)},5871:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(d){if(d.options.overviewRulerOptions){for(const f of this._zones)if(f.color===d.options.overviewRulerOptions.color&&f.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,d.marker.line))return;if(this._lineAdjacentToZone(f,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(f,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,f){return f>=d.startBufferLine&&f<=d.endBufferLine}_lineAdjacentToZone(d,f,m){return f>=d.startBufferLine-this._linePadding[m||"full"]&&f<=d.endBufferLine+this._linePadding[m||"full"]}_addLineToZone(d,f){d.startBufferLine=Math.min(d.startBufferLine,f),d.endBufferLine=Math.max(d.endBufferLine,f)}}},5744:function(u,l,d){var f=this&&this.__decorate||function(b,k,E,P){var A,N=arguments.length,M=N<3?k:P===null?P=Object.getOwnPropertyDescriptor(k,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(b,k,E,P);else for(var I=b.length-1;I>=0;I--)(A=b[I])&&(M=(N<3?A(M):N>3?A(k,E,M):A(k,E))||M);return N>3&&M&&Object.defineProperty(k,E,M),M},m=this&&this.__param||function(b,k){return function(E,P){k(E,P,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const h=d(5871),x=d(4725),w=d(844),j=d(2585),C={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0};let g=l.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(b,k,E,P,A,N,M){var L;super(),this._viewportElement=b,this._screenElement=k,this._bufferService=E,this._decorationService=P,this._renderService=A,this._optionsService=N,this._coreBrowserService=M,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(L=this._viewportElement.parentElement)==null||L.insertBefore(this._canvas,this._viewportElement);const I=this._canvas.getContext("2d");if(!I)throw new Error("Ctx cannot be null");this._ctx=I,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.toDisposable)((()=>{var B;(B=this._canvas)==null||B.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const b=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=b,v.center=k,v.right=b,this._refreshDrawHeightConstants(),y.full=0,y.left=0,y.center=v.left,y.right=v.left+v.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const b=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(b,12),6)*this._coreBrowserService.dpr);C.left=k,C.center=k,C.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const b=this._colorZoneStore.zones;for(const k of b)k.position!=="full"&&this._renderColorZone(k);for(const k of b)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(b){this._ctx.fillStyle=b.color,this._ctx.fillRect(y[b.position||"full"],Math.round((this._canvas.height-1)*(b.startBufferLine/this._bufferService.buffers.active.lines.length)-C[b.position||"full"]/2),v[b.position||"full"],Math.round((this._canvas.height-1)*((b.endBufferLine-b.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[b.position||"full"]))}_queueRefresh(b,k){this._shouldUpdateDimensions=b||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=g=f([m(2,j.IBufferService),m(3,j.IDecorationService),m(4,x.IRenderService),m(5,j.IOptionsService),m(6,x.ICoreBrowserService)],g)},2950:function(u,l,d){var f=this&&this.__decorate||function(C,v,y,g){var b,k=arguments.length,E=k<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,y):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(C,v,y,g);else for(var P=C.length-1;P>=0;P--)(b=C[P])&&(E=(k<3?b(E):k>3?b(v,y,E):b(v,y))||E);return k>3&&E&&Object.defineProperty(v,y,E),E},m=this&&this.__param||function(C,v){return function(y,g){v(y,g,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const h=d(4725),x=d(2585),w=d(2584);let j=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,v,y,g,b,k){this._textarea=C,this._compositionView=v,this._bufferService=y,this._optionsService=g,this._coreService=b,this._renderService=k,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let y;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,y=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),y.length>0&&this._coreService.triggerDataEvent(y,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,y=v.replace(C,"");this._dataAlreadySent=y,v.length>C.length?this._coreService.triggerDataEvent(y,!0):v.length<C.length?this._coreService.triggerDataEvent(`${w.C0.DEL}`,!0):v.length===C.length&&v!==C&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),y=this._renderService.dimensions.css.cell.height,g=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,b=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=b+"px",this._compositionView.style.top=g+"px",this._compositionView.style.height=y+"px",this._compositionView.style.lineHeight=y+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=b+"px",this._textarea.style.top=g+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=j=f([m(2,x.IBufferService),m(3,x.IOptionsService),m(4,x.ICoreService),m(5,h.IRenderService)],j)},9806:(u,l)=>{function d(f,m,h){const x=h.getBoundingClientRect(),w=f.getComputedStyle(h),j=parseInt(w.getPropertyValue("padding-left")),C=parseInt(w.getPropertyValue("padding-top"));return[m.clientX-x.left-j,m.clientY-x.top-C]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=d,l.getCoords=function(f,m,h,x,w,j,C,v,y){if(!j)return;const g=d(f,m,h);return g?(g[0]=Math.ceil((g[0]+(y?C/2:0))/C),g[1]=Math.ceil(g[1]/v),g[0]=Math.min(Math.max(g[0],1),x+(y?1:0)),g[1]=Math.min(Math.max(g[1],1),w),g):void 0}},9504:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=d(2584);function m(v,y,g,b){const k=v-h(v,g),E=y-h(y,g),P=Math.abs(k-E)-(function(A,N,M){let I=0;const L=A-h(A,M),B=N-h(N,M);for(let z=0;z<Math.abs(L-B);z++){const Y=x(A,N)==="A"?-1:1,H=M.buffer.lines.get(L+Y*z);H!=null&&H.isWrapped&&I++}return I})(v,y,g);return C(P,j(x(v,y),b))}function h(v,y){let g=0,b=y.buffer.lines.get(v),k=b==null?void 0:b.isWrapped;for(;k&&v>=0&&v<y.rows;)g++,b=y.buffer.lines.get(--v),k=b==null?void 0:b.isWrapped;return g}function x(v,y){return v>y?"A":"B"}function w(v,y,g,b,k,E){let P=v,A=y,N="";for(;P!==g||A!==b;)P+=k?1:-1,k&&P>E.cols-1?(N+=E.buffer.translateBufferLineToString(A,!1,v,P),P=0,v=0,A++):!k&&P<0&&(N+=E.buffer.translateBufferLineToString(A,!1,0,v+1),P=E.cols-1,v=P,A--);return N+E.buffer.translateBufferLineToString(A,!1,v,P)}function j(v,y){const g=y?"O":"[";return f.C0.ESC+g+v}function C(v,y){v=Math.floor(v);let g="";for(let b=0;b<v;b++)g+=y;return g}l.moveToCellSequence=function(v,y,g,b){const k=g.buffer.x,E=g.buffer.y;if(!g.buffer.hasScrollback)return(function(N,M,I,L,B,z){return m(M,L,B,z).length===0?"":C(w(N,M,N,M-h(M,B),!1,B).length,j("D",z))})(k,E,0,y,g,b)+m(E,y,g,b)+(function(N,M,I,L,B,z){let Y;Y=m(M,L,B,z).length>0?L-h(L,B):M;const H=L,U=(function(X,q,O,R,$,G){let F;return F=m(O,R,$,G).length>0?R-h(R,$):q,X<O&&F<=R||X>=O&&F<R?"C":"D"})(N,M,I,L,B,z);return C(w(N,Y,I,H,U==="C",B).length,j(U,z))})(k,E,v,y,g,b);let P;if(E===y)return P=k>v?"D":"C",C(Math.abs(k-v),j(P,b));P=E>y?"D":"C";const A=Math.abs(E-y);return C((function(N,M){return M.cols-N})(E>y?v:k,g)+(A-1)*g.cols+1+((E>y?k:v)-1),j(P,b))}},1296:function(u,l,d){var f=this&&this.__decorate||function(z,Y,H,U){var X,q=arguments.length,O=q<3?Y:U===null?U=Object.getOwnPropertyDescriptor(Y,H):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(z,Y,H,U);else for(var R=z.length-1;R>=0;R--)(X=z[R])&&(O=(q<3?X(O):q>3?X(Y,H,O):X(Y,H))||O);return q>3&&O&&Object.defineProperty(Y,H,O),O},m=this&&this.__param||function(z,Y){return function(H,U){Y(H,U,z)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const h=d(3787),x=d(2550),w=d(2223),j=d(6171),C=d(6052),v=d(4725),y=d(8055),g=d(8460),b=d(844),k=d(2585),E="xterm-dom-renderer-owner-",P="xterm-rows",A="xterm-fg-",N="xterm-bg-",M="xterm-focus",I="xterm-selection";let L=1,B=l.DomRenderer=class extends b.Disposable{constructor(z,Y,H,U,X,q,O,R,$,G,F,te,ce){super(),this._terminal=z,this._document=Y,this._element=H,this._screenElement=U,this._viewportElement=X,this._helperContainer=q,this._linkifier2=O,this._charSizeService=$,this._optionsService=G,this._bufferService=F,this._coreBrowserService=te,this._themeService=ce,this._terminalClass=L++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new g.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(P),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(I),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,j.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((fe=>this._injectCss(fe)))),this._injectCss(this._themeService.colors),this._rowFactory=R.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(E+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((fe=>this._handleLinkHover(fe)))),this.register(this._linkifier2.onHideLinkUnderline((fe=>this._handleLinkLeave(fe)))),this.register((0,b.toDisposable)((()=>{this._element.classList.remove(E+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new x.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const z=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*z,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*z),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/z),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/z),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Y=`${this._terminalSelector} .${P} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Y,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(z){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Y=`${this._terminalSelector} .${P} { color: ${z.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Y+=`${this._terminalSelector} .${P} .xterm-dim { color: ${y.color.multiplyOpacity(z.foreground,.5).css};}`,Y+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const H=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;Y+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,Y+=`@keyframes ${U} { 50% { box-shadow: none; }}`,Y+=`@keyframes ${X} { 0% { background-color: ${z.cursor.css}; color: ${z.cursorAccent.css}; } 50% { background-color: inherit; color: ${z.cursor.css}; }}`,Y+=`${this._terminalSelector} .${P}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${P}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${P}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-block { background-color: ${z.cursor.css}; color: ${z.cursorAccent.css};}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${z.cursor.css} !important; color: ${z.cursorAccent.css} !important;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${z.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${z.cursor.css} inset;}${this._terminalSelector} .${P} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${z.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Y+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${z.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${z.selectionInactiveBackgroundOpaque.css};}`;for(const[q,O]of z.ansi.entries())Y+=`${this._terminalSelector} .${A}${q} { color: ${O.css}; }${this._terminalSelector} .${A}${q}.xterm-dim { color: ${y.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${N}${q} { background-color: ${O.css}; }`;Y+=`${this._terminalSelector} .${A}${w.INVERTED_DEFAULT_COLOR} { color: ${y.color.opaque(z.background).css}; }${this._terminalSelector} .${A}${w.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${y.color.multiplyOpacity(y.color.opaque(z.background),.5).css}; }${this._terminalSelector} .${N}${w.INVERTED_DEFAULT_COLOR} { background-color: ${z.foreground.css}; }`,this._themeStyleElement.textContent=Y}_setDefaultSpacing(){const z=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${z}px`,this._rowFactory.defaultSpacing=z}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(z,Y){for(let H=this._rowElements.length;H<=Y;H++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>Y;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(z,Y){this._refreshRowElements(z,Y),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(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(z,Y,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(z,Y,H),this.renderRows(0,this._bufferService.rows-1),!z||!Y)return;this._selectionRenderModel.update(this._terminal,z,Y,H);const U=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,q=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(q>=this._bufferService.rows||O<0)return;const R=this._document.createDocumentFragment();if(H){const $=z[0]>Y[0];R.appendChild(this._createSelectionElement(q,$?Y[0]:z[0],$?z[0]:Y[0],O-q+1))}else{const $=U===q?z[0]:0,G=q===X?Y[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(q,$,G));const F=O-q-1;if(R.appendChild(this._createSelectionElement(q+1,0,this._bufferService.cols,F)),q!==O){const te=X===O?Y[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(O,0,te))}}this._selectionContainer.appendChild(R)}_createSelectionElement(z,Y,H,U=1){const X=this._document.createElement("div"),q=Y*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(H-Y);return q+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-q),X.style.height=U*this.dimensions.css.cell.height+"px",X.style.top=z*this.dimensions.css.cell.height+"px",X.style.left=`${q}px`,X.style.width=`${O}px`,X}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const z of this._rowElements)z.replaceChildren()}renderRows(z,Y){const H=this._bufferService.buffer,U=H.ybase+H.y,X=Math.min(H.x,this._bufferService.cols-1),q=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,R=this._optionsService.rawOptions.cursorInactiveStyle;for(let $=z;$<=Y;$++){const G=$+H.ydisp,F=this._rowElements[$],te=H.lines.get(G);if(!F||!te)break;F.replaceChildren(...this._rowFactory.createRow(te,G,G===U,O,R,X,q,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${E}${this._terminalClass}`}_handleLinkHover(z){this._setCellUnderline(z.x1,z.x2,z.y1,z.y2,z.cols,!0)}_handleLinkLeave(z){this._setCellUnderline(z.x1,z.x2,z.y1,z.y2,z.cols,!1)}_setCellUnderline(z,Y,H,U,X,q){H<0&&(z=0),U<0&&(Y=0);const O=this._bufferService.rows-1;H=Math.max(Math.min(H,O),0),U=Math.max(Math.min(U,O),0),X=Math.min(X,this._bufferService.cols);const R=this._bufferService.buffer,$=R.ybase+R.y,G=Math.min(R.x,X-1),F=this._optionsService.rawOptions.cursorBlink,te=this._optionsService.rawOptions.cursorStyle,ce=this._optionsService.rawOptions.cursorInactiveStyle;for(let fe=H;fe<=U;++fe){const J=fe+R.ydisp,W=this._rowElements[fe],ae=R.lines.get(J);if(!W||!ae)break;W.replaceChildren(...this._rowFactory.createRow(ae,J,J===$,te,ce,G,F,this.dimensions.css.cell.width,this._widthCache,q?fe===H?z:0:-1,q?(fe===U?Y:X)-1:-1))}}};l.DomRenderer=B=f([m(7,k.IInstantiationService),m(8,v.ICharSizeService),m(9,k.IOptionsService),m(10,k.IBufferService),m(11,v.ICoreBrowserService),m(12,v.IThemeService)],B)},3787:function(u,l,d){var f=this&&this.__decorate||function(P,A,N,M){var I,L=arguments.length,B=L<3?A:M===null?M=Object.getOwnPropertyDescriptor(A,N):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(P,A,N,M);else for(var z=P.length-1;z>=0;z--)(I=P[z])&&(B=(L<3?I(B):L>3?I(A,N,B):I(A,N))||B);return L>3&&B&&Object.defineProperty(A,N,B),B},m=this&&this.__param||function(P,A){return function(N,M){A(N,M,P)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const h=d(2223),x=d(643),w=d(511),j=d(2585),C=d(8055),v=d(4725),y=d(4269),g=d(6171),b=d(3734);let k=l.DomRendererRowFactory=class{constructor(P,A,N,M,I,L,B){this._document=P,this._characterJoinerService=A,this._optionsService=N,this._coreBrowserService=M,this._coreService=I,this._decorationService=L,this._themeService=B,this._workCell=new w.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(P,A,N){this._selectionStart=P,this._selectionEnd=A,this._columnSelectMode=N}createRow(P,A,N,M,I,L,B,z,Y,H,U){const X=[],q=this._characterJoinerService.getJoinedCharacters(A),O=this._themeService.colors;let R,$=P.getNoBgTrimmedLength();N&&$<L+1&&($=L+1);let G=0,F="",te=0,ce=0,fe=0,J=!1,W=0,ae=!1,ne=0;const Z=[],le=H!==-1&&U!==-1;for(let Ce=0;Ce<$;Ce++){P.loadCell(Ce,this._workCell);let Le=this._workCell.getWidth();if(Le===0)continue;let Ge=!1,me=Ce,be=this._workCell;if(q.length>0&&Ce===q[0][0]){Ge=!0;const at=q.shift();be=new y.JoinedCellData(this._workCell,P.translateToString(!0,at[0],at[1]),at[1]-at[0]),me=at[1]-1,Le=be.getWidth()}const Be=this._isCellInSelection(Ce,A),Ke=N&&Ce===L,Qe=le&&Ce>=H&&Ce<=U;let je=!1;this._decorationService.forEachDecorationAtCell(Ce,A,void 0,(at=>{je=!0}));let we=be.getChars()||x.WHITESPACE_CELL_CHAR;if(we===" "&&(be.isUnderline()||be.isOverline())&&(we=" "),ne=Le*z-Y.get(we,be.isBold(),be.isItalic()),R){if(G&&(Be&&ae||!Be&&!ae&&be.bg===te)&&(Be&&ae&&O.selectionForeground||be.fg===ce)&&be.extended.ext===fe&&Qe===J&&ne===W&&!Ke&&!Ge&&!je){be.isInvisible()?F+=x.WHITESPACE_CELL_CHAR:F+=we,G++;continue}G&&(R.textContent=F),R=this._document.createElement("span"),G=0,F=""}else R=this._document.createElement("span");if(te=be.bg,ce=be.fg,fe=be.extended.ext,J=Qe,W=ne,ae=Be,Ge&&L>=Ce&&L<=me&&(L=Ce),!this._coreService.isCursorHidden&&Ke&&this._coreService.isCursorInitialized){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)B&&Z.push("xterm-cursor-blink"),Z.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(be.isBold()&&Z.push("xterm-bold"),be.isItalic()&&Z.push("xterm-italic"),be.isDim()&&Z.push("xterm-dim"),F=be.isInvisible()?x.WHITESPACE_CELL_CHAR:be.getChars()||x.WHITESPACE_CELL_CHAR,be.isUnderline()&&(Z.push(`xterm-underline-${be.extended.underlineStyle}`),F===" "&&(F=" "),!be.isUnderlineColorDefault()))if(be.isUnderlineColorRGB())R.style.textDecorationColor=`rgb(${b.AttributeData.toColorRGB(be.getUnderlineColor()).join(",")})`;else{let at=be.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&be.isBold()&&at<8&&(at+=8),R.style.textDecorationColor=O.ansi[at].css}be.isOverline()&&(Z.push("xterm-overline"),F===" "&&(F=" ")),be.isStrikethrough()&&Z.push("xterm-strikethrough"),Qe&&(R.style.textDecoration="underline");let ve=be.getFgColor(),_e=be.getFgColorMode(),Oe=be.getBgColor(),de=be.getBgColorMode();const ye=!!be.isInverse();if(ye){const at=ve;ve=Oe,Oe=at;const ur=_e;_e=de,de=ur}let Re,ze,Je,Et=!1;switch(this._decorationService.forEachDecorationAtCell(Ce,A,void 0,(at=>{at.options.layer!=="top"&&Et||(at.backgroundColorRGB&&(de=50331648,Oe=at.backgroundColorRGB.rgba>>8&16777215,Re=at.backgroundColorRGB),at.foregroundColorRGB&&(_e=50331648,ve=at.foregroundColorRGB.rgba>>8&16777215,ze=at.foregroundColorRGB),Et=at.options.layer==="top")})),!Et&&Be&&(Re=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,Oe=Re.rgba>>8&16777215,de=50331648,Et=!0,O.selectionForeground&&(_e=50331648,ve=O.selectionForeground.rgba>>8&16777215,ze=O.selectionForeground)),Et&&Z.push("xterm-decoration-top"),de){case 16777216:case 33554432:Je=O.ansi[Oe],Z.push(`xterm-bg-${Oe}`);break;case 50331648:Je=C.channels.toColor(Oe>>16,Oe>>8&255,255&Oe),this._addStyle(R,`background-color:#${E((Oe>>>0).toString(16),"0",6)}`);break;default:ye?(Je=O.foreground,Z.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):Je=O.background}switch(Re||be.isDim()&&(Re=C.color.multiplyOpacity(Je,.5)),_e){case 16777216:case 33554432:be.isBold()&&ve<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ve+=8),this._applyMinimumContrast(R,Je,O.ansi[ve],be,Re,void 0)||Z.push(`xterm-fg-${ve}`);break;case 50331648:const at=C.channels.toColor(ve>>16&255,ve>>8&255,255&ve);this._applyMinimumContrast(R,Je,at,be,Re,ze)||this._addStyle(R,`color:#${E(ve.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,Je,O.foreground,be,Re,ze)||ye&&Z.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}Z.length&&(R.className=Z.join(" "),Z.length=0),Ke||Ge||je?R.textContent=F:G++,ne!==this.defaultSpacing&&(R.style.letterSpacing=`${ne}px`),X.push(R),Ce=me}return R&&G&&(R.textContent=F),X}_applyMinimumContrast(P,A,N,M,I,L){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,g.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const B=this._getContrastCache(M);let z;if(I||L||(z=B.getColor(A.rgba,N.rgba)),z===void 0){const Y=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);z=C.color.ensureContrastRatio(I||A,L||N,Y),B.setColor((I||A).rgba,(L||N).rgba,z??null)}return!!z&&(this._addStyle(P,`color:${z.css}`),!0)}_getContrastCache(P){return P.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(P,A){P.setAttribute("style",`${P.getAttribute("style")||""}${A};`)}_isCellInSelection(P,A){const N=this._selectionStart,M=this._selectionEnd;return!(!N||!M)&&(this._columnSelectMode?N[0]<=M[0]?P>=N[0]&&A>=N[1]&&P<M[0]&&A<=M[1]:P<N[0]&&A>=N[1]&&P>=M[0]&&A<=M[1]:A>N[1]&&A<M[1]||N[1]===M[1]&&A===N[1]&&P>=N[0]&&P<M[0]||N[1]<M[1]&&A===M[1]&&P<M[0]||N[1]<M[1]&&A===N[1]&&P>=N[0])}};function E(P,A,N){for(;P.length<N;)P=A+P;return P}l.DomRendererRowFactory=k=f([m(1,v.ICharacterJoinerService),m(2,j.IOptionsService),m(3,v.ICoreBrowserService),m(4,j.ICoreService),m(5,j.IDecorationService),m(6,v.IThemeService)],k)},2550:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(d,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const m=d.createElement("span");m.classList.add("xterm-char-measure-element");const h=d.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const x=d.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontStyle="italic";const w=d.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontWeight="bold",w.style.fontStyle="italic",this._measureElements=[m,h,x,w],this._container.appendChild(m),this._container.appendChild(h),this._container.appendChild(x),this._container.appendChild(w),f.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(d,f,m,h){d===this._font&&f===this._fontSize&&m===this._weight&&h===this._weightBold||(this._font=d,this._fontSize=f,this._weight=m,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${m}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${m}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(d,f,m){let h=0;if(!f&&!m&&d.length===1&&(h=d.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const j=this._measure(d,0);return j>0&&(this._flat[h]=j),j}let x=d;f&&(x+="B"),m&&(x+="I");let w=this._holey.get(x);if(w===void 0){let j=0;f&&(j|=1),m&&(j|=2),w=this._measure(d,j),w>0&&this._holey.set(x,w)}return w}_measure(d,f){const m=this._measureElements[f];return m.textContent=d.repeat(32),m.offsetWidth/32}}},2223:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=d(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(u,l)=>{function d(m){return 57508<=m&&m<=57558}function f(m){return m>=128512&&m<=128591||m>=127744&&m<=128511||m>=128640&&m<=128767||m>=9728&&m<=9983||m>=9984&&m<=10175||m>=65024&&m<=65039||m>=129280&&m<=129535||m>=127462&&m<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(m){if(!m)throw new Error("value must not be falsy");return m},l.isPowerlineGlyph=d,l.isRestrictedPowerlineGlyph=function(m){return 57520<=m&&m<=57527},l.isEmoji=f,l.allowRescaling=function(m,h,x,w){return h===1&&x>Math.ceil(1.5*w)&&m!==void 0&&m>255&&!f(m)&&!d(m)&&!(function(j){return 57344<=j&&j<=63743})(m)},l.treatGlyphAsBackgroundColor=function(m){return d(m)||(function(h){return 9472<=h&&h<=9631})(m)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(m,h,x=0){return(m-(2*Math.round(h)-x))%(2*Math.round(h))}},6052:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class d{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(m,h,x,w=!1){if(this.selectionStart=h,this.selectionEnd=x,!h||!x||h[0]===x[0]&&h[1]===x[1])return void this.clear();const j=m.buffers.active.ydisp,C=h[1]-j,v=x[1]-j,y=Math.max(C,0),g=Math.min(v,m.rows-1);y>=m.rows||g<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=w,this.viewportStartRow=C,this.viewportEndRow=v,this.viewportCappedStartRow=y,this.viewportCappedEndRow=g,this.startCol=h[0],this.endCol=x[0])}isCellSelected(m,h,x){return!!this.hasSelection&&(x-=m.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&x>=this.viewportCappedStartRow&&h<this.endCol&&x<=this.viewportCappedEndRow:h<this.startCol&&x>=this.viewportCappedStartRow&&h>=this.endCol&&x<=this.viewportCappedEndRow:x>this.viewportStartRow&&x<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&x===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportStartRow&&h>=this.startCol)}}l.createSelectionRenderModel=function(){return new d}},456:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(d){this._bufferService=d,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?d%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)-1]:[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[d,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[Math.max(d,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const d=this.selectionStart,f=this.selectionEnd;return!(!d||!f)&&(d[1]>f[1]||d[1]===f[1]&&d[0]>f[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(u,l,d){var f=this&&this.__decorate||function(g,b,k,E){var P,A=arguments.length,N=A<3?b:E===null?E=Object.getOwnPropertyDescriptor(b,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(g,b,k,E);else for(var M=g.length-1;M>=0;M--)(P=g[M])&&(N=(A<3?P(N):A>3?P(b,k,N):P(b,k))||N);return A>3&&N&&Object.defineProperty(b,k,N),N},m=this&&this.__param||function(g,b){return function(k,E){b(k,E,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const h=d(2585),x=d(8460),w=d(844);let j=l.CharSizeService=class extends w.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(g,b,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new x.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new y(this._optionsService))}catch{this._measureStrategy=this.register(new v(g,b,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const g=this._measureStrategy.measure();g.width===this.width&&g.height===this.height||(this.width=g.width,this.height=g.height,this._onCharSizeChange.fire())}};l.CharSizeService=j=f([m(2,h.IOptionsService)],j);class C extends w.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(b,k){b!==void 0&&b>0&&k!==void 0&&k>0&&(this._result.width=b,this._result.height=k)}}class v extends C{constructor(b,k,E){super(),this._document=b,this._parentElement=k,this._optionsService=E,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class y extends C{constructor(b){super(),this._optionsService=b,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const b=this._ctx.measureText("W");return this._validateAndSet(b.width,b.fontBoundingBoxAscent+b.fontBoundingBoxDescent),this._result}}},4269:function(u,l,d){var f=this&&this.__decorate||function(y,g,b,k){var E,P=arguments.length,A=P<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,g,b,k);else for(var N=y.length-1;N>=0;N--)(E=y[N])&&(A=(P<3?E(A):P>3?E(g,b,A):E(g,b))||A);return P>3&&A&&Object.defineProperty(g,b,A),A},m=this&&this.__param||function(y,g){return function(b,k){g(b,k,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const h=d(3734),x=d(643),w=d(511),j=d(2585);class C extends h.AttributeData{constructor(g,b,k){super(),this.content=0,this.combinedData="",this.fg=g.fg,this.bg=g.bg,this.combinedData=b,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(g){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=C;let v=l.CharacterJoinerService=class Ij{constructor(g){this._bufferService=g,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new w.CellData}register(g){const b={id:this._nextCharacterJoinerId++,handler:g};return this._characterJoiners.push(b),b.id}deregister(g){for(let b=0;b<this._characterJoiners.length;b++)if(this._characterJoiners[b].id===g)return this._characterJoiners.splice(b,1),!0;return!1}getJoinedCharacters(g){if(this._characterJoiners.length===0)return[];const b=this._bufferService.buffer.lines.get(g);if(!b||b.length===0)return[];const k=[],E=b.translateToString(!0);let P=0,A=0,N=0,M=b.getFg(0),I=b.getBg(0);for(let L=0;L<b.getTrimmedLength();L++)if(b.loadCell(L,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==M||this._workCell.bg!==I){if(L-P>1){const B=this._getJoinedRanges(E,N,A,b,P);for(let z=0;z<B.length;z++)k.push(B[z])}P=L,N=A,M=this._workCell.fg,I=this._workCell.bg}A+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-P>1){const L=this._getJoinedRanges(E,N,A,b,P);for(let B=0;B<L.length;B++)k.push(L[B])}return k}_getJoinedRanges(g,b,k,E,P){const A=g.substring(b,k);let N=[];try{N=this._characterJoiners[0].handler(A)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{const I=this._characterJoiners[M].handler(A);for(let L=0;L<I.length;L++)Ij._mergeRanges(N,I[L])}catch(I){console.error(I)}return this._stringRangesToCellRanges(N,E,P),N}_stringRangesToCellRanges(g,b,k){let E=0,P=!1,A=0,N=g[E];if(N){for(let M=k;M<this._bufferService.cols;M++){const I=b.getWidth(M),L=b.getString(M).length||x.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!P&&N[0]<=A&&(N[0]=M,P=!0),N[1]<=A){if(N[1]=M,N=g[++E],!N)break;N[0]<=A?(N[0]=M,P=!0):P=!1}A+=L}}N&&(N[1]=this._bufferService.cols)}}static _mergeRanges(g,b){let k=!1;for(let E=0;E<g.length;E++){const P=g[E];if(k){if(b[1]<=P[0])return g[E-1][1]=b[1],g;if(b[1]<=P[1])return g[E-1][1]=Math.max(b[1],P[1]),g.splice(E,1),g;g.splice(E,1),E--}else{if(b[1]<=P[0])return g.splice(E,0,b),g;if(b[1]<=P[1])return P[0]=Math.min(b[0],P[0]),g;b[0]<P[1]&&(P[0]=Math.min(b[0],P[0]),k=!0)}}return k?g[g.length-1][1]=b[1]:g.push(b),g}};l.CharacterJoinerService=v=f([m(0,j.IBufferService)],v)},5114:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const f=d(844),m=d(8460),h=d(3656);class x extends f.Disposable{constructor(C,v,y){super(),this._textarea=C,this._window=v,this.mainDocument=y,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new w(this._window),this._onDprChange=this.register(new m.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new m.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((g=>this._screenDprMonitor.setWindow(g)))),this.register((0,m.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(C){this._window!==C&&(this._window=C,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}}l.CoreBrowserService=x;class w extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new m.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const f=d(844);class m extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(x){return this.linkProviders.push(x),{dispose:()=>{const w=this.linkProviders.indexOf(x);w!==-1&&this.linkProviders.splice(w,1)}}}}l.LinkProviderService=m},8934:function(u,l,d){var f=this&&this.__decorate||function(j,C,v,y){var g,b=arguments.length,k=b<3?C:y===null?y=Object.getOwnPropertyDescriptor(C,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(j,C,v,y);else for(var E=j.length-1;E>=0;E--)(g=j[E])&&(k=(b<3?g(k):b>3?g(C,v,k):g(C,v))||k);return b>3&&k&&Object.defineProperty(C,v,k),k},m=this&&this.__param||function(j,C){return function(v,y){C(v,y,j)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const h=d(4725),x=d(9806);let w=l.MouseService=class{constructor(j,C){this._renderService=j,this._charSizeService=C}getCoords(j,C,v,y,g){return(0,x.getCoords)(window,j,C,v,y,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,g)}getMouseReportCoords(j,C){const v=(0,x.getCoordsRelativeToElement)(window,j,C);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};l.MouseService=w=f([m(0,h.IRenderService),m(1,h.ICharSizeService)],w)},3230:function(u,l,d){var f=this&&this.__decorate||function(g,b,k,E){var P,A=arguments.length,N=A<3?b:E===null?E=Object.getOwnPropertyDescriptor(b,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(g,b,k,E);else for(var M=g.length-1;M>=0;M--)(P=g[M])&&(N=(A<3?P(N):A>3?P(b,k,N):P(b,k))||N);return A>3&&N&&Object.defineProperty(b,k,N),N},m=this&&this.__param||function(g,b){return function(k,E){b(k,E,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const h=d(6193),x=d(4725),w=d(8460),j=d(844),C=d(7226),v=d(2585);let y=l.RenderService=class extends j.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(g,b,k,E,P,A,N,M){super(),this._rowCount=g,this._charSizeService=E,this._renderer=this.register(new j.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new j.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new w.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new w.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new w.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((I,L)=>this._renderRows(I,L)),N),this.register(this._renderDebouncer),this.register(N.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(A.onResize((()=>this._fullRefresh()))),this.register(A.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(P.onDecorationRegistered((()=>this._fullRefresh()))),this.register(P.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(A.cols,A.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(A.buffer.y,A.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(N.window,b),this.register(N.onWindowChange((I=>this._registerIntersectionObserver(I,b))))}_registerIntersectionObserver(g,b){if("IntersectionObserver"in g){const k=new g.IntersectionObserver((E=>this._handleIntersectionChange(E[E.length-1])),{threshold:0});k.observe(b),this._observerDisposable.value=(0,j.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(g){this._isPaused=g.isIntersecting===void 0?g.intersectionRatio===0:!g.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(g,b,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(g,b,this._rowCount))}_renderRows(g,b){this._renderer.value&&(g=Math.min(g,this._rowCount-1),b=Math.min(b,this._rowCount-1),this._renderer.value.renderRows(g,b),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:g,end:b}),this._onRender.fire({start:g,end:b}),this._isNextRenderRedrawOnly=!0)}resize(g,b){this._rowCount=b,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(g){this._renderer.value=g,this._renderer.value&&(this._renderer.value.onRequestRedraw((b=>this.refreshRows(b.start,b.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(g){return this._renderDebouncer.addRefreshCallback(g)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var g,b;this._renderer.value&&((b=(g=this._renderer.value).clearTextureAtlas)==null||b.call(g),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(g,b){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(g,b)})):this._renderer.value.handleResize(g,b),this._fullRefresh())}handleCharSizeChanged(){var g;(g=this._renderer.value)==null||g.handleCharSizeChanged()}handleBlur(){var g;(g=this._renderer.value)==null||g.handleBlur()}handleFocus(){var g;(g=this._renderer.value)==null||g.handleFocus()}handleSelectionChanged(g,b,k){var E;this._selectionState.start=g,this._selectionState.end=b,this._selectionState.columnSelectMode=k,(E=this._renderer.value)==null||E.handleSelectionChanged(g,b,k)}handleCursorMove(){var g;(g=this._renderer.value)==null||g.handleCursorMove()}clear(){var g;(g=this._renderer.value)==null||g.clear()}};l.RenderService=y=f([m(2,v.IOptionsService),m(3,x.ICharSizeService),m(4,v.IDecorationService),m(5,v.IBufferService),m(6,x.ICoreBrowserService),m(7,x.IThemeService)],y)},9312:function(u,l,d){var f=this&&this.__decorate||function(N,M,I,L){var B,z=arguments.length,Y=z<3?M:L===null?L=Object.getOwnPropertyDescriptor(M,I):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(N,M,I,L);else for(var H=N.length-1;H>=0;H--)(B=N[H])&&(Y=(z<3?B(Y):z>3?B(M,I,Y):B(M,I))||Y);return z>3&&Y&&Object.defineProperty(M,I,Y),Y},m=this&&this.__param||function(N,M){return function(I,L){M(I,L,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const h=d(9806),x=d(9504),w=d(456),j=d(4725),C=d(8460),v=d(844),y=d(6114),g=d(4841),b=d(511),k=d(2585),E=" ",P=new RegExp(E,"g");let A=l.SelectionService=class extends v.Disposable{constructor(N,M,I,L,B,z,Y,H,U){super(),this._element=N,this._screenElement=M,this._linkifier=I,this._bufferService=L,this._coreService=B,this._mouseService=z,this._optionsService=Y,this._renderService=H,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new b.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new w.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!N||!M||N[0]===M[0]&&N[1]===M[1])}get selectionText(){const N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!N||!M)return"";const I=this._bufferService.buffer,L=[];if(this._activeSelectionMode===3){if(N[0]===M[0])return"";const B=N[0]<M[0]?N[0]:M[0],z=N[0]<M[0]?M[0]:N[0];for(let Y=N[1];Y<=M[1];Y++){const H=I.translateBufferLineToString(Y,!0,B,z);L.push(H)}}else{const B=N[1]===M[1]?M[0]:void 0;L.push(I.translateBufferLineToString(N[1],!0,N[0],B));for(let z=N[1]+1;z<=M[1]-1;z++){const Y=I.lines.get(z),H=I.translateBufferLineToString(z,!0);Y!=null&&Y.isWrapped?L[L.length-1]+=H:L.push(H)}if(N[1]!==M[1]){const z=I.lines.get(M[1]),Y=I.translateBufferLineToString(M[1],!0,0,M[0]);z&&z.isWrapped?L[L.length-1]+=Y:L.push(Y)}}return L.map((B=>B.replace(P," "))).join(y.isWindows?`\r
585
585
  `:`
586
586
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(N){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),y.isLinux&&N&&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(N){const M=this._getMouseBufferCoords(N),I=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!!(I&&L&&M)&&this._areCoordsInSelection(M,I,L)}isCellInSelection(N,M){const I=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!I||!L)&&this._areCoordsInSelection([N,M],I,L)}_areCoordsInSelection(N,M,I){return N[1]>M[1]&&N[1]<I[1]||M[1]===I[1]&&N[1]===M[1]&&N[0]>=M[0]&&N[0]<I[0]||M[1]<I[1]&&N[1]===I[1]&&N[0]<I[0]||M[1]<I[1]&&N[1]===M[1]&&N[0]>=M[0]}_selectWordAtCursor(N,M){var B,z;const I=(z=(B=this._linkifier.currentLink)==null?void 0:B.link)==null?void 0:z.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,g.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const L=this._getMouseBufferCoords(N);return!!L&&(this._selectWordAt(L,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(N,M){this._model.clearSelection(),N=Math.max(N,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,N],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(N){this._model.handleTrim(N)&&this.refresh()}_getMouseBufferCoords(N){const M=this._mouseService.getCoords(N,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(N){let M=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,N,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=I?0:(M>I&&(M-=I),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(N){return y.isMac?N.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:N.shiftKey}handleMouseDown(N){if(this._mouseDownTimeStamp=N.timeStamp,(N.button!==2||!this.hasSelection)&&N.button===0){if(!this._enabled){if(!this.shouldForceSelection(N))return;N.stopPropagation()}N.preventDefault(),this._dragScrollAmount=0,this._enabled&&N.shiftKey?this._handleIncrementalClick(N):N.detail===1?this._handleSingleClick(N):N.detail===2?this._handleDoubleClick(N):N.detail===3&&this._handleTripleClick(N),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(N){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(N))}_handleSingleClick(N){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(N)?3:0,this._model.selectionStart=this._getMouseBufferCoords(N),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(N){this._selectWordAtCursor(N,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(N){const M=this._getMouseBufferCoords(N);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(N){return N.altKey&&!(y.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(N){if(N.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(N),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(N),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const I=this._bufferService.buffer;if(this._model.selectionEnd[1]<I.lines.length){const L=I.lines.get(this._model.selectionEnd[1]);L&&L.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}M&&M[0]===this._model.selectionEnd[0]&&M[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const N=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(N.ydisp+this._bufferService.rows,N.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=N.ydisp),this.refresh()}}_handleMouseUp(N){const M=N.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&N.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(N,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const L=(0,x.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(L,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,I=!(!N||!M||N[0]===M[0]&&N[1]===M[1]);I?N&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&N[0]===this._oldSelectionStart[0]&&N[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(N,M,I)):this._oldHasSelection&&this._fireOnSelectionChange(N,M,I)}_fireOnSelectionChange(N,M,I){this._oldSelectionStart=N,this._oldSelectionEnd=M,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(N){this.clearSelection(),this._trimListener.dispose(),this._trimListener=N.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(N,M){let I=M;for(let L=0;M>=L;L++){const B=N.loadCell(L,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:B>1&&M!==L&&(I+=B-1)}return I}setSelection(N,M,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[N,M],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(N){this._isClickInSelection(N)||(this._selectWordAtCursor(N,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(N,M,I=!0,L=!0){if(N[0]>=this._bufferService.cols)return;const B=this._bufferService.buffer,z=B.lines.get(N[1]);if(!z)return;const Y=B.translateBufferLineToString(N[1],!1);let H=this._convertViewportColToCharacterIndex(z,N[0]),U=H;const X=N[0]-H;let q=0,O=0,R=0,$=0;if(Y.charAt(H)===" "){for(;H>0&&Y.charAt(H-1)===" ";)H--;for(;U<Y.length&&Y.charAt(U+1)===" ";)U++}else{let te=N[0],ce=N[0];z.getWidth(te)===0&&(q++,te--),z.getWidth(ce)===2&&(O++,ce++);const fe=z.getString(ce).length;for(fe>1&&($+=fe-1,U+=fe-1);te>0&&H>0&&!this._isCharWordSeparator(z.loadCell(te-1,this._workCell));){z.loadCell(te-1,this._workCell);const J=this._workCell.getChars().length;this._workCell.getWidth()===0?(q++,te--):J>1&&(R+=J-1,H-=J-1),H--,te--}for(;ce<z.length&&U+1<Y.length&&!this._isCharWordSeparator(z.loadCell(ce+1,this._workCell));){z.loadCell(ce+1,this._workCell);const J=this._workCell.getChars().length;this._workCell.getWidth()===2?(O++,ce++):J>1&&($+=J-1,U+=J-1),U++,ce++}}U++;let G=H+X-q+R,F=Math.min(this._bufferService.cols,U-H+q+O-R-$);if(M||Y.slice(H,U).trim()!==""){if(I&&G===0&&z.getCodePoint(0)!==32){const te=B.lines.get(N[1]-1);if(te&&z.isWrapped&&te.getCodePoint(this._bufferService.cols-1)!==32){const ce=this._getWordAt([this._bufferService.cols-1,N[1]-1],!1,!0,!1);if(ce){const fe=this._bufferService.cols-ce.start;G-=fe,F+=fe}}}if(L&&G+F===this._bufferService.cols&&z.getCodePoint(this._bufferService.cols-1)!==32){const te=B.lines.get(N[1]+1);if(te!=null&&te.isWrapped&&te.getCodePoint(0)!==32){const ce=this._getWordAt([0,N[1]+1],!1,!1,!0);ce&&(F+=ce.length)}}return{start:G,length:F}}}_selectWordAt(N,M){const I=this._getWordAt(N,M);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,N[1]--;this._model.selectionStart=[I.start,N[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(N){const M=this._getWordAt(N,!0);if(M){let I=N[1];for(;M.start<0;)M.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,I]}}_isCharWordSeparator(N){return N.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(N.getChars())>=0}_selectLineAt(N){const M=this._bufferService.buffer.getWrappedRangeForLine(N),I={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,g.getRangeLength)(I,this._bufferService.cols)}};l.SelectionService=A=f([m(3,k.IBufferService),m(4,k.ICoreService),m(5,j.IMouseService),m(6,k.IOptionsService),m(7,j.IRenderService),m(8,j.ICoreBrowserService)],A)},4725:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const f=d(8343);l.ICharSizeService=(0,f.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),l.IMouseService=(0,f.createDecorator)("MouseService"),l.IRenderService=(0,f.createDecorator)("RenderService"),l.ISelectionService=(0,f.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,f.createDecorator)("ThemeService"),l.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(u,l,d){var f=this&&this.__decorate||function(A,N,M,I){var L,B=arguments.length,z=B<3?N:I===null?I=Object.getOwnPropertyDescriptor(N,M):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(A,N,M,I);else for(var Y=A.length-1;Y>=0;Y--)(L=A[Y])&&(z=(B<3?L(z):B>3?L(N,M,z):L(N,M))||z);return B>3&&z&&Object.defineProperty(N,M,z),z},m=this&&this.__param||function(A,N){return function(M,I){N(M,I,A)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const h=d(7239),x=d(8055),w=d(8460),j=d(844),C=d(2585),v=x.css.toColor("#ffffff"),y=x.css.toColor("#000000"),g=x.css.toColor("#ffffff"),b=x.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const A=[x.css.toColor("#2e3436"),x.css.toColor("#cc0000"),x.css.toColor("#4e9a06"),x.css.toColor("#c4a000"),x.css.toColor("#3465a4"),x.css.toColor("#75507b"),x.css.toColor("#06989a"),x.css.toColor("#d3d7cf"),x.css.toColor("#555753"),x.css.toColor("#ef2929"),x.css.toColor("#8ae234"),x.css.toColor("#fce94f"),x.css.toColor("#729fcf"),x.css.toColor("#ad7fa8"),x.css.toColor("#34e2e2"),x.css.toColor("#eeeeec")],N=[0,95,135,175,215,255];for(let M=0;M<216;M++){const I=N[M/36%6|0],L=N[M/6%6|0],B=N[M%6];A.push({css:x.channels.toCss(I,L,B),rgba:x.channels.toRgba(I,L,B)})}for(let M=0;M<24;M++){const I=8+10*M;A.push({css:x.channels.toCss(I,I,I),rgba:x.channels.toRgba(I,I,I)})}return A})());let E=l.ThemeService=class extends j.Disposable{get colors(){return this._colors}constructor(A){super(),this._optionsService=A,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new w.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:y,cursor:g,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:x.color.blend(y,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:x.color.blend(y,k),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(A={}){const N=this._colors;if(N.foreground=P(A.foreground,v),N.background=P(A.background,y),N.cursor=P(A.cursor,g),N.cursorAccent=P(A.cursorAccent,b),N.selectionBackgroundTransparent=P(A.selectionBackground,k),N.selectionBackgroundOpaque=x.color.blend(N.background,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundTransparent=P(A.selectionInactiveBackground,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundOpaque=x.color.blend(N.background,N.selectionInactiveBackgroundTransparent),N.selectionForeground=A.selectionForeground?P(A.selectionForeground,x.NULL_COLOR):void 0,N.selectionForeground===x.NULL_COLOR&&(N.selectionForeground=void 0),x.color.isOpaque(N.selectionBackgroundTransparent)&&(N.selectionBackgroundTransparent=x.color.opacity(N.selectionBackgroundTransparent,.3)),x.color.isOpaque(N.selectionInactiveBackgroundTransparent)&&(N.selectionInactiveBackgroundTransparent=x.color.opacity(N.selectionInactiveBackgroundTransparent,.3)),N.ansi=l.DEFAULT_ANSI_COLORS.slice(),N.ansi[0]=P(A.black,l.DEFAULT_ANSI_COLORS[0]),N.ansi[1]=P(A.red,l.DEFAULT_ANSI_COLORS[1]),N.ansi[2]=P(A.green,l.DEFAULT_ANSI_COLORS[2]),N.ansi[3]=P(A.yellow,l.DEFAULT_ANSI_COLORS[3]),N.ansi[4]=P(A.blue,l.DEFAULT_ANSI_COLORS[4]),N.ansi[5]=P(A.magenta,l.DEFAULT_ANSI_COLORS[5]),N.ansi[6]=P(A.cyan,l.DEFAULT_ANSI_COLORS[6]),N.ansi[7]=P(A.white,l.DEFAULT_ANSI_COLORS[7]),N.ansi[8]=P(A.brightBlack,l.DEFAULT_ANSI_COLORS[8]),N.ansi[9]=P(A.brightRed,l.DEFAULT_ANSI_COLORS[9]),N.ansi[10]=P(A.brightGreen,l.DEFAULT_ANSI_COLORS[10]),N.ansi[11]=P(A.brightYellow,l.DEFAULT_ANSI_COLORS[11]),N.ansi[12]=P(A.brightBlue,l.DEFAULT_ANSI_COLORS[12]),N.ansi[13]=P(A.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),N.ansi[14]=P(A.brightCyan,l.DEFAULT_ANSI_COLORS[14]),N.ansi[15]=P(A.brightWhite,l.DEFAULT_ANSI_COLORS[15]),A.extendedAnsi){const M=Math.min(N.ansi.length-16,A.extendedAnsi.length);for(let I=0;I<M;I++)N.ansi[I+16]=P(A.extendedAnsi[I],l.DEFAULT_ANSI_COLORS[I+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(A){this._restoreColor(A),this._onChangeColors.fire(this.colors)}_restoreColor(A){if(A!==void 0)switch(A){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[A]=this._restoreColors.ansi[A]}else for(let N=0;N<this._restoreColors.ansi.length;++N)this._colors.ansi[N]=this._restoreColors.ansi[N]}modifyColors(A){A(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function P(A,N){if(A!==void 0)try{return x.css.toColor(A)}catch{}return N}l.ThemeService=E=f([m(0,C.IOptionsService)],E)},6349:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const f=d(8460),m=d(844);class h extends m.Disposable{constructor(w){super(),this._maxLength=w,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(w){if(this._maxLength===w)return;const j=new Array(w);for(let C=0;C<Math.min(w,this.length);C++)j[C]=this._array[this._getCyclicIndex(C)];this._array=j,this._maxLength=w,this._startIndex=0}get length(){return this._length}set length(w){if(w>this._length)for(let j=this._length;j<w;j++)this._array[j]=void 0;this._length=w}get(w){return this._array[this._getCyclicIndex(w)]}set(w,j){this._array[this._getCyclicIndex(w)]=j}push(w){this._array[this._getCyclicIndex(this._length)]=w,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(w,j,...C){if(j){for(let v=w;v<this._length-j;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+j)];this._length-=j,this.onDeleteEmitter.fire({index:w,amount:j})}for(let v=this._length-1;v>=w;v--)this._array[this._getCyclicIndex(v+C.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<C.length;v++)this._array[this._getCyclicIndex(w+v)]=C[v];if(C.length&&this.onInsertEmitter.fire({index:w,amount:C.length}),this._length+C.length>this._maxLength){const v=this._length+C.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=C.length}trimStart(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)}shiftElements(w,j,C){if(!(j<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let y=j-1;y>=0;y--)this.set(w+y+C,this.get(w+y));const v=w+j+C-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v<j;v++)this.set(w+v+C,this.get(w+v))}}_getCyclicIndex(w){return(this._startIndex+w)%this._maxLength}}l.CircularList=h},1439:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function d(f,m=5){if(typeof f!="object")return f;const h=Array.isArray(f)?[]:{};for(const x in f)h[x]=m<=1?f[x]:f[x]&&d(f[x],m-1);return h}},8055:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let d=0,f=0,m=0,h=0;var x,w,j,C,v;function y(b){const k=b.toString(16);return k.length<2?"0"+k:k}function g(b,k){return b<k?(k+.05)/(b+.05):(b+.05)/(k+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(b){b.toCss=function(k,E,P,A){return A!==void 0?`#${y(k)}${y(E)}${y(P)}${y(A)}`:`#${y(k)}${y(E)}${y(P)}`},b.toRgba=function(k,E,P,A=255){return(k<<24|E<<16|P<<8|A)>>>0},b.toColor=function(k,E,P,A){return{css:b.toCss(k,E,P,A),rgba:b.toRgba(k,E,P,A)}}})(x||(l.channels=x={})),(function(b){function k(E,P){return h=Math.round(255*P),[d,f,m]=v.toChannels(E.rgba),{css:x.toCss(d,f,m,h),rgba:x.toRgba(d,f,m,h)}}b.blend=function(E,P){if(h=(255&P.rgba)/255,h===1)return{css:P.css,rgba:P.rgba};const A=P.rgba>>24&255,N=P.rgba>>16&255,M=P.rgba>>8&255,I=E.rgba>>24&255,L=E.rgba>>16&255,B=E.rgba>>8&255;return d=I+Math.round((A-I)*h),f=L+Math.round((N-L)*h),m=B+Math.round((M-B)*h),{css:x.toCss(d,f,m),rgba:x.toRgba(d,f,m)}},b.isOpaque=function(E){return(255&E.rgba)==255},b.ensureContrastRatio=function(E,P,A){const N=v.ensureContrastRatio(E.rgba,P.rgba,A);if(N)return x.toColor(N>>24&255,N>>16&255,N>>8&255)},b.opaque=function(E){const P=(255|E.rgba)>>>0;return[d,f,m]=v.toChannels(P),{css:x.toCss(d,f,m),rgba:P}},b.opacity=k,b.multiplyOpacity=function(E,P){return h=255&E.rgba,k(E,h*P/255)},b.toColorRGB=function(E){return[E.rgba>>24&255,E.rgba>>16&255,E.rgba>>8&255]}})(w||(l.color=w={})),(function(b){let k,E;try{const P=document.createElement("canvas");P.width=1,P.height=1;const A=P.getContext("2d",{willReadFrequently:!0});A&&(k=A,k.globalCompositeOperation="copy",E=k.createLinearGradient(0,0,1,1))}catch{}b.toColor=function(P){if(P.match(/#[\da-f]{3,8}/i))switch(P.length){case 4:return d=parseInt(P.slice(1,2).repeat(2),16),f=parseInt(P.slice(2,3).repeat(2),16),m=parseInt(P.slice(3,4).repeat(2),16),x.toColor(d,f,m);case 5:return d=parseInt(P.slice(1,2).repeat(2),16),f=parseInt(P.slice(2,3).repeat(2),16),m=parseInt(P.slice(3,4).repeat(2),16),h=parseInt(P.slice(4,5).repeat(2),16),x.toColor(d,f,m,h);case 7:return{css:P,rgba:(parseInt(P.slice(1),16)<<8|255)>>>0};case 9:return{css:P,rgba:parseInt(P.slice(1),16)>>>0}}const A=P.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(A)return d=parseInt(A[1]),f=parseInt(A[2]),m=parseInt(A[3]),h=Math.round(255*(A[5]===void 0?1:parseFloat(A[5]))),x.toColor(d,f,m,h);if(!k||!E)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=E,k.fillStyle=P,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[d,f,m,h]=k.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:x.toRgba(d,f,m,h),css:P}}})(j||(l.css=j={})),(function(b){function k(E,P,A){const N=E/255,M=P/255,I=A/255;return .2126*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}b.relativeLuminance=function(E){return k(E>>16&255,E>>8&255,255&E)},b.relativeLuminance2=k})(C||(l.rgb=C={})),(function(b){function k(P,A,N){const M=P>>24&255,I=P>>16&255,L=P>>8&255;let B=A>>24&255,z=A>>16&255,Y=A>>8&255,H=g(C.relativeLuminance2(B,z,Y),C.relativeLuminance2(M,I,L));for(;H<N&&(B>0||z>0||Y>0);)B-=Math.max(0,Math.ceil(.1*B)),z-=Math.max(0,Math.ceil(.1*z)),Y-=Math.max(0,Math.ceil(.1*Y)),H=g(C.relativeLuminance2(B,z,Y),C.relativeLuminance2(M,I,L));return(B<<24|z<<16|Y<<8|255)>>>0}function E(P,A,N){const M=P>>24&255,I=P>>16&255,L=P>>8&255;let B=A>>24&255,z=A>>16&255,Y=A>>8&255,H=g(C.relativeLuminance2(B,z,Y),C.relativeLuminance2(M,I,L));for(;H<N&&(B<255||z<255||Y<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),z=Math.min(255,z+Math.ceil(.1*(255-z))),Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),H=g(C.relativeLuminance2(B,z,Y),C.relativeLuminance2(M,I,L));return(B<<24|z<<16|Y<<8|255)>>>0}b.blend=function(P,A){if(h=(255&A)/255,h===1)return A;const N=A>>24&255,M=A>>16&255,I=A>>8&255,L=P>>24&255,B=P>>16&255,z=P>>8&255;return d=L+Math.round((N-L)*h),f=B+Math.round((M-B)*h),m=z+Math.round((I-z)*h),x.toRgba(d,f,m)},b.ensureContrastRatio=function(P,A,N){const M=C.relativeLuminance(P>>8),I=C.relativeLuminance(A>>8);if(g(M,I)<N){if(I<M){const z=k(P,A,N),Y=g(M,C.relativeLuminance(z>>8));if(Y<N){const H=E(P,A,N);return Y>g(M,C.relativeLuminance(H>>8))?z:H}return z}const L=E(P,A,N),B=g(M,C.relativeLuminance(L>>8));if(B<N){const z=k(P,A,N);return B>g(M,C.relativeLuminance(z>>8))?L:z}return L}},b.reduceLuminance=k,b.increaseLuminance=E,b.toChannels=function(P){return[P>>24&255,P>>16&255,P>>8&255,255&P]}})(v||(l.rgba=v={})),l.toPaddedHex=y,l.contrastRatio=g},8969:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=d(844),m=d(2585),h=d(4348),x=d(7866),w=d(744),j=d(7302),C=d(6975),v=d(8460),y=d(1753),g=d(1480),b=d(7994),k=d(9282),E=d(5435),P=d(5981),A=d(2660);let N=!1;class M extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((L=>{var B;(B=this._onScrollApi)==null||B.fire(L.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(L){for(const B in L)this.optionsService.options[B]=L[B]}constructor(L){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new j.OptionsService(L)),this._instantiationService.setService(m.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(w.BufferService)),this._instantiationService.setService(m.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(x.LogService)),this._instantiationService.setService(m.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(m.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(y.CoreMouseService)),this._instantiationService.setService(m.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(g.UnicodeService)),this._instantiationService.setService(m.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b.CharsetService),this._instantiationService.setService(m.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(A.OscLinkService),this._instantiationService.setService(m.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new E.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((B=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new P.WriteBuffer(((B,z)=>this._inputHandler.parse(B,z)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(L,B){this._writeBuffer.write(L,B)}writeSync(L,B){this._logService.logLevel<=m.LogLevelEnum.WARN&&!N&&(this._logService.warn("writeSync is unreliable and will be removed soon."),N=!0),this._writeBuffer.writeSync(L,B)}input(L,B=!0){this.coreService.triggerDataEvent(L,B)}resize(L,B){isNaN(L)||isNaN(B)||(L=Math.max(L,w.MINIMUM_COLS),B=Math.max(B,w.MINIMUM_ROWS),this._bufferService.resize(L,B))}scroll(L,B=!1){this._bufferService.scroll(L,B)}scrollLines(L,B,z){this._bufferService.scrollLines(L,B,z)}scrollPages(L){this.scrollLines(L*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(L){const B=L-this._bufferService.buffer.ydisp;B!==0&&this.scrollLines(B)}registerEscHandler(L,B){return this._inputHandler.registerEscHandler(L,B)}registerDcsHandler(L,B){return this._inputHandler.registerDcsHandler(L,B)}registerCsiHandler(L,B){return this._inputHandler.registerCsiHandler(L,B)}registerOscHandler(L,B){return this._inputHandler.registerOscHandler(L,B)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let L=!1;const B=this.optionsService.rawOptions.windowsPty;B&&B.buildNumber!==void 0&&B.buildNumber!==void 0?L=B.backend==="conpty"&&B.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(L=!0),L?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const L=[];L.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),L.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const B of L)B.dispose()}))}}}l.CoreTerminal=M},8460:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===d)return void this._listeners.splice(f,1)}}})),this._event}fire(d,f){const m=[];for(let h=0;h<this._listeners.length;h++)m.push(this._listeners[h]);for(let h=0;h<m.length;h++)m[h].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,f){return d((m=>f.fire(m)))},l.runAndSubscribe=function(d,f){return f(void 0),d((m=>f(m)))}},5435:function(u,l,d){var f=this&&this.__decorate||function(q,O,R,$){var G,F=arguments.length,te=F<3?O:$===null?$=Object.getOwnPropertyDescriptor(O,R):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")te=Reflect.decorate(q,O,R,$);else for(var ce=q.length-1;ce>=0;ce--)(G=q[ce])&&(te=(F<3?G(te):F>3?G(O,R,te):G(O,R))||te);return F>3&&te&&Object.defineProperty(O,R,te),te},m=this&&this.__param||function(q,O){return function(R,$){O(R,$,q)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const h=d(2584),x=d(7116),w=d(2015),j=d(844),C=d(482),v=d(8437),y=d(8460),g=d(643),b=d(511),k=d(3734),E=d(2585),P=d(1480),A=d(6242),N=d(6351),M=d(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},L=131072;function B(q,O){if(q>24)return O.setWinLines||!1;switch(q){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var z;(function(q){q[q.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",q[q.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(z||(l.WindowsOptionsReportType=z={}));let Y=0;class H extends j.Disposable{getAttrData(){return this._curAttrData}constructor(O,R,$,G,F,te,ce,fe,J=new w.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=R,this._coreService=$,this._logService=G,this._optionsService=F,this._oscLinkService=te,this._coreMouseService=ce,this._unicodeService=fe,this._parser=J,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new b.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new y.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new y.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new y.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new y.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new y.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new y.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new y.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new y.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new y.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new y.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((W=>this._activeBuffer=W.activeBuffer))),this._parser.setCsiHandlerFallback(((W,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(W),params:ae.toArray()})})),this._parser.setEscHandlerFallback((W=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(W)})})),this._parser.setExecuteHandlerFallback((W=>{this._logService.debug("Unknown EXECUTE code: ",{code:W})})),this._parser.setOscHandlerFallback(((W,ae,ne)=>{this._logService.debug("Unknown OSC code: ",{identifier:W,action:ae,data:ne})})),this._parser.setDcsHandlerFallback(((W,ae,ne)=>{ae==="HOOK"&&(ne=ne.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(W),action:ae,payload:ne})})),this._parser.setPrintHandler(((W,ae,ne)=>this.print(W,ae,ne))),this._parser.registerCsiHandler({final:"@"},(W=>this.insertChars(W))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(W=>this.scrollLeft(W))),this._parser.registerCsiHandler({final:"A"},(W=>this.cursorUp(W))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(W=>this.scrollRight(W))),this._parser.registerCsiHandler({final:"B"},(W=>this.cursorDown(W))),this._parser.registerCsiHandler({final:"C"},(W=>this.cursorForward(W))),this._parser.registerCsiHandler({final:"D"},(W=>this.cursorBackward(W))),this._parser.registerCsiHandler({final:"E"},(W=>this.cursorNextLine(W))),this._parser.registerCsiHandler({final:"F"},(W=>this.cursorPrecedingLine(W))),this._parser.registerCsiHandler({final:"G"},(W=>this.cursorCharAbsolute(W))),this._parser.registerCsiHandler({final:"H"},(W=>this.cursorPosition(W))),this._parser.registerCsiHandler({final:"I"},(W=>this.cursorForwardTab(W))),this._parser.registerCsiHandler({final:"J"},(W=>this.eraseInDisplay(W,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(W=>this.eraseInDisplay(W,!0))),this._parser.registerCsiHandler({final:"K"},(W=>this.eraseInLine(W,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(W=>this.eraseInLine(W,!0))),this._parser.registerCsiHandler({final:"L"},(W=>this.insertLines(W))),this._parser.registerCsiHandler({final:"M"},(W=>this.deleteLines(W))),this._parser.registerCsiHandler({final:"P"},(W=>this.deleteChars(W))),this._parser.registerCsiHandler({final:"S"},(W=>this.scrollUp(W))),this._parser.registerCsiHandler({final:"T"},(W=>this.scrollDown(W))),this._parser.registerCsiHandler({final:"X"},(W=>this.eraseChars(W))),this._parser.registerCsiHandler({final:"Z"},(W=>this.cursorBackwardTab(W))),this._parser.registerCsiHandler({final:"`"},(W=>this.charPosAbsolute(W))),this._parser.registerCsiHandler({final:"a"},(W=>this.hPositionRelative(W))),this._parser.registerCsiHandler({final:"b"},(W=>this.repeatPrecedingCharacter(W))),this._parser.registerCsiHandler({final:"c"},(W=>this.sendDeviceAttributesPrimary(W))),this._parser.registerCsiHandler({prefix:">",final:"c"},(W=>this.sendDeviceAttributesSecondary(W))),this._parser.registerCsiHandler({final:"d"},(W=>this.linePosAbsolute(W))),this._parser.registerCsiHandler({final:"e"},(W=>this.vPositionRelative(W))),this._parser.registerCsiHandler({final:"f"},(W=>this.hVPosition(W))),this._parser.registerCsiHandler({final:"g"},(W=>this.tabClear(W))),this._parser.registerCsiHandler({final:"h"},(W=>this.setMode(W))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(W=>this.setModePrivate(W))),this._parser.registerCsiHandler({final:"l"},(W=>this.resetMode(W))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(W=>this.resetModePrivate(W))),this._parser.registerCsiHandler({final:"m"},(W=>this.charAttributes(W))),this._parser.registerCsiHandler({final:"n"},(W=>this.deviceStatus(W))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(W=>this.deviceStatusPrivate(W))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(W=>this.softReset(W))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(W=>this.setCursorStyle(W))),this._parser.registerCsiHandler({final:"r"},(W=>this.setScrollRegion(W))),this._parser.registerCsiHandler({final:"s"},(W=>this.saveCursor(W))),this._parser.registerCsiHandler({final:"t"},(W=>this.windowOptions(W))),this._parser.registerCsiHandler({final:"u"},(W=>this.restoreCursor(W))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(W=>this.insertColumns(W))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(W=>this.deleteColumns(W))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(W=>this.selectProtected(W))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(W=>this.requestMode(W,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(W=>this.requestMode(W,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new A.OscHandler((W=>(this.setTitle(W),this.setIconName(W),!0)))),this._parser.registerOscHandler(1,new A.OscHandler((W=>this.setIconName(W)))),this._parser.registerOscHandler(2,new A.OscHandler((W=>this.setTitle(W)))),this._parser.registerOscHandler(4,new A.OscHandler((W=>this.setOrReportIndexedColor(W)))),this._parser.registerOscHandler(8,new A.OscHandler((W=>this.setHyperlink(W)))),this._parser.registerOscHandler(10,new A.OscHandler((W=>this.setOrReportFgColor(W)))),this._parser.registerOscHandler(11,new A.OscHandler((W=>this.setOrReportBgColor(W)))),this._parser.registerOscHandler(12,new A.OscHandler((W=>this.setOrReportCursorColor(W)))),this._parser.registerOscHandler(104,new A.OscHandler((W=>this.restoreIndexedColor(W)))),this._parser.registerOscHandler(110,new A.OscHandler((W=>this.restoreFgColor(W)))),this._parser.registerOscHandler(111,new A.OscHandler((W=>this.restoreBgColor(W)))),this._parser.registerOscHandler(112,new A.OscHandler((W=>this.restoreCursorColor(W)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const W in x.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:W},(()=>this.selectCharset("("+W))),this._parser.registerEscHandler({intermediates:")",final:W},(()=>this.selectCharset(")"+W))),this._parser.registerEscHandler({intermediates:"*",final:W},(()=>this.selectCharset("*"+W))),this._parser.registerEscHandler({intermediates:"+",final:W},(()=>this.selectCharset("+"+W))),this._parser.registerEscHandler({intermediates:"-",final:W},(()=>this.selectCharset("-"+W))),this._parser.registerEscHandler({intermediates:".",final:W},(()=>this.selectCharset("."+W))),this._parser.registerEscHandler({intermediates:"/",final:W},(()=>this.selectCharset("/"+W)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((W=>(this._logService.error("Parsing error: ",W),W))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new N.DcsHandler(((W,ae)=>this.requestStatusString(W,ae))))}_preserveStack(O,R,$,G){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=R,this._parseStack.decodedLength=$,this._parseStack.position=G}_logSlowResolvingAsync(O){this._logService.logLevel<=E.LogLevelEnum.WARN&&Promise.race([O,new Promise(((R,$)=>setTimeout((()=>$("#SLOW_TIMEOUT")),5e3)))]).catch((R=>{if(R!=="#SLOW_TIMEOUT")throw R;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,R){let $,G=this._activeBuffer.x,F=this._activeBuffer.y,te=0;const ce=this._parseStack.paused;if(ce){if($=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,R))return this._logSlowResolvingAsync($),$;G=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>L&&(te=this._parseStack.position+L)}if(this._logService.logLevel<=E.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(W=>String.fromCharCode(W))).join("")}"`),typeof O=="string"?O.split("").map((W=>W.charCodeAt(0))):O),this._parseBuffer.length<O.length&&this._parseBuffer.length<L&&(this._parseBuffer=new Uint32Array(Math.min(O.length,L))),ce||this._dirtyRowTracker.clearRange(),O.length>L)for(let W=te;W<O.length;W+=L){const ae=W+L<O.length?W+L:O.length,ne=typeof O=="string"?this._stringDecoder.decode(O.substring(W,ae),this._parseBuffer):this._utf8Decoder.decode(O.subarray(W,ae),this._parseBuffer);if($=this._parser.parse(this._parseBuffer,ne))return this._preserveStack(G,F,ne,W),this._logSlowResolvingAsync($),$}else if(!ce){const W=typeof O=="string"?this._stringDecoder.decode(O,this._parseBuffer):this._utf8Decoder.decode(O,this._parseBuffer);if($=this._parser.parse(this._parseBuffer,W))return this._preserveStack(G,F,W,0),this._logSlowResolvingAsync($),$}this._activeBuffer.x===G&&this._activeBuffer.y===F||this._onCursorMove.fire();const fe=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),J=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);J<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(J,this._bufferService.rows-1),Math.min(fe,this._bufferService.rows-1))}print(O,R,$){let G,F;const te=this._charsetService.charset,ce=this._optionsService.rawOptions.screenReaderMode,fe=this._bufferService.cols,J=this._coreService.decPrivateModes.wraparound,W=this._coreService.modes.insertMode,ae=this._curAttrData;let ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&$-R>0&&ne.getWidth(this._activeBuffer.x-1)===2&&ne.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let Z=this._parser.precedingJoinState;for(let le=R;le<$;++le){if(G=O[le],G<127&&te){const me=te[String.fromCharCode(G)];me&&(G=me.charCodeAt(0))}const Ce=this._unicodeService.charProperties(G,Z);F=P.UnicodeService.extractWidth(Ce);const Le=P.UnicodeService.extractShouldJoin(Ce),Ge=Le?P.UnicodeService.extractWidth(Z):0;if(Z=Ce,ce&&this._onA11yChar.fire((0,C.stringFromCodePoint)(G)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-Ge>fe){if(J){const me=ne;let be=this._activeBuffer.x-Ge;for(this._activeBuffer.x=Ge,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),ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ge>0&&ne instanceof v.BufferLine&&ne.copyCellsFrom(me,be,0,Ge,!1);be<fe;)me.setCellFromCodepoint(be++,0,1,ae)}else if(this._activeBuffer.x=fe-1,F===2)continue}if(Le&&this._activeBuffer.x){const me=ne.getWidth(this._activeBuffer.x-1)?1:2;ne.addCodepointToCell(this._activeBuffer.x-me,G,F);for(let be=F-Ge;--be>=0;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if(W&&(ne.insertCells(this._activeBuffer.x,F-Ge,this._activeBuffer.getNullCell(ae)),ne.getWidth(fe-1)===2&&ne.setCellFromCodepoint(fe-1,g.NULL_CELL_CODE,g.NULL_CELL_WIDTH,ae)),ne.setCellFromCodepoint(this._activeBuffer.x++,G,F,ae),F>0)for(;--F;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=Z,this._activeBuffer.x<fe&&$-R>0&&ne.getWidth(this._activeBuffer.x)===0&&!ne.hasContent(this._activeBuffer.x)&&ne.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,R){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,R):this._parser.registerCsiHandler(O,($=>!B($.params[0],this._optionsService.rawOptions.windowOptions)||R($)))}registerDcsHandler(O,R){return this._parser.registerDcsHandler(O,new N.DcsHandler(R))}registerEscHandler(O,R){return this._parser.registerEscHandler(O,R)}registerOscHandler(O,R){return this._parser.registerOscHandler(O,new A.OscHandler(R))}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 O;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&&((O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&O.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);R.hasWidth(this._activeBuffer.x)&&!R.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,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(O,R){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+R):(this._activeBuffer.x=O,this._activeBuffer.y=R),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,R){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+R)}cursorUp(O){const R=this._activeBuffer.y-this._activeBuffer.scrollTop;return R>=0?this._moveCursor(0,-Math.min(R,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const R=this._activeBuffer.scrollBottom-this._activeBuffer.y;return R>=0?this._moveCursor(0,Math.min(R,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const R=O.params[0];return R===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:R===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=O.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=O.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const R=O.params[0];return R===1&&(this._curAttrData.bg|=536870912),R!==2&&R!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,R,$,G=!1,F=!1){const te=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);te.replaceCells(R,$,this._activeBuffer.getNullCell(this._eraseAttrData()),F),G&&(te.isWrapped=!1)}_resetBufferLine(O,R=!1){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);$&&($.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),R),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),$.isWrapped=!1)}eraseInDisplay(O,R=!1){let $;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);$<this._bufferService.rows;$++)this._resetBufferLine($,R);this._dirtyRowTracker.markDirty($);break;case 1:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($,0,this._activeBuffer.x+1,!0,R),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get($+1).isWrapped=!1);$--;)this._resetBufferLine($,R);this._dirtyRowTracker.markDirty(0);break;case 2:for($=this._bufferService.rows,this._dirtyRowTracker.markDirty($-1);$--;)this._resetBufferLine($,R);this._dirtyRowTracker.markDirty(0);break;case 3:const G=this._activeBuffer.lines.length-this._bufferService.rows;G>0&&(this._activeBuffer.lines.trimStart(G),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-G,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-G,0),this._onScroll.fire(0))}return!0}eraseInLine(O,R=!1){switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,R);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,R)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let R=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y,G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-G+1;for(;R--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(O){this._restrictCursor();let R=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y;let G;for(G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,G=this._bufferService.rows-1+this._activeBuffer.ybase-G;R--;)this._activeBuffer.lines.splice($,1),this._activeBuffer.lines.splice(G,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(O){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.insertCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(O){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.deleteCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(O){let R=O.params[0]||1;for(;R--;)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(O){let R=O.params[0]||1;for(;R--;)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(v.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=O.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);G.deleteCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=O.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);G.insertCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=O.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);G.insertCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=O.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);G.deleteCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(O){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(O.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(O){const R=this._parser.precedingJoinState;if(!R)return!0;const $=O.params[0]||1,G=P.UnicodeService.extractWidth(R),F=this._activeBuffer.x-G,te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),ce=new Uint32Array(te.length*$);let fe=0;for(let W=0;W<te.length;){const ae=te.codePointAt(W)||0;ce[fe++]=ae,W+=ae>65535?2:1}let J=fe;for(let W=1;W<$;++W)ce.copyWithin(J,0,fe),J+=fe;return this.print(ce,0,J),!0}sendDeviceAttributesPrimary(O){return O.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(O){return O.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let R=0;R<O.length;R++)switch(O.params[R]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(O){for(let R=0;R<O.length;R++)switch(O.params[R]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,x.DEFAULT_CHARSET),this._charsetService.setgCharset(1,x.DEFAULT_CHARSET),this._charsetService.setgCharset(2,x.DEFAULT_CHARSET),this._charsetService.setgCharset(3,x.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(O){for(let R=0;R<O.length;R++)switch(O.params[R]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(O){for(let R=0;R<O.length;R++)switch(O.params[R]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),O.params[R]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(O,R){const $=this._coreService.decPrivateModes,{activeProtocol:G,activeEncoding:F}=this._coreMouseService,te=this._coreService,{buffers:ce,cols:fe}=this._bufferService,{active:J,alt:W}=ce,ae=this._optionsService.rawOptions,ne=Le=>Le?1:2,Z=O.params[0];return le=Z,Ce=R?Z===2?4:Z===4?ne(te.modes.insertMode):Z===12?3:Z===20?ne(ae.convertEol):0:Z===1?ne($.applicationCursorKeys):Z===3?ae.windowOptions.setWinLines?fe===80?2:fe===132?1:0:0:Z===6?ne($.origin):Z===7?ne($.wraparound):Z===8?3:Z===9?ne(G==="X10"):Z===12?ne(ae.cursorBlink):Z===25?ne(!te.isCursorHidden):Z===45?ne($.reverseWraparound):Z===66?ne($.applicationKeypad):Z===67?4:Z===1e3?ne(G==="VT200"):Z===1002?ne(G==="DRAG"):Z===1003?ne(G==="ANY"):Z===1004?ne($.sendFocus):Z===1005?4:Z===1006?ne(F==="SGR"):Z===1015?4:Z===1016?ne(F==="SGR_PIXELS"):Z===1048?1:Z===47||Z===1047||Z===1049?ne(J===W):Z===2004?ne($.bracketedPasteMode):0,te.triggerDataEvent(`${h.C0.ESC}[${R?"":"?"}${le};${Ce}$y`),!0;var le,Ce}_updateAttrColor(O,R,$,G,F){return R===2?(O|=50331648,O&=-16777216,O|=k.AttributeData.fromColorRGB([$,G,F])):R===5&&(O&=-50331904,O|=33554432|255&$),O}_extractColor(O,R,$){const G=[0,0,-1,0,0,0];let F=0,te=0;do{if(G[te+F]=O.params[R+te],O.hasSubParams(R+te)){const ce=O.getSubParams(R+te);let fe=0;do G[1]===5&&(F=1),G[te+fe+1+F]=ce[fe];while(++fe<ce.length&&fe+te+1+F<G.length);break}if(G[1]===5&&te+F>=2||G[1]===2&&te+F>=5)break;G[1]&&(F=1)}while(++te+R<O.length&&te+F<G.length);for(let ce=2;ce<G.length;++ce)G[ce]===-1&&(G[ce]=0);switch(G[0]){case 38:$.fg=this._updateAttrColor($.fg,G[1],G[3],G[4],G[5]);break;case 48:$.bg=this._updateAttrColor($.bg,G[1],G[3],G[4],G[5]);break;case 58:$.extended=$.extended.clone(),$.extended.underlineColor=this._updateAttrColor($.extended.underlineColor,G[1],G[3],G[4],G[5])}return te}_processUnderline(O,R){R.extended=R.extended.clone(),(!~O||O>5)&&(O=1),R.extended.underlineStyle=O,R.fg|=268435456,O===0&&(R.fg&=-268435457),R.updateExtended()}_processSGR0(O){O.fg=v.DEFAULT_ATTR_DATA.fg,O.bg=v.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const R=O.length;let $;const G=this._curAttrData;for(let F=0;F<R;F++)$=O.params[F],$>=30&&$<=37?(G.fg&=-50331904,G.fg|=16777216|$-30):$>=40&&$<=47?(G.bg&=-50331904,G.bg|=16777216|$-40):$>=90&&$<=97?(G.fg&=-50331904,G.fg|=16777224|$-90):$>=100&&$<=107?(G.bg&=-50331904,G.bg|=16777224|$-100):$===0?this._processSGR0(G):$===1?G.fg|=134217728:$===3?G.bg|=67108864:$===4?(G.fg|=268435456,this._processUnderline(O.hasSubParams(F)?O.getSubParams(F)[0]:1,G)):$===5?G.fg|=536870912:$===7?G.fg|=67108864:$===8?G.fg|=1073741824:$===9?G.fg|=2147483648:$===2?G.bg|=134217728:$===21?this._processUnderline(2,G):$===22?(G.fg&=-134217729,G.bg&=-134217729):$===23?G.bg&=-67108865:$===24?(G.fg&=-268435457,this._processUnderline(0,G)):$===25?G.fg&=-536870913:$===27?G.fg&=-67108865:$===28?G.fg&=-1073741825:$===29?G.fg&=2147483647:$===39?(G.fg&=-67108864,G.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):$===49?(G.bg&=-67108864,G.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):$===38||$===48||$===58?F+=this._extractColor(O,F,G):$===53?G.bg|=1073741824:$===55?G.bg&=-1073741825:$===59?(G.extended=G.extended.clone(),G.extended.underlineColor=-1,G.updateExtended()):$===100?(G.fg&=-67108864,G.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,G.bg&=-67108864,G.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",$);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const R=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${R};${$}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const R=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${R};${$}R`)}return!0}softReset(O){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(O){const R=O.params[0]||1;switch(R){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const $=R%2==1;return this._optionsService.options.cursorBlink=$,!0}setScrollRegion(O){const R=O.params[0]||1;let $;return(O.length<2||($=O.params[1])>this._bufferService.rows||$===0)&&($=this._bufferService.rows),$>R&&(this._activeBuffer.scrollTop=R-1,this._activeBuffer.scrollBottom=$-1,this._setCursor(0,0)),!0}windowOptions(O){if(!B(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const R=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:R!==2&&this._onRequestWindowsOptionsReport.fire(z.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(z.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:R!==0&&R!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),R!==0&&R!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:R!==0&&R!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),R!==0&&R!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(O){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(O){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(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const R=[],$=O.split(";");for(;$.length>1;){const G=$.shift(),F=$.shift();if(/^\d+$/.exec(G)){const te=parseInt(G);if(X(te))if(F==="?")R.push({type:0,index:te});else{const ce=(0,M.parseColor)(F);ce&&R.push({type:1,index:te,color:ce})}}}return R.length&&this._onColor.fire(R),!0}setHyperlink(O){const R=O.split(";");return!(R.length<2)&&(R[1]?this._createHyperlink(R[0],R[1]):!R[0]&&this._finishHyperlink())}_createHyperlink(O,R){this._getCurrentLinkId()&&this._finishHyperlink();const $=O.split(":");let G;const F=$.findIndex((te=>te.startsWith("id=")));return F!==-1&&(G=$[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:G,uri:R}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,R){const $=O.split(";");for(let G=0;G<$.length&&!(R>=this._specialColors.length);++G,++R)if($[G]==="?")this._onColor.fire([{type:0,index:this._specialColors[R]}]);else{const F=(0,M.parseColor)($[G]);F&&this._onColor.fire([{type:1,index:this._specialColors[R],color:F}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const R=[],$=O.split(";");for(let G=0;G<$.length;++G)if(/^\d+$/.exec($[G])){const F=parseInt($[G]);X(F)&&R.push({type:2,index:F})}return R.length&&this._onColor.fire(R),!0}restoreFgColor(O){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(O){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(O){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,x.DEFAULT_CHARSET),!0}selectCharset(O){return O.length!==2?(this.selectDefaultCharset(),!0):(O[0]==="/"||this._charsetService.setgCharset(I[O[0]],x.CHARSETS[O[1]]||x.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,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=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new b.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let R=0;R<this._bufferService.rows;++R){const $=this._activeBuffer.ybase+this._activeBuffer.y+R,G=this._activeBuffer.lines.get($);G&&(G.fill(O),G.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(O,R){const $=this._bufferService.buffer,G=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${F}${h.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${$.scrollTop+1};${$.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[G.cursorStyle]-(G.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,R){this._dirtyRowTracker.markRangeDirty(O,R)}}l.InputHandler=H;let U=class{constructor(q){this._bufferService=q,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(q){q<this.start?this.start=q:q>this.end&&(this.end=q)}markRangeDirty(q,O){q>O&&(Y=q,q=O,O=Y),q<this.start&&(this.start=q),O>this.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(q){return 0<=q&&q<256}U=f([m(0,E.IBufferService)],U)},844:(u,l)=>{function d(f){for(const m of f)m.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const m=this._disposables.indexOf(f);m!==-1&&this._disposables.splice(m,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var m;this._isDisposed||f===this._value||((m=this._value)==null||m.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=d,l.getDisposeArrayDisposable=function(f){return{dispose:()=>d(f)}}},1505:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(m,h,x){this._data[m]||(this._data[m]={}),this._data[m][h]=x}get(m,h){return this._data[m]?this._data[m][h]:void 0}clear(){this._data={}}}l.TwoKeyMap=d,l.FourKeyMap=class{constructor(){this._data=new d}set(f,m,h,x,w){this._data.get(f,m)||this._data.set(f,m,new d),this._data.get(f,m).set(h,x,w)}get(f,m,h,x){var w;return(w=this._data.get(f,m))==null?void 0:w.get(h,x)}clear(){this._data.clear()}}},6114:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const d=l.isNode?"node":navigator.userAgent,f=l.isNode?"node":navigator.platform;l.isFirefox=d.includes("Firefox"),l.isLegacyEdge=d.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(d),l.getSafariVersion=function(){if(!l.isSafari)return 0;const m=d.match(/Version\/(\d+)/);return m===null||m.length<2?0:parseInt(m[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),l.isIpad=f==="iPad",l.isIphone=f==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),l.isLinux=f.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(d)},6106:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let d=0;l.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(d=this._search(this._getKey(f)),this._array.splice(d,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const m=this._getKey(f);if(m===void 0||(d=this._search(m),d===-1)||this._getKey(this._array[d])!==m)return!1;do if(this._array[d]===f)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===m);return!1}*getKeyIterator(f){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===f)}forEachByKey(f,m){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do m(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===f)}values(){return[...this._array].values()}_search(f){let m=0,h=this._array.length-1;for(;h>=m;){let x=m+h>>1;const w=this._getKey(this._array[x]);if(w>f)h=x-1;else{if(!(w<f)){for(;x>0&&this._getKey(this._array[x-1])===f;)x--;return x}m=x+1}}return m}}},7226:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const f=d(6114);class m{constructor(){this._tasks=[],this._i=0}enqueue(w){this._tasks.push(w),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(w){this._idleCallback=void 0;let j=0,C=0,v=w.timeRemaining(),y=0;for(;this._i<this._tasks.length;){if(j=Date.now(),this._tasks[this._i]()||this._i++,j=Math.max(1,Date.now()-j),C=Math.max(j,C),y=w.timeRemaining(),1.5*C>y)return v-j<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-j))}ms`),void this._start();v=y}this.clear()}}class h extends m{_requestCallback(w){return setTimeout((()=>w(this._createDeadline(16))))}_cancelCallback(w){clearTimeout(w)}_createDeadline(w){const j=Date.now()+w;return{timeRemaining:()=>Math.max(0,j-Date.now())}}}l.PriorityTaskQueue=h,l.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends m{_requestCallback(x){return requestIdleCallback(x)}_cancelCallback(x){cancelIdleCallback(x)}}:h,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(x){this._queue.clear(),this._queue.enqueue(x)}flush(){this._queue.flush()}}},9282:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const f=d(643);l.updateWindowsModeWrappedState=function(m){const h=m.buffer.lines.get(m.buffer.ybase+m.buffer.y-1),x=h==null?void 0:h.get(m.cols-1),w=m.buffer.lines.get(m.buffer.ybase+m.buffer.y);w&&x&&(w.isWrapped=x[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&x[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new d;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}l.AttributeData=d;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,x=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=x}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=f},9092:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const f=d(6349),m=d(7226),h=d(3734),x=d(8437),w=d(4634),j=d(511),C=d(643),v=d(4863),y=d(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(g,b,k){this._hasScrollback=g,this._optionsService=b,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=x.DEFAULT_ATTR_DATA.clone(),this.savedCharset=y.DEFAULT_CHARSET,this.markers=[],this._nullCell=j.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=j.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new m.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(g){return g?(this._nullCell.fg=g.fg,this._nullCell.bg=g.bg,this._nullCell.extended=g.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(g){return g?(this._whitespaceCell.fg=g.fg,this._whitespaceCell.bg=g.bg,this._whitespaceCell.extended=g.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(g,b){return new x.BufferLine(this._bufferService.cols,this.getNullCell(g),b)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const g=this.ybase+this.y-this.ydisp;return g>=0&&g<this._rows}_getCorrectBufferLength(g){if(!this._hasScrollback)return g;const b=g+this._optionsService.rawOptions.scrollback;return b>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:b}fillViewportRows(g){if(this.lines.length===0){g===void 0&&(g=x.DEFAULT_ATTR_DATA);let b=this._rows;for(;b--;)this.lines.push(this.getBlankLine(g))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(g,b){const k=this.getNullCell(x.DEFAULT_ATTR_DATA);let E=0;const P=this._getCorrectBufferLength(b);if(P>this.lines.maxLength&&(this.lines.maxLength=P),this.lines.length>0){if(this._cols<g)for(let N=0;N<this.lines.length;N++)E+=+this.lines.get(N).resize(g,k);let A=0;if(this._rows<b)for(let N=this._rows;N<b;N++)this.lines.length<b+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new x.BufferLine(g,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+A+1?(this.ybase--,A++,this.ydisp>0&&this.ydisp--):this.lines.push(new x.BufferLine(g,k)));else for(let N=this._rows;N>b;N--)this.lines.length>b+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(P<this.lines.maxLength){const N=this.lines.length-P;N>0&&(this.lines.trimStart(N),this.ybase=Math.max(this.ybase-N,0),this.ydisp=Math.max(this.ydisp-N,0),this.savedY=Math.max(this.savedY-N,0)),this.lines.maxLength=P}this.x=Math.min(this.x,g-1),this.y=Math.min(this.y,b-1),A&&(this.y+=A),this.savedX=Math.min(this.savedX,g-1),this.scrollTop=0}if(this.scrollBottom=b-1,this._isReflowEnabled&&(this._reflow(g,b),this._cols>g))for(let A=0;A<this.lines.length;A++)E+=+this.lines.get(A).resize(g,k);this._cols=g,this._rows=b,this._memoryCleanupQueue.clear(),E>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let g=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,g=!1);let b=0;for(;this._memoryCleanupPosition<this.lines.length;)if(b+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),b>100)return!0;return g}get _isReflowEnabled(){const g=this._optionsService.rawOptions.windowsPty;return g&&g.buildNumber?this._hasScrollback&&g.backend==="conpty"&&g.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(g,b){this._cols!==g&&(g>this._cols?this._reflowLarger(g,b):this._reflowSmaller(g,b))}_reflowLarger(g,b){const k=(0,w.reflowLargerGetLinesToRemove)(this.lines,this._cols,g,this.ybase+this.y,this.getNullCell(x.DEFAULT_ATTR_DATA));if(k.length>0){const E=(0,w.reflowLargerCreateNewLayout)(this.lines,k);(0,w.reflowLargerApplyNewLayout)(this.lines,E.layout),this._reflowLargerAdjustViewport(g,b,E.countRemoved)}}_reflowLargerAdjustViewport(g,b,k){const E=this.getNullCell(x.DEFAULT_ATTR_DATA);let P=k;for(;P-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<b&&this.lines.push(new x.BufferLine(g,E))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(g,b){const k=this.getNullCell(x.DEFAULT_ATTR_DATA),E=[];let P=0;for(let A=this.lines.length-1;A>=0;A--){let N=this.lines.get(A);if(!N||!N.isWrapped&&N.getTrimmedLength()<=g)continue;const M=[N];for(;N.isWrapped&&A>0;)N=this.lines.get(--A),M.unshift(N);const I=this.ybase+this.y;if(I>=A&&I<A+M.length)continue;const L=M[M.length-1].getTrimmedLength(),B=(0,w.reflowSmallerGetNewLineLengths)(M,this._cols,g),z=B.length-M.length;let Y;Y=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+z):Math.max(0,this.lines.length-this.lines.maxLength+z);const H=[];for(let $=0;$<z;$++){const G=this.getBlankLine(x.DEFAULT_ATTR_DATA,!0);H.push(G)}H.length>0&&(E.push({start:A+M.length+P,newLines:H}),P+=H.length),M.push(...H);let U=B.length-1,X=B[U];X===0&&(U--,X=B[U]);let q=M.length-z-1,O=L;for(;q>=0;){const $=Math.min(O,X);if(M[U]===void 0)break;if(M[U].copyCellsFrom(M[q],O-$,X-$,$,!0),X-=$,X===0&&(U--,X=B[U]),O-=$,O===0){q--;const G=Math.max(q,0);O=(0,w.getWrappedLineTrimmedLength)(M,G,this._cols)}}for(let $=0;$<M.length;$++)B[$]<g&&M[$].setCell(B[$],k);let R=z-Y;for(;R-- >0;)this.ybase===0?this.y<b-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+P)-b&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+z,this.ybase+b-1)}if(E.length>0){const A=[],N=[];for(let U=0;U<this.lines.length;U++)N.push(this.lines.get(U));const M=this.lines.length;let I=M-1,L=0,B=E[L];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+P);let z=0;for(let U=Math.min(this.lines.maxLength-1,M+P-1);U>=0;U--)if(B&&B.start>I+z){for(let X=B.newLines.length-1;X>=0;X--)this.lines.set(U--,B.newLines[X]);U++,A.push({index:I+1,amount:B.newLines.length}),z+=B.newLines.length,B=E[++L]}else this.lines.set(U,N[I--]);let Y=0;for(let U=A.length-1;U>=0;U--)A[U].index+=Y,this.lines.onInsertEmitter.fire(A[U]),Y+=A[U].amount;const H=Math.max(0,M+P-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(g,b,k=0,E){const P=this.lines.get(g);return P?P.translateToString(b,k,E):""}getWrappedRangeForLine(g){let b=g,k=g;for(;b>0&&this.lines.get(b).isWrapped;)b--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:b,last:k}}setupTabStops(g){for(g!=null?this.tabs[g]||(g=this.prevStop(g)):(this.tabs={},g=0);g<this._cols;g+=this._optionsService.rawOptions.tabStopWidth)this.tabs[g]=!0}prevStop(g){for(g==null&&(g=this.x);!this.tabs[--g]&&g>0;);return g>=this._cols?this._cols-1:g<0?0:g}nextStop(g){for(g==null&&(g=this.x);!this.tabs[++g]&&g<this._cols;);return g>=this._cols?this._cols-1:g<0?0:g}clearMarkers(g){this._isClearing=!0;for(let b=0;b<this.markers.length;b++)this.markers[b].line===g&&(this.markers[b].dispose(),this.markers.splice(b--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let g=0;g<this.markers.length;g++)this.markers[g].dispose(),this.markers.splice(g--,1);this._isClearing=!1}addMarker(g){const b=new v.Marker(g);return this.markers.push(b),b.register(this.lines.onTrim((k=>{b.line-=k,b.line<0&&b.dispose()}))),b.register(this.lines.onInsert((k=>{b.line>=k.index&&(b.line+=k.amount)}))),b.register(this.lines.onDelete((k=>{b.line>=k.index&&b.line<k.index+k.amount&&b.dispose(),b.line>k.index&&(b.line-=k.amount)}))),b.register(b.onDispose((()=>this._removeMarker(b)))),b}_removeMarker(g){this._isClearing||this.markers.splice(this.markers.indexOf(g),1)}}},8437:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const f=d(3734),m=d(511),h=d(643),x=d(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let w=0;class j{constructor(v,y,g=!1){this.isWrapped=g,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const b=y||m.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let k=0;k<v;++k)this.setCell(k,b);this.length=v}get(v){const y=this._data[3*v+0],g=2097151&y;return[this._data[3*v+1],2097152&y?this._combined[v]:g?(0,x.stringFromCodePoint)(g):"",y>>22,2097152&y?this._combined[v].charCodeAt(this._combined[v].length-1):g]}set(v,y){this._data[3*v+1]=y[h.CHAR_DATA_ATTR_INDEX],y[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=y[1],this._data[3*v+0]=2097152|v|y[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=y[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const y=this._data[3*v+0];return 2097152&y?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&y}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const y=this._data[3*v+0];return 2097152&y?this._combined[v]:2097151&y?(0,x.stringFromCodePoint)(2097151&y):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,y){return w=3*v,y.content=this._data[w+0],y.fg=this._data[w+1],y.bg=this._data[w+2],2097152&y.content&&(y.combinedData=this._combined[v]),268435456&y.bg&&(y.extended=this._extendedAttrs[v]),y}setCell(v,y){2097152&y.content&&(this._combined[v]=y.combinedData),268435456&y.bg&&(this._extendedAttrs[v]=y.extended),this._data[3*v+0]=y.content,this._data[3*v+1]=y.fg,this._data[3*v+2]=y.bg}setCellFromCodepoint(v,y,g,b){268435456&b.bg&&(this._extendedAttrs[v]=b.extended),this._data[3*v+0]=y|g<<22,this._data[3*v+1]=b.fg,this._data[3*v+2]=b.bg}addCodepointToCell(v,y,g){let b=this._data[3*v+0];2097152&b?this._combined[v]+=(0,x.stringFromCodePoint)(y):2097151&b?(this._combined[v]=(0,x.stringFromCodePoint)(2097151&b)+(0,x.stringFromCodePoint)(y),b&=-2097152,b|=2097152):b=y|4194304,g&&(b&=-12582913,b|=g<<22),this._data[3*v+0]=b}insertCells(v,y,g){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,g),y<this.length-v){const b=new m.CellData;for(let k=this.length-v-y-1;k>=0;--k)this.setCell(v+y+k,this.loadCell(v+k,b));for(let k=0;k<y;++k)this.setCell(v+k,g)}else for(let b=v;b<this.length;++b)this.setCell(b,g);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,g)}deleteCells(v,y,g){if(v%=this.length,y<this.length-v){const b=new m.CellData;for(let k=0;k<this.length-v-y;++k)this.setCell(v+k,this.loadCell(v+y+k,b));for(let k=this.length-y;k<this.length;++k)this.setCell(k,g)}else for(let b=v;b<this.length;++b)this.setCell(b,g);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,g),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,g)}replaceCells(v,y,g,b=!1){if(b)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,g),y<this.length&&this.getWidth(y-1)===2&&!this.isProtected(y)&&this.setCellFromCodepoint(y,0,1,g);v<y&&v<this.length;)this.isProtected(v)||this.setCell(v,g),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,g),y<this.length&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y,0,1,g);v<y&&v<this.length;)this.setCell(v++,g)}resize(v,y){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const g=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*g)this._data=new Uint32Array(this._data.buffer,0,g);else{const b=new Uint32Array(g);b.set(this._data),this._data=b}for(let b=this.length;b<v;++b)this.setCell(b,y)}else{this._data=this._data.subarray(0,g);const b=Object.keys(this._combined);for(let E=0;E<b.length;E++){const P=parseInt(b[E],10);P>=v&&delete this._combined[P]}const k=Object.keys(this._extendedAttrs);for(let E=0;E<k.length;E++){const P=parseInt(k[E],10);P>=v&&delete this._extendedAttrs[P]}}return this.length=v,4*g*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const v=new Uint32Array(this._data.length);return v.set(this._data),this._data=v,1}return 0}fill(v,y=!1){if(y)for(let g=0;g<this.length;++g)this.isProtected(g)||this.setCell(g,v);else{this._combined={},this._extendedAttrs={};for(let g=0;g<this.length;++g)this.setCell(g,v)}}copyFrom(v){this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={};for(const y in v._combined)this._combined[y]=v._combined[y];this._extendedAttrs={};for(const y in v._extendedAttrs)this._extendedAttrs[y]=v._extendedAttrs[y];this.isWrapped=v.isWrapped}clone(){const v=new j(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const y in this._combined)v._combined[y]=this._combined[y];for(const y in this._extendedAttrs)v._extendedAttrs[y]=this._extendedAttrs[y];return v.isWrapped=this.isWrapped,v}getTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,y,g,b,k){const E=v._data;if(k)for(let A=b-1;A>=0;A--){for(let N=0;N<3;N++)this._data[3*(g+A)+N]=E[3*(y+A)+N];268435456&E[3*(y+A)+2]&&(this._extendedAttrs[g+A]=v._extendedAttrs[y+A])}else for(let A=0;A<b;A++){for(let N=0;N<3;N++)this._data[3*(g+A)+N]=E[3*(y+A)+N];268435456&E[3*(y+A)+2]&&(this._extendedAttrs[g+A]=v._extendedAttrs[y+A])}const P=Object.keys(v._combined);for(let A=0;A<P.length;A++){const N=parseInt(P[A],10);N>=y&&(this._combined[N-y+g]=v._combined[N])}}translateToString(v,y,g,b){y=y??0,g=g??this.length,v&&(g=Math.min(g,this.getTrimmedLength())),b&&(b.length=0);let k="";for(;y<g;){const E=this._data[3*y+0],P=2097151&E,A=2097152&E?this._combined[y]:P?(0,x.stringFromCodePoint)(P):h.WHITESPACE_CELL_CHAR;if(k+=A,b)for(let N=0;N<A.length;++N)b.push(y);y+=E>>22||1}return b&&b.push(y),k}}l.BufferLine=j},4841:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(d,f){if(d.start.y>d.end.y)throw new Error(`Buffer range end (${d.end.x}, ${d.end.y}) cannot be before start (${d.start.x}, ${d.start.y})`);return f*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(u,l)=>{function d(f,m,h){if(m===f.length-1)return f[m].getTrimmedLength();const x=!f[m].hasContent(h-1)&&f[m].getWidth(h-1)===1,w=f[m+1].getWidth(0)===2;return x&&w?h-1:h}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(f,m,h,x,w){const j=[];for(let C=0;C<f.length-1;C++){let v=C,y=f.get(++v);if(!y.isWrapped)continue;const g=[f.get(C)];for(;v<f.length&&y.isWrapped;)g.push(y),y=f.get(++v);if(x>=C&&x<v){C+=g.length-1;continue}let b=0,k=d(g,b,m),E=1,P=0;for(;E<g.length;){const N=d(g,E,m),M=N-P,I=h-k,L=Math.min(M,I);g[b].copyCellsFrom(g[E],P,k,L,!1),k+=L,k===h&&(b++,k=0),P+=L,P===N&&(E++,P=0),k===0&&b!==0&&g[b-1].getWidth(h-1)===2&&(g[b].copyCellsFrom(g[b-1],h-1,k++,1,!1),g[b-1].setCell(h-1,w))}g[b].replaceCells(k,h,w);let A=0;for(let N=g.length-1;N>0&&(N>b||g[N].getTrimmedLength()===0);N--)A++;A>0&&(j.push(C+g.length-A),j.push(A)),C+=g.length-1}return j},l.reflowLargerCreateNewLayout=function(f,m){const h=[];let x=0,w=m[x],j=0;for(let C=0;C<f.length;C++)if(w===C){const v=m[++x];f.onDeleteEmitter.fire({index:C-j,amount:v}),C+=v-1,j+=v,w=m[++x]}else h.push(C);return{layout:h,countRemoved:j}},l.reflowLargerApplyNewLayout=function(f,m){const h=[];for(let x=0;x<m.length;x++)h.push(f.get(m[x]));for(let x=0;x<h.length;x++)f.set(x,h[x]);f.length=m.length},l.reflowSmallerGetNewLineLengths=function(f,m,h){const x=[],w=f.map(((y,g)=>d(f,g,m))).reduce(((y,g)=>y+g));let j=0,C=0,v=0;for(;v<w;){if(w-v<h){x.push(w-v);break}j+=h;const y=d(f,C,m);j>y&&(j-=y,C++);const g=f[C].getWidth(j-1)===2;g&&j--;const b=g?h-1:h;x.push(b),v+=b}return x},l.getWrappedLineTrimmedLength=d},5295:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const f=d(8460),m=d(844),h=d(9092);class x extends m.Disposable{constructor(j,C){super(),this._optionsService=j,this._bufferService=C,this._onBufferActivate=this.register(new f.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(j){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(j),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(j,C){this._normal.resize(j,C),this._alt.resize(j,C),this.setupTabStops(j)}setupTabStops(j){this._normal.setupTabStops(j),this._alt.setupTabStops(j)}}l.BufferSet=x},511:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const f=d(482),m=d(643),h=d(3734);class x extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(j){const C=new x;return C.setFromCharData(j),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(j){this.fg=j[m.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(j[m.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(j[m.CHAR_DATA_CHAR_INDEX].length===2){const v=j[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const y=j[m.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=y&&y<=57343?this.content=1024*(v-55296)+y-56320+65536|j[m.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=j[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|j[m.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=j[m.CHAR_DATA_CHAR_INDEX],this.content=2097152|j[m.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=x},643:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const f=d(8460),m=d(844);class h{get id(){return this._id}constructor(w){this.line=w,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,m.disposeArray)(this._disposables),this._disposables.length=0)}register(w){return this._disposables.push(w),w}}l.Marker=h,h._nextId=1},7116:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(u,l)=>{var d,f,m;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
587
587
  `,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(d||(l.C0=d={})),(function(h){h.PAD="€",h.HOP="",h.BPH="‚",h.NBH="ƒ",h.IND="„",h.NEL="…",h.SSA="†",h.ESA="‡",h.HTS="ˆ",h.HTJ="‰",h.VTS="Š",h.PLD="‹",h.PLU="Œ",h.RI="",h.SS2="Ž",h.SS3="",h.DCS="",h.PU1="‘",h.PU2="’",h.STS="“",h.CCH="”",h.MW="•",h.SPA="–",h.EPA="—",h.SOS="˜",h.SGCI="™",h.SCI="š",h.CSI="›",h.ST="œ",h.OSC="",h.PM="ž",h.APC="Ÿ"})(f||(l.C1=f={})),(function(h){h.ST=`${d.ESC}\\`})(m||(l.C1_ESCAPED=m={}))},7399:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const f=d(2584),m={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:["'",'"']};l.evaluateKeyboardEvent=function(h,x,w,j){const C={type:0,cancel:!1,key:void 0},v=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?C.key=x?f.C0.ESC+"OA":f.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?C.key=x?f.C0.ESC+"OD":f.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?C.key=x?f.C0.ESC+"OC":f.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(C.key=x?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=h.ctrlKey?"\b":f.C0.DEL,h.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(h.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=h.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,h.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(h.metaKey)break;v?(C.key=f.C0.ESC+"[1;"+(v+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(w?"b":"[1;5D"))):C.key=x?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(h.metaKey)break;v?(C.key=f.C0.ESC+"[1;"+(v+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(w?"f":"[1;5C"))):C.key=x?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(h.metaKey)break;v?(C.key=f.C0.ESC+"[1;"+(v+1)+"A",w||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=x?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(h.metaKey)break;v?(C.key=f.C0.ESC+"[1;"+(v+1)+"B",w||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=x?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=v?f.C0.ESC+"[3;"+(v+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=v?f.C0.ESC+"[1;"+(v+1)+"H":x?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=v?f.C0.ESC+"[1;"+(v+1)+"F":x?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:h.shiftKey?C.type=2:h.ctrlKey?C.key=f.C0.ESC+"[5;"+(v+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:h.shiftKey?C.type=3:h.ctrlKey?C.key=f.C0.ESC+"[6;"+(v+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=v?f.C0.ESC+"[1;"+(v+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=v?f.C0.ESC+"[1;"+(v+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=v?f.C0.ESC+"[1;"+(v+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=v?f.C0.ESC+"[1;"+(v+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=v?f.C0.ESC+"[15;"+(v+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=v?f.C0.ESC+"[17;"+(v+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=v?f.C0.ESC+"[18;"+(v+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=v?f.C0.ESC+"[19;"+(v+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=v?f.C0.ESC+"[20;"+(v+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=v?f.C0.ESC+"[21;"+(v+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=v?f.C0.ESC+"[23;"+(v+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=v?f.C0.ESC+"[24;"+(v+1)+"~":f.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(w&&!j||!h.altKey||h.metaKey)!w||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?C.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(C.key=f.C0.US),h.key==="@"&&(C.key=f.C0.NUL)):h.keyCode===65&&(C.type=1);else{const y=m[h.keyCode],g=y==null?void 0:y[h.shiftKey?1:0];if(g)C.key=f.C0.ESC+g;else if(h.keyCode>=65&&h.keyCode<=90){const b=h.ctrlKey?h.keyCode-64:h.keyCode+32;let k=String.fromCharCode(b);h.shiftKey&&(k=k.toUpperCase()),C.key=f.C0.ESC+k}else if(h.keyCode===32)C.key=f.C0.ESC+(h.ctrlKey?f.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let b=h.code.slice(3,4);h.shiftKey||(b=b.toLowerCase()),C.key=f.C0.ESC+b,C.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?C.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?C.key=f.C0.NUL:h.keyCode>=51&&h.keyCode<=55?C.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?C.key=f.C0.DEL:h.keyCode===219?C.key=f.C0.ESC:h.keyCode===220?C.key=f.C0.FS:h.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},l.utf32ToString=function(d,f=0,m=d.length){let h="";for(let x=f;x<m;++x){let w=d[x];w>65535?(w-=65536,h+=String.fromCharCode(55296+(w>>10))+String.fromCharCode(w%1024+56320)):h+=String.fromCharCode(w)}return h},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,f){const m=d.length;if(!m)return 0;let h=0,x=0;if(this._interim){const w=d.charCodeAt(x++);56320<=w&&w<=57343?f[h++]=1024*(this._interim-55296)+w-56320+65536:(f[h++]=this._interim,f[h++]=w),this._interim=0}for(let w=x;w<m;++w){const j=d.charCodeAt(w);if(55296<=j&&j<=56319){if(++w>=m)return this._interim=j,h;const C=d.charCodeAt(w);56320<=C&&C<=57343?f[h++]=1024*(j-55296)+C-56320+65536:(f[h++]=j,f[h++]=C)}else j!==65279&&(f[h++]=j)}return h}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,f){const m=d.length;if(!m)return 0;let h,x,w,j,C=0,v=0,y=0;if(this.interim[0]){let k=!1,E=this.interim[0];E&=(224&E)==192?31:(240&E)==224?15:7;let P,A=0;for(;(P=63&this.interim[++A])&&A<4;)E<<=6,E|=P;const N=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=N-A;for(;y<M;){if(y>=m)return 0;if(P=d[y++],(192&P)!=128){y--,k=!0;break}this.interim[A++]=P,E<<=6,E|=63&P}k||(N===2?E<128?y--:f[C++]=E:N===3?E<2048||E>=55296&&E<=57343||E===65279||(f[C++]=E):E<65536||E>1114111||(f[C++]=E)),this.interim.fill(0)}const g=m-4;let b=y;for(;b<m;){for(;!(!(b<g)||128&(h=d[b])||128&(x=d[b+1])||128&(w=d[b+2])||128&(j=d[b+3]));)f[C++]=h,f[C++]=x,f[C++]=w,f[C++]=j,b+=4;if(h=d[b++],h<128)f[C++]=h;else if((224&h)==192){if(b>=m)return this.interim[0]=h,C;if(x=d[b++],(192&x)!=128){b--;continue}if(v=(31&h)<<6|63&x,v<128){b--;continue}f[C++]=v}else if((240&h)==224){if(b>=m)return this.interim[0]=h,C;if(x=d[b++],(192&x)!=128){b--;continue}if(b>=m)return this.interim[0]=h,this.interim[1]=x,C;if(w=d[b++],(192&w)!=128){b--;continue}if(v=(15&h)<<12|(63&x)<<6|63&w,v<2048||v>=55296&&v<=57343||v===65279)continue;f[C++]=v}else if((248&h)==240){if(b>=m)return this.interim[0]=h,C;if(x=d[b++],(192&x)!=128){b--;continue}if(b>=m)return this.interim[0]=h,this.interim[1]=x,C;if(w=d[b++],(192&w)!=128){b--;continue}if(b>=m)return this.interim[0]=h,this.interim[1]=x,this.interim[2]=w,C;if(j=d[b++],(192&j)!=128){b--;continue}if(v=(7&h)<<18|(63&x)<<12|(63&w)<<6|63&j,v<65536||v>1114111)continue;f[C++]=v}}return C}}},225:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=d(1480),m=[[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]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let x;l.UnicodeV6=class{constructor(){if(this.version="6",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160),x.fill(2,4352,4448),x[9001]=2,x[9002]=2,x.fill(2,11904,42192),x[12351]=1,x.fill(2,44032,55204),x.fill(2,63744,64256),x.fill(2,65040,65050),x.fill(2,65072,65136),x.fill(2,65280,65377),x.fill(2,65504,65511);for(let w=0;w<m.length;++w)x.fill(0,m[w][0],m[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?x[w]:(function(j,C){let v,y=0,g=C.length-1;if(j<C[0][0]||j>C[g][1])return!1;for(;g>=y;)if(v=y+g>>1,j>C[v][1])y=v+1;else{if(!(j<C[v][0]))return!0;g=v-1}return!1})(w,h)?0:w>=131072&&w<=196605||w>=196608&&w<=262141?2:1}charProperties(w,j){let C=this.wcwidth(w),v=C===0&&j!==0;if(v){const y=f.UnicodeService.extractWidth(j);y===0?v=!1:y>C&&(C=y)}return f.UnicodeService.createPropertyValue(0,C,v)}}},5981:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const f=d(8460),m=d(844);class h extends m.Disposable{constructor(w){super(),this._action=w,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(w,j){if(j!==void 0&&this._syncCalls>j)return void(this._syncCalls=0);if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(w,j){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(j),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(j)}_innerWrite(w=0,j=!0){const C=w||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],y=this._action(v,j);if(y){const b=k=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(C,k);return void y.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(b)}const g=this._callbacks[this._bufferOffset];if(g&&g(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-C>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}l.WriteBuffer=h},5941:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const d=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,f=/^[\da-f]+$/;function m(h,x){const w=h.toString(16),j=w.length<2?"0"+w:w;switch(x){case 4:return w[0];case 8:return j;case 12:return(j+j).slice(0,3);default:return j+j}}l.parseColor=function(h){if(!h)return;let x=h.toLowerCase();if(x.indexOf("rgb:")===0){x=x.slice(4);const w=d.exec(x);if(w){const j=w[1]?15:w[4]?255:w[7]?4095:65535;return[Math.round(parseInt(w[1]||w[4]||w[7]||w[10],16)/j*255),Math.round(parseInt(w[2]||w[5]||w[8]||w[11],16)/j*255),Math.round(parseInt(w[3]||w[6]||w[9]||w[12],16)/j*255)]}}else if(x.indexOf("#")===0&&(x=x.slice(1),f.exec(x)&&[3,6,9,12].includes(x.length))){const w=x.length/3,j=[0,0,0];for(let C=0;C<3;++C){const v=parseInt(x.slice(w*C,w*C+w),16);j[C]=w===1?v<<4:w===2?v:w===3?v>>4:v>>8}return j}},l.toRgbString=function(h,x=16){const[w,j,C]=h;return`rgb:${m(w,x)}/${m(j,x)}/${m(C,x)}`}},5770:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const f=d(482),m=d(8742),h=d(5770),x=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=x,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=x}registerHandler(j,C){this._handlers[j]===void 0&&(this._handlers[j]=[]);const v=this._handlers[j];return v.push(C),{dispose:()=>{const y=v.indexOf(C);y!==-1&&v.splice(y,1)}}}clearHandler(j){this._handlers[j]&&delete this._handlers[j]}setHandlerFallback(j){this._handlerFb=j}reset(){if(this._active.length)for(let j=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;j>=0;--j)this._active[j].unhook(!1);this._stack.paused=!1,this._active=x,this._ident=0}hook(j,C){if(this.reset(),this._ident=j,this._active=this._handlers[j]||x,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(j,C,v){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(j,C,v);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(j,C,v))}unhook(j,C=!0){if(this._active.length){let v=!1,y=this._active.length-1,g=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,v=C,g=this._stack.fallThrough,this._stack.paused=!1),!g&&v===!1){for(;y>=0&&(v=this._active[y].unhook(j),v!==!0);y--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,v;y--}for(;y>=0;y--)if(v=this._active[y].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",j);this._active=x,this._ident=0}};const w=new m.Params;w.addParam(0),l.DcsHandler=class{constructor(j){this._handler=j,this._data="",this._params=w,this._hitLimit=!1}hook(j){this._params=j.length>1||j.params[0]?j.clone():w,this._data="",this._hitLimit=!1}put(j,C,v){this._hitLimit||(this._data+=(0,f.utf32ToString)(j,C,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(j){let C=!1;if(this._hitLimit)C=!1;else if(j&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((v=>(this._params=w,this._data="",this._hitLimit=!1,v)));return this._params=w,this._data="",this._hitLimit=!1,C}}},2015:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const f=d(844),m=d(8742),h=d(6242),x=d(6351);class w{constructor(y){this.table=new Uint8Array(y)}setDefault(y,g){this.table.fill(y<<4|g)}add(y,g,b,k){this.table[g<<8|y]=b<<4|k}addMany(y,g,b,k){for(let E=0;E<y.length;E++)this.table[g<<8|y[E]]=b<<4|k}}l.TransitionTable=w;const j=160;l.VT500_TRANSITION_TABLE=(function(){const v=new w(4095),y=Array.apply(null,Array(256)).map(((A,N)=>N)),g=(A,N)=>y.slice(A,N),b=g(32,127),k=g(0,24);k.push(25),k.push.apply(k,g(28,32));const E=g(0,14);let P;for(P in v.setDefault(1,0),v.addMany(b,0,2,0),E)v.addMany([24,26,153,154],P,3,0),v.addMany(g(128,144),P,3,0),v.addMany(g(144,152),P,3,0),v.add(156,P,0,0),v.add(27,P,11,1),v.add(157,P,4,8),v.addMany([152,158,159],P,0,7),v.add(155,P,11,3),v.add(144,P,11,9);return v.addMany(k,0,3,0),v.addMany(k,1,3,1),v.add(127,1,0,1),v.addMany(k,8,0,8),v.addMany(k,3,3,3),v.add(127,3,0,3),v.addMany(k,4,3,4),v.add(127,4,0,4),v.addMany(k,6,3,6),v.addMany(k,5,3,5),v.add(127,5,0,5),v.addMany(k,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(b,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(g(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(b,7,0,7),v.addMany(k,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(g(64,127),3,7,0),v.addMany(g(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(g(48,60),4,8,4),v.addMany(g(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(g(32,64),6,0,6),v.add(127,6,0,6),v.addMany(g(64,127),6,0,0),v.addMany(g(32,48),3,9,5),v.addMany(g(32,48),5,9,5),v.addMany(g(48,64),5,0,6),v.addMany(g(64,127),5,7,0),v.addMany(g(32,48),4,9,5),v.addMany(g(32,48),1,9,2),v.addMany(g(32,48),2,9,2),v.addMany(g(48,127),2,10,0),v.addMany(g(48,80),1,10,0),v.addMany(g(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(g(96,127),1,10,0),v.add(80,1,11,9),v.addMany(k,9,0,9),v.add(127,9,0,9),v.addMany(g(28,32),9,0,9),v.addMany(g(32,48),9,9,12),v.addMany(g(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(k,11,0,11),v.addMany(g(32,128),11,0,11),v.addMany(g(28,32),11,0,11),v.addMany(k,10,0,10),v.add(127,10,0,10),v.addMany(g(28,32),10,0,10),v.addMany(g(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(g(32,48),10,9,12),v.addMany(k,12,0,12),v.add(127,12,0,12),v.addMany(g(28,32),12,0,12),v.addMany(g(32,48),12,9,12),v.addMany(g(48,64),12,0,11),v.addMany(g(64,127),12,12,13),v.addMany(g(64,127),10,12,13),v.addMany(g(64,127),9,12,13),v.addMany(k,13,13,13),v.addMany(b,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(j,0,2,0),v.add(j,8,5,8),v.add(j,6,0,6),v.add(j,11,0,11),v.add(j,13,13,13),v})();class C extends f.Disposable{constructor(y=l.VT500_TRANSITION_TABLE){super(),this._transitions=y,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new m.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(g,b,k)=>{},this._executeHandlerFb=g=>{},this._csiHandlerFb=(g,b)=>{},this._escHandlerFb=g=>{},this._errorHandlerFb=g=>g,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new x.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(y,g=[64,126]){let b=0;if(y.prefix){if(y.prefix.length>1)throw new Error("only one byte as prefix supported");if(b=y.prefix.charCodeAt(0),b&&60>b||b>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(y.intermediates){if(y.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let E=0;E<y.intermediates.length;++E){const P=y.intermediates.charCodeAt(E);if(32>P||P>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");b<<=8,b|=P}}if(y.final.length!==1)throw new Error("final must be a single byte");const k=y.final.charCodeAt(0);if(g[0]>k||k>g[1])throw new Error(`final must be in range ${g[0]} .. ${g[1]}`);return b<<=8,b|=k,b}identToString(y){const g=[];for(;y;)g.push(String.fromCharCode(255&y)),y>>=8;return g.reverse().join("")}setPrintHandler(y){this._printHandler=y}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(y,g){const b=this._identifier(y,[48,126]);this._escHandlers[b]===void 0&&(this._escHandlers[b]=[]);const k=this._escHandlers[b];return k.push(g),{dispose:()=>{const E=k.indexOf(g);E!==-1&&k.splice(E,1)}}}clearEscHandler(y){this._escHandlers[this._identifier(y,[48,126])]&&delete this._escHandlers[this._identifier(y,[48,126])]}setEscHandlerFallback(y){this._escHandlerFb=y}setExecuteHandler(y,g){this._executeHandlers[y.charCodeAt(0)]=g}clearExecuteHandler(y){this._executeHandlers[y.charCodeAt(0)]&&delete this._executeHandlers[y.charCodeAt(0)]}setExecuteHandlerFallback(y){this._executeHandlerFb=y}registerCsiHandler(y,g){const b=this._identifier(y);this._csiHandlers[b]===void 0&&(this._csiHandlers[b]=[]);const k=this._csiHandlers[b];return k.push(g),{dispose:()=>{const E=k.indexOf(g);E!==-1&&k.splice(E,1)}}}clearCsiHandler(y){this._csiHandlers[this._identifier(y)]&&delete this._csiHandlers[this._identifier(y)]}setCsiHandlerFallback(y){this._csiHandlerFb=y}registerDcsHandler(y,g){return this._dcsParser.registerHandler(this._identifier(y),g)}clearDcsHandler(y){this._dcsParser.clearHandler(this._identifier(y))}setDcsHandlerFallback(y){this._dcsParser.setHandlerFallback(y)}registerOscHandler(y,g){return this._oscParser.registerHandler(y,g)}clearOscHandler(y){this._oscParser.clearHandler(y)}setOscHandlerFallback(y){this._oscParser.setHandlerFallback(y)}setErrorHandler(y){this._errorHandler=y}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(y,g,b,k,E){this._parseStack.state=y,this._parseStack.handlers=g,this._parseStack.handlerPos=b,this._parseStack.transition=k,this._parseStack.chunkPos=E}parse(y,g,b){let k,E=0,P=0,A=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,A=this._parseStack.chunkPos+1;else{if(b===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const N=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(b===!1&&M>-1){for(;M>=0&&(k=N[M](this._params),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 4:if(b===!1&&M>-1){for(;M>=0&&(k=N[M](),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 6:if(E=y[this._parseStack.chunkPos],k=this._dcsParser.unhook(E!==24&&E!==26,b),k)return k;E===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(E=y[this._parseStack.chunkPos],k=this._oscParser.end(E!==24&&E!==26,b),k)return k;E===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,A=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let N=A;N<g;++N){switch(E=y[N],P=this._transitions.table[this.currentState<<8|(E<160?E:j)],P>>4){case 2:for(let z=N+1;;++z){if(z>=g||(E=y[z])<32||E>126&&E<j){this._printHandler(y,N,z),N=z-1;break}if(++z>=g||(E=y[z])<32||E>126&&E<j){this._printHandler(y,N,z),N=z-1;break}if(++z>=g||(E=y[z])<32||E>126&&E<j){this._printHandler(y,N,z),N=z-1;break}if(++z>=g||(E=y[z])<32||E>126&&E<j){this._printHandler(y,N,z),N=z-1;break}}break;case 3:this._executeHandlers[E]?this._executeHandlers[E]():this._executeHandlerFb(E),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:N,code:E,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const M=this._csiHandlers[this._collect<<8|E];let I=M?M.length-1:-1;for(;I>=0&&(k=M[I](this._params),k!==!0);I--)if(k instanceof Promise)return this._preserveStack(3,M,I,P,N),k;I<0&&this._csiHandlerFb(this._collect<<8|E,this._params),this.precedingJoinState=0;break;case 8:do switch(E){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(E-48)}while(++N<g&&(E=y[N])>47&&E<60);N--;break;case 9:this._collect<<=8,this._collect|=E;break;case 10:const L=this._escHandlers[this._collect<<8|E];let B=L?L.length-1:-1;for(;B>=0&&(k=L[B](),k!==!0);B--)if(k instanceof Promise)return this._preserveStack(4,L,B,P,N),k;B<0&&this._escHandlerFb(this._collect<<8|E),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|E,this._params);break;case 13:for(let z=N+1;;++z)if(z>=g||(E=y[z])===24||E===26||E===27||E>127&&E<j){this._dcsParser.put(y,N,z),N=z-1;break}break;case 14:if(k=this._dcsParser.unhook(E!==24&&E!==26),k)return this._preserveStack(6,[],0,P,N),k;E===27&&(P|=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 z=N+1;;z++)if(z>=g||(E=y[z])<32||E>127&&E<j){this._oscParser.put(y,N,z),N=z-1;break}break;case 6:if(k=this._oscParser.end(E!==24&&E!==26),k)return this._preserveStack(5,[],0,P,N),k;E===27&&(P|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&P}}}l.EscapeSequenceParser=C},6242:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const f=d(5770),m=d(482),h=[];l.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(x,w){this._handlers[x]===void 0&&(this._handlers[x]=[]);const j=this._handlers[x];return j.push(w),{dispose:()=>{const C=j.indexOf(w);C!==-1&&j.splice(C,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].start();else this._handlerFb(this._id,"START")}_put(x,w,j){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(x,w,j);else this._handlerFb(this._id,"PUT",(0,m.utf32ToString)(x,w,j))}start(){this.reset(),this._state=1}put(x,w,j){if(this._state!==3){if(this._state===1)for(;w<j;){const C=x[w++];if(C===59){this._state=2,this._start();break}if(C<48||57<C)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+C-48}this._state===2&&j-w>0&&this._put(x,w,j)}}end(x,w=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let j=!1,C=this._active.length-1,v=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,j=w,v=this._stack.fallThrough,this._stack.paused=!1),!v&&j===!1){for(;C>=0&&(j=this._active[C].end(x),j!==!0);C--)if(j instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,j;C--}for(;C>=0;C--)if(j=this._active[C].end(!1),j instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,j}else this._handlerFb(this._id,"END",x);this._active=h,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(x){this._handler=x,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(x,w,j){this._hitLimit||(this._data+=(0,m.utf32ToString)(x,w,j),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(x){let w=!1;if(this._hitLimit)w=!1;else if(x&&(w=this._handler(this._data),w instanceof Promise))return w.then((j=>(this._data="",this._hitLimit=!1,j)));return this._data="",this._hitLimit=!1,w}}},8742:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const d=2147483647;class f{static fromArray(h){const x=new f;if(!h.length)return x;for(let w=Array.isArray(h[0])?1:0;w<h.length;++w){const j=h[w];if(Array.isArray(j))for(let C=0;C<j.length;++C)x.addSubParam(j[C]);else x.addParam(j)}return x}constructor(h=32,x=32){if(this.maxLength=h,this.maxSubParamsLength=x,x>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(x),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new f(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let x=0;x<this.length;++x){h.push(this.params[x]);const w=this._subParamsIdx[x]>>8,j=255&this._subParamsIdx[x];j-w>0&&h.push(Array.prototype.slice.call(this._subParams,w,j))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>d?d:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>d?d:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const x=this._subParamsIdx[h]>>8,w=255&this._subParamsIdx[h];return w-x>0?this._subParams.subarray(x,w):null}getSubParamsAll(){const h={};for(let x=0;x<this.length;++x){const w=this._subParamsIdx[x]>>8,j=255&this._subParamsIdx[x];j-w>0&&(h[x]=this._subParams.slice(w,j))}return h}addDigit(h){let x;if(this._rejectDigits||!(x=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const w=this._digitIsSub?this._subParams:this.params,j=w[x-1];w[x-1]=~j?Math.min(10*j+h,d):h}}l.Params=f},5741:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,f){const m={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(m),f.dispose=()=>this._wrappedAddonDispose(m),f.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let f=-1;for(let m=0;m<this._addons.length;m++)if(this._addons[m]===d){f=m;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(f,1)}}},8771:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const f=d(3785),m=d(511);l.BufferApiView=class{constructor(h,x){this._buffer=h,this.type=x}init(h){return this._buffer=h,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(h){const x=this._buffer.lines.get(h);if(x)return new f.BufferLineApiView(x)}getNullCell(){return new m.CellData}}},3785:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const f=d(511);l.BufferLineApiView=class{constructor(m){this._line=m}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(m,h){if(!(m<0||m>=this._line.length))return h?(this._line.loadCell(m,h),h):this._line.loadCell(m,new f.CellData)}translateToString(m,h,x){return this._line.translateToString(m,h,x)}}},8285:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const f=d(8771),m=d(8460),h=d(844);class x extends h.Disposable{constructor(j){super(),this._core=j,this._onBufferChange=this.register(new m.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}l.BufferNamespaceApi=x},7975:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,f){return this._core.registerCsiHandler(d,(m=>f(m.toArray())))}addCsiHandler(d,f){return this.registerCsiHandler(d,f)}registerDcsHandler(d,f){return this._core.registerDcsHandler(d,((m,h)=>f(m,h.toArray())))}addDcsHandler(d,f){return this.registerDcsHandler(d,f)}registerEscHandler(d,f){return this._core.registerEscHandler(d,f)}addEscHandler(d,f){return this.registerEscHandler(d,f)}registerOscHandler(d,f){return this._core.registerOscHandler(d,f)}addOscHandler(d,f){return this.registerOscHandler(d,f)}}},7090:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(d){this._core=d}register(d){this._core.unicodeService.register(d)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(d){this._core.unicodeService.activeVersion=d}}},744:function(u,l,d){var f=this&&this.__decorate||function(v,y,g,b){var k,E=arguments.length,P=E<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,g):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(v,y,g,b);else for(var A=v.length-1;A>=0;A--)(k=v[A])&&(P=(E<3?k(P):E>3?k(y,g,P):k(y,g))||P);return E>3&&P&&Object.defineProperty(y,g,P),P},m=this&&this.__param||function(v,y){return function(g,b){y(g,b,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const h=d(8460),x=d(844),w=d(5295),j=d(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let C=l.BufferService=class extends x.Disposable{get buffer(){return this.buffers.active}constructor(v){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(v.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new w.BufferSet(v,this))}resize(v,y){this.cols=v,this.rows=y,this.buffers.resize(v,y),this._onResize.fire({cols:v,rows:y})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,y=!1){const g=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===v.fg&&b.getBg(0)===v.bg||(b=g.getBlankLine(v,y),this._cachedBlankLine=b),b.isWrapped=y;const k=g.ybase+g.scrollTop,E=g.ybase+g.scrollBottom;if(g.scrollTop===0){const P=g.lines.isFull;E===g.lines.length-1?P?g.lines.recycle().copyFrom(b):g.lines.push(b.clone()):g.lines.splice(E+1,0,b.clone()),P?this.isUserScrolling&&(g.ydisp=Math.max(g.ydisp-1,0)):(g.ybase++,this.isUserScrolling||g.ydisp++)}else{const P=E-k+1;g.lines.shiftElements(k+1,P-1,-1),g.lines.set(E,b.clone())}this.isUserScrolling||(g.ydisp=g.ybase),this._onScroll.fire(g.ydisp)}scrollLines(v,y,g){const b=this.buffer;if(v<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else v+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const k=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+v,b.ybase),0),k!==b.ydisp&&(y||this._onScroll.fire(b.ydisp))}};l.BufferService=C=f([m(0,j.IOptionsService)],C)},7994:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,f){this._charsets[d]=f,this.glevel===d&&(this.charset=f)}}},1753:function(u,l,d){var f=this&&this.__decorate||function(b,k,E,P){var A,N=arguments.length,M=N<3?k:P===null?P=Object.getOwnPropertyDescriptor(k,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(b,k,E,P);else for(var I=b.length-1;I>=0;I--)(A=b[I])&&(M=(N<3?A(M):N>3?A(k,E,M):A(k,E))||M);return N>3&&M&&Object.defineProperty(k,E,M),M},m=this&&this.__param||function(b,k){return function(E,P){k(E,P,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const h=d(2585),x=d(8460),w=d(844),j={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:b=>b.button!==4&&b.action===1&&(b.ctrl=!1,b.alt=!1,b.shift=!1,!0)},VT200:{events:19,restrict:b=>b.action!==32},DRAG:{events:23,restrict:b=>b.action!==32||b.button!==3},ANY:{events:31,restrict:b=>!0}};function C(b,k){let E=(b.ctrl?16:0)|(b.shift?4:0)|(b.alt?8:0);return b.button===4?(E|=64,E|=b.action):(E|=3&b.button,4&b.button&&(E|=64),8&b.button&&(E|=128),b.action===32?E|=32:b.action!==0||k||(E|=3)),E}const v=String.fromCharCode,y={DEFAULT:b=>{const k=[C(b,!1)+32,b.col+32,b.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${v(k[0])}${v(k[1])}${v(k[2])}`},SGR:b=>{const k=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${C(b,!0)};${b.col};${b.row}${k}`},SGR_PIXELS:b=>{const k=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${C(b,!0)};${b.x};${b.y}${k}`}};let g=l.CoreMouseService=class extends w.Disposable{constructor(b,k){super(),this._bufferService=b,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new x.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const E of Object.keys(j))this.addProtocol(E,j[E]);for(const E of Object.keys(y))this.addEncoding(E,y[E]);this.reset()}addProtocol(b,k){this._protocols[b]=k}addEncoding(b,k){this._encodings[b]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(b){if(!this._protocols[b])throw new Error(`unknown protocol "${b}"`);this._activeProtocol=b,this._onProtocolChange.fire(this._protocols[b].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(b){if(!this._encodings[b])throw new Error(`unknown encoding "${b}"`);this._activeEncoding=b}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(b){if(b.col<0||b.col>=this._bufferService.cols||b.row<0||b.row>=this._bufferService.rows||b.button===4&&b.action===32||b.button===3&&b.action!==32||b.button!==4&&(b.action===2||b.action===3)||(b.col++,b.row++,b.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,b,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(b))return!1;const k=this._encodings[this._activeEncoding](b);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=b,!0}explainEvents(b){return{down:!!(1&b),up:!!(2&b),drag:!!(4&b),move:!!(8&b),wheel:!!(16&b)}}_equalEvents(b,k,E){if(E){if(b.x!==k.x||b.y!==k.y)return!1}else if(b.col!==k.col||b.row!==k.row)return!1;return b.button===k.button&&b.action===k.action&&b.ctrl===k.ctrl&&b.alt===k.alt&&b.shift===k.shift}};l.CoreMouseService=g=f([m(0,h.IBufferService),m(1,h.ICoreService)],g)},6975:function(u,l,d){var f=this&&this.__decorate||function(g,b,k,E){var P,A=arguments.length,N=A<3?b:E===null?E=Object.getOwnPropertyDescriptor(b,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(g,b,k,E);else for(var M=g.length-1;M>=0;M--)(P=g[M])&&(N=(A<3?P(N):A>3?P(b,k,N):P(b,k))||N);return A>3&&N&&Object.defineProperty(b,k,N),N},m=this&&this.__param||function(g,b){return function(k,E){b(k,E,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const h=d(1439),x=d(8460),w=d(844),j=d(2585),C=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let y=l.CoreService=class extends w.Disposable{constructor(g,b,k){super(),this._bufferService=g,this._logService=b,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new x.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new x.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new x.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new x.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(C),this.decPrivateModes=(0,h.clone)(v)}reset(){this.modes=(0,h.clone)(C),this.decPrivateModes=(0,h.clone)(v)}triggerDataEvent(g,b=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;b&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),b&&this._onUserInput.fire(),this._logService.debug(`sending data "${g}"`,(()=>g.split("").map((E=>E.charCodeAt(0))))),this._onData.fire(g)}triggerBinaryEvent(g){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${g}"`,(()=>g.split("").map((b=>b.charCodeAt(0))))),this._onBinary.fire(g))}};l.CoreService=y=f([m(0,j.IBufferService),m(1,j.ILogService),m(2,j.IOptionsService)],y)},9074:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const f=d(8055),m=d(8460),h=d(844),x=d(6106);let w=0,j=0;class C extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new x.SortedList((g=>g==null?void 0:g.marker.line)),this._onDecorationRegistered=this.register(new m.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new m.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(g){if(g.marker.isDisposed)return;const b=new v(g);if(b){const k=b.marker.onDispose((()=>b.dispose()));b.onDispose((()=>{b&&(this._decorations.delete(b)&&this._onDecorationRemoved.fire(b),k.dispose())})),this._decorations.insert(b),this._onDecorationRegistered.fire(b)}return b}reset(){for(const g of this._decorations.values())g.dispose();this._decorations.clear()}*getDecorationsAtCell(g,b,k){let E=0,P=0;for(const A of this._decorations.getKeyIterator(b))E=A.options.x??0,P=E+(A.options.width??1),g>=E&&g<P&&(!k||(A.options.layer??"bottom")===k)&&(yield A)}forEachDecorationAtCell(g,b,k,E){this._decorations.forEachByKey(b,(P=>{w=P.options.x??0,j=w+(P.options.width??1),g>=w&&g<j&&(!k||(P.options.layer??"bottom")===k)&&E(P)}))}}l.DecorationService=C;class v extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(g){super(),this.options=g,this.onRenderEmitter=this.register(new m.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new m.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=g.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const f=d(2585),m=d(8343);class h{constructor(...w){this._entries=new Map;for(const[j,C]of w)this.set(j,C)}set(w,j){const C=this._entries.get(w);return this._entries.set(w,j),C}forEach(w){for(const[j,C]of this._entries.entries())w(j,C)}has(w){return this._entries.has(w)}get(w){return this._entries.get(w)}}l.ServiceCollection=h,l.InstantiationService=class{constructor(){this._services=new h,this._services.set(f.IInstantiationService,this)}setService(x,w){this._services.set(x,w)}getService(x){return this._services.get(x)}createInstance(x,...w){const j=(0,m.getServiceDependencies)(x).sort(((y,g)=>y.index-g.index)),C=[];for(const y of j){const g=this._services.get(y.id);if(!g)throw new Error(`[createInstance] ${x.name} depends on UNKNOWN service ${y.id}.`);C.push(g)}const v=j.length>0?j[0].index:w.length;if(w.length!==v)throw new Error(`[createInstance] First service dependency of ${x.name} at position ${v+1} conflicts with ${w.length} static arguments`);return new x(...w,...C)}}},7866:function(u,l,d){var f=this&&this.__decorate||function(v,y,g,b){var k,E=arguments.length,P=E<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,g):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(v,y,g,b);else for(var A=v.length-1;A>=0;A--)(k=v[A])&&(P=(E<3?k(P):E>3?k(y,g,P):k(y,g))||P);return E>3&&P&&Object.defineProperty(y,g,P),P},m=this&&this.__param||function(v,y){return function(g,b){y(g,b,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const h=d(844),x=d(2585),w={trace:x.LogLevelEnum.TRACE,debug:x.LogLevelEnum.DEBUG,info:x.LogLevelEnum.INFO,warn:x.LogLevelEnum.WARN,error:x.LogLevelEnum.ERROR,off:x.LogLevelEnum.OFF};let j,C=l.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=x.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),j=this}_updateLogLevel(){this._logLevel=w[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let y=0;y<v.length;y++)typeof v[y]=="function"&&(v[y]=v[y]())}_log(v,y,g){this._evalLazyOptionalParams(g),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+y,...g)}trace(v,...y){var g;this._logLevel<=x.LogLevelEnum.TRACE&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.trace.bind(this._optionsService.options.logger))??console.log,v,y)}debug(v,...y){var g;this._logLevel<=x.LogLevelEnum.DEBUG&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.debug.bind(this._optionsService.options.logger))??console.log,v,y)}info(v,...y){var g;this._logLevel<=x.LogLevelEnum.INFO&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.info.bind(this._optionsService.options.logger))??console.info,v,y)}warn(v,...y){var g;this._logLevel<=x.LogLevelEnum.WARN&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.warn.bind(this._optionsService.options.logger))??console.warn,v,y)}error(v,...y){var g;this._logLevel<=x.LogLevelEnum.ERROR&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.error.bind(this._optionsService.options.logger))??console.error,v,y)}};l.LogService=C=f([m(0,x.IOptionsService)],C),l.setTraceLogger=function(v){j=v},l.traceCall=function(v,y,g){if(typeof g.value!="function")throw new Error("not supported");const b=g.value;g.value=function(...k){if(j.logLevel!==x.LogLevelEnum.TRACE)return b.apply(this,k);j.trace(`GlyphRenderer#${b.name}(${k.map((P=>JSON.stringify(P))).join(", ")})`);const E=b.apply(this,k);return j.trace(`GlyphRenderer#${b.name} return`,E),E}}},7302:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const f=d(8460),m=d(844),h=d(6114);l.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const x=["normal","bold","100","200","300","400","500","600","700","800","900"];class w extends m.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...l.DEFAULT_OPTIONS};for(const y in C)if(y in v)try{const g=C[y];v[y]=this._sanitizeAndValidateOption(y,g)}catch(g){console.error(g)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,m.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,v){return this.onOptionChange((y=>{y===C&&v(this.rawOptions[C])}))}onMultipleOptionChange(C,v){return this.onOptionChange((y=>{C.indexOf(y)!==-1&&v()}))}_setupOptions(){const C=y=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);return this.rawOptions[y]},v=(y,g)=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);g=this._sanitizeAndValidateOption(y,g),this.rawOptions[y]!==g&&(this.rawOptions[y]=g,this._onOptionChange.fire(y))};for(const y in this.rawOptions){const g={get:C.bind(this,y),set:v.bind(this,y)};Object.defineProperty(this.options,y,g)}}_sanitizeAndValidateOption(C,v){switch(C){case"cursorStyle":if(v||(v=l.DEFAULT_OPTIONS[C]),!(function(y){return y==="block"||y==="underline"||y==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${C}`);break;case"wordSeparator":v||(v=l.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=x.includes(v)?v:l.DEFAULT_OPTIONS[C];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${C} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${C} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}l.OptionsService=w},2660:function(u,l,d){var f=this&&this.__decorate||function(w,j,C,v){var y,g=arguments.length,b=g<3?j:v===null?v=Object.getOwnPropertyDescriptor(j,C):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(w,j,C,v);else for(var k=w.length-1;k>=0;k--)(y=w[k])&&(b=(g<3?y(b):g>3?y(j,C,b):y(j,C))||b);return g>3&&b&&Object.defineProperty(j,C,b),b},m=this&&this.__param||function(w,j){return function(C,v){j(C,v,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const h=d(2585);let x=l.OscLinkService=class{constructor(w){this._bufferService=w,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(w){const j=this._bufferService.buffer;if(w.id===void 0){const k=j.addMarker(j.ybase+j.y),E={data:w,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(E,k))),this._dataByLinkId.set(E.id,E),E.id}const C=w,v=this._getEntryIdKey(C),y=this._entriesWithId.get(v);if(y)return this.addLineToLink(y.id,j.ybase+j.y),y.id;const g=j.addMarker(j.ybase+j.y),b={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(b,g))),this._entriesWithId.set(b.key,b),this._dataByLinkId.set(b.id,b),b.id}addLineToLink(w,j){const C=this._dataByLinkId.get(w);if(C&&C.lines.every((v=>v.line!==j))){const v=this._bufferService.buffer.addMarker(j);C.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(C,v)))}}getLinkData(w){var j;return(j=this._dataByLinkId.get(w))==null?void 0:j.data}_getEntryIdKey(w){return`${w.id};;${w.uri}`}_removeMarkerFromLink(w,j){const C=w.lines.indexOf(j);C!==-1&&(w.lines.splice(C,1),w.lines.length===0&&(w.data.id!==void 0&&this._entriesWithId.delete(w.key),this._dataByLinkId.delete(w.id)))}};l.OscLinkService=x=f([m(0,h.IBufferService)],x)},8343:(u,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const d="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(m){return m[f]||[]},l.createDecorator=function(m){if(l.serviceRegistry.has(m))return l.serviceRegistry.get(m);const h=function(x,w,j){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,v,y){v[d]===v?v[f].push({id:C,index:y}):(v[f]=[{id:C,index:y}],v[d]=v)})(h,x,j)};return h.toString=()=>m,l.serviceRegistry.set(m,h),h}},2585:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=d(8343);var m;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(m||(l.LogLevelEnum=m={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(u,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=d(8460),m=d(225);class h{static extractShouldJoin(w){return(1&w)!=0}static extractWidth(w){return w>>1&3}static extractCharKind(w){return w>>3}static createPropertyValue(w,j,C=!1){return(16777215&w)<<3|(3&j)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const w=new m.UnicodeV6;this.register(w),this._active=w.version,this._activeProvider=w}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(w){if(!this._providers[w])throw new Error(`unknown Unicode version "${w}"`);this._active=w,this._activeProvider=this._providers[w],this._onChange.fire(w)}register(w){this._providers[w.version]=w}wcwidth(w){return this._activeProvider.wcwidth(w)}getStringCellWidth(w){let j=0,C=0;const v=w.length;for(let y=0;y<v;++y){let g=w.charCodeAt(y);if(55296<=g&&g<=56319){if(++y>=v)return j+this.wcwidth(g);const E=w.charCodeAt(y);56320<=E&&E<=57343?g=1024*(g-55296)+E-56320+65536:j+=this.wcwidth(E)}const b=this.charProperties(g,C);let k=h.extractWidth(b);h.extractShouldJoin(b)&&(k-=h.extractWidth(C)),j+=k,C=b}return j}charProperties(w,j){return this._activeProvider.charProperties(w,j)}}l.UnicodeService=h}},n={};function o(u){var l=n[u];if(l!==void 0)return l.exports;var d=n[u]={exports:{}};return s[u].call(d.exports,d,d.exports,o),d.exports}var c={};return(()=>{var u=c;Object.defineProperty(u,"__esModule",{value:!0}),u.Terminal=void 0;const l=o(9042),d=o(3236),f=o(844),m=o(5741),h=o(8285),x=o(7975),w=o(7090),j=["cols","rows"];class C extends f.Disposable{constructor(y){super(),this._core=this.register(new d.Terminal(y)),this._addonManager=this.register(new m.AddonManager),this._publicOptions={...this._core.options};const g=k=>this._core.options[k],b=(k,E)=>{this._checkReadonlyOptions(k),this._core.options[k]=E};for(const k in this._core.options){const E={get:g.bind(this,k),set:b.bind(this,k)};Object.defineProperty(this._publicOptions,k,E)}}_checkReadonlyOptions(y){if(j.includes(y))throw new Error(`Option "${y}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new x.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new w.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const y=this._core.coreService.decPrivateModes;let g="none";switch(this._core.coreMouseService.activeProtocol){case"X10":g="x10";break;case"VT200":g="vt200";break;case"DRAG":g="drag";break;case"ANY":g="any"}return{applicationCursorKeysMode:y.applicationCursorKeys,applicationKeypadMode:y.applicationKeypad,bracketedPasteMode:y.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:g,originMode:y.origin,reverseWraparoundMode:y.reverseWraparound,sendFocusMode:y.sendFocus,wraparoundMode:y.wraparound}}get options(){return this._publicOptions}set options(y){for(const g in y)this._publicOptions[g]=y[g]}blur(){this._core.blur()}focus(){this._core.focus()}input(y,g=!0){this._core.input(y,g)}resize(y,g){this._verifyIntegers(y,g),this._core.resize(y,g)}open(y){this._core.open(y)}attachCustomKeyEventHandler(y){this._core.attachCustomKeyEventHandler(y)}attachCustomWheelEventHandler(y){this._core.attachCustomWheelEventHandler(y)}registerLinkProvider(y){return this._core.registerLinkProvider(y)}registerCharacterJoiner(y){return this._checkProposedApi(),this._core.registerCharacterJoiner(y)}deregisterCharacterJoiner(y){this._checkProposedApi(),this._core.deregisterCharacterJoiner(y)}registerMarker(y=0){return this._verifyIntegers(y),this._core.registerMarker(y)}registerDecoration(y){return this._checkProposedApi(),this._verifyPositiveIntegers(y.x??0,y.width??0,y.height??0),this._core.registerDecoration(y)}hasSelection(){return this._core.hasSelection()}select(y,g,b){this._verifyIntegers(y,g,b),this._core.select(y,g,b)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(y,g){this._verifyIntegers(y,g),this._core.selectLines(y,g)}dispose(){super.dispose()}scrollLines(y){this._verifyIntegers(y),this._core.scrollLines(y)}scrollPages(y){this._verifyIntegers(y),this._core.scrollPages(y)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(y){this._verifyIntegers(y),this._core.scrollToLine(y)}clear(){this._core.clear()}write(y,g){this._core.write(y,g)}writeln(y,g){this._core.write(y),this._core.write(`\r
@@ -617,14 +617,14 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
617
617
  "command": "npx",
618
618
  "args": ["-y", "@example/mcp-server"]
619
619
  }
620
- }`}),children:[r.jsx(Tt,{className:"w-4 h-4 mr-1"}),"Add MCP"]}),d==="json"&&r.jsxs(re,{size:"sm",onClick:k,disabled:x,children:[r.jsx(Ms,{className:"w-4 h-4 mr-1"}),"Apply JSON"]})]})]}),r.jsxs("div",{className:"mx-3 mt-3 p-3 rounded-lg bg-orange-50 dark:bg-orange-950/30 border border-orange-200 dark:border-orange-800 flex items-center gap-2",children:[r.jsx(Ts,{className:"w-4 h-4 text-orange-600 shrink-0"}),r.jsxs("span",{className:"text-sm text-orange-800 dark:text-orange-200",children:["Global MCPs are available in ",r.jsx("strong",{children:"all projects"}),". They're stored in ",r.jsx("code",{className:"bg-orange-100 dark:bg-orange-900 px-1 rounded",children:"~/.claude.json"}),"."]})]}),r.jsx(Ys,{className:"flex-1",children:d==="rich"?r.jsx(ir,{children:r.jsxs("div",{className:"p-4 space-y-2",children:[P.map(([A,N])=>{var M;return r.jsxs("div",{className:"p-2 rounded border bg-white dark:bg-slate-950 group",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vs,{className:"w-4 h-4 text-green-500"}),r.jsx("span",{className:"text-sm font-medium",children:A})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tt,{variant:"outline",className:"text-xs",children:"custom"}),r.jsx(re,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>g(A),children:r.jsx(ys,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 font-mono",children:[N.command," ",(M=N.args)==null?void 0:M.join(" ")]})]},`custom-${A}`)}),E.map(A=>{var I;const N=!!u[A],M=n.mcpServers[A];return r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs("div",{className:`flex items-center justify-between p-2 rounded border ${N?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-800":"bg-gray-50 dark:bg-slate-900 border-gray-200 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vs,{className:`w-4 h-4 ${N?"text-green-500":"text-gray-400"}`}),r.jsx("span",{className:`text-sm ${N?"font-medium":"text-gray-500 dark:text-slate-400"}`,children:A}),M.description&&r.jsxs("span",{className:"text-xs text-gray-400 dark:text-slate-500 hidden sm:inline",children:["— ",M.description]})]}),r.jsx(vt,{checked:N,onCheckedChange:()=>y(A),className:N?"data-[state=checked]:bg-green-500":""})]})}),r.jsxs(Dt,{children:[r.jsxs("p",{className:"font-mono text-xs",children:[M.command," ",(I=M.args)==null?void 0:I.join(" ")]}),M.description&&r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:M.description})]})]},`registry-${A}`)}),E.length===0&&P.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No MCPs configured. Use the registry toggle or add a custom MCP."})]})}):r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Edit the mcpServers section (other ~/.claude.json settings are preserved)"}),r.jsx(_t,{value:m,onChange:A=>h(A.target.value),className:"font-mono text-sm h-[400px]",placeholder:"{}"})]})}),r.jsx(yt,{open:j.open,onOpenChange:A=>C({...j,open:A}),children:r.jsxs(ht,{children:[r.jsxs(ft,{children:[r.jsx(mt,{children:"Add Custom MCP"}),r.jsx(tr,{children:'Enter the MCP configuration as JSON with "name" and "config" fields.'})]}),r.jsx(_t,{value:j.json,onChange:A=>C({...j,json:A.target.value}),className:"font-mono text-sm h-48"}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>C({open:!1,json:""}),children:"Cancel"}),r.jsx(re,{onClick:b,children:"Add MCP"})]})]})})]})}function x8({open:e,onClose:t,item:s,intermediatePaths:n,onMove:o}){const[c,u]=_.useState("copy"),[l,d]=_.useState(null),[f,m]=_.useState(""),[h,x]=_.useState(!1),w=()=>{const j=f.trim()||l;if(!j){K.error("Please select or enter a target path");return}o(s.path,j,c,h)};return r.jsx(yt,{open:e,onOpenChange:t,children:r.jsxs(ht,{className:"max-w-md",children:[r.jsxs(ft,{children:[r.jsxs(mt,{children:[c==="copy"?"Copy":"Move"," ",s==null?void 0:s.name]}),r.jsx(tr,{children:"Select a destination for this file"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(re,{variant:c==="copy"?"default":"outline",size:"sm",onClick:()=>u("copy"),children:[r.jsx(Wa,{className:"w-4 h-4 mr-1"})," Copy"]}),r.jsxs(re,{variant:c==="move"?"default":"outline",size:"sm",onClick:()=>u("move"),children:[r.jsx(iS,{className:"w-4 h-4 mr-1"})," Move"]})]}),r.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:n==null?void 0:n.map(j=>r.jsxs("div",{className:Ee("flex items-center justify-between p-2 rounded border cursor-pointer",l===j.dir?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"hover:bg-gray-50 dark:hover:bg-slate-800"),onClick:()=>{d(j.dir),m("")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[j.isHome?r.jsx(Mg,{className:"w-4 h-4"}):r.jsx(Kr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm",children:j.label})]}),j.hasClaudeFolder?r.jsx(tt,{variant:"secondary",className:"text-xs",children:"exists"}):r.jsx(tt,{variant:"outline",className:"text-xs",children:"create"})]},j.dir))}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Or enter custom path:"}),r.jsx(lt,{className:"mt-1 font-mono text-sm",placeholder:"/path/to/directory",value:f,onChange:j=>{m(j.target.value),d(null)}})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vt,{checked:h,onCheckedChange:x}),r.jsx("span",{className:"text-sm",children:"Merge if target exists"})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(re,{onClick:w,children:c==="copy"?"Copy":"Move"})]})]})})}function v8({open:e,onClose:t,item:s,onRename:n}){const[o,c]=_.useState("");_.useEffect(()=>{s!=null&&s.name&&c(s.name.replace(/\.md$/,""))},[s,e]);const u=()=>{if(!o.trim()){K.error("Please enter a name");return}n(s,o.trim())};return r.jsx(yt,{open:e,onOpenChange:t,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsxs(mt,{children:["Rename ",s==null?void 0:s.type]})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"New name"}),r.jsx(lt,{className:"mt-1",placeholder:"new-name",value:o,onChange:l=>c(l.target.value),onKeyDown:l=>l.key==="Enter"&&u()}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:".md extension will be added automatically"})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(re,{onClick:u,children:"Rename"})]})]})})}function y8({open:e,onClose:t,dir:s,type:n,onCreate:o}){const[c,u]=_.useState("");_.useEffect(()=>{u("")},[e]);const l=()=>{if((n==="command"||n==="rule"||n==="workflow"||n==="memory")&&!c.trim()){K.error("Please enter a name");return}const m=n==="command"||n==="rule"||n==="workflow"||n==="memory"?c.endsWith(".md")?c:`${c}.md`:c;o(s,m,n)},d=vc[n]||{},f=n==="command"||n==="rule"||n==="workflow"||n==="memory";return r.jsx(yt,{open:e,onOpenChange:t,children:r.jsxs(ht,{className:"max-w-sm",children:[r.jsx(ft,{children:r.jsxs(mt,{children:["Create ",d.label||n]})}),f&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name"}),r.jsx(lt,{className:"mt-1",placeholder:n==="command"?"my-skill.md":n==="workflow"?"my-workflow.md":n==="memory"?"context.md":"my-rule.md",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>m.key==="Enter"&&l()})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(re,{onClick:l,children:"Create"})]})]})})}function b8({project:e,onRefresh:t}){var Be,Ke,Qe;const[s,n]=_.useState([]),[o,c]=_.useState([]),[u,l]=_.useState(null),[d,f]=_.useState(null),[m,h]=_.useState(null),[x,w]=_.useState(()=>{try{return localStorage.getItem("claude-config-expanded-folder")||null}catch{return null}}),[j,C]=_.useState({}),[v,y]=_.useState(!0),[g,b]=_.useState({open:!1,item:null}),[k,E]=_.useState({open:!1,dir:null,type:null}),[P,A]=_.useState({open:!1,item:null}),[N,M]=_.useState(!1),[I,L]=_.useState({open:!1,projectDir:null}),[B,z]=_.useState({open:!1,dir:null,name:null}),[Y,H]=_.useState({open:!1,dir:null}),[U,X]=_.useState({x:0,y:0,item:null}),[q,O]=_.useState(["claude"]),R=_.useCallback(async()=>{var je;try{y(!0);const[we,ve,_e,Oe]=await Promise.all([ue.getClaudeFolders(),ue.getIntermediatePaths(),ue.getRegistry(),ue.getConfig()]);if(n(we),c(ve),l(_e),O(((je=Oe.config)==null?void 0:je.enabledTools)||["claude"]),we.length>0){const de=localStorage.getItem("claude-config-expanded-folder");if(!de||!we.find(ye=>ye.dir===de)){const ye=we.filter(Je=>!Je.isSubproject),De=ye.length>1?ye[ye.length-1]:ye[0],ze=(De==null?void 0:De.dir)||we[0].dir;w(ze);try{localStorage.setItem("claude-config-expanded-folder",ze)}catch{}}}}catch(we){K.error("Failed to load data: "+we.message)}finally{y(!1)}},[]);_.useEffect(()=>{R(),f(null),h(null)},[R,e==null?void 0:e.dir]);const $=je=>{const we=x===je?null:je;w(we);try{we?localStorage.setItem("claude-config-expanded-folder",we):localStorage.removeItem("claude-config-expanded-folder")}catch{}},G=async je=>{f(je);try{const we=await ue.getClaudeFile(je.path);h(we)}catch(we){K.error("Failed to load file: "+we.message)}},F=async je=>{if(d)try{await ue.saveClaudeFile(d.path,je),K.success("Saved");const we=await ue.getClaudeFile(d.path);h(we),R()}catch(we){K.error("Failed to save: "+we.message)}},te=je=>{C(we=>({...we,[je]:!we[je]}))},ce=(je,we)=>{je.preventDefault(),X({x:je.clientX,y:je.clientY,item:we})},fe=async(je,we)=>{we==="command"||we==="rule"||we==="workflow"||we==="memory"?E({open:!0,dir:je,type:we}):we==="claudemd"?H({open:!0,dir:je}):J(je,we==="mcps"?"mcps.json":we==="settings"?"settings.json":we==="env"?".env":"CLAUDE.md",we)},J=async(je,we,ve)=>{try{const _e=await ue.createClaudeFile(je,we,ve);if(K.success("Created"),E({open:!1,dir:null,type:null}),await R(),_e.path){const Oe={path:_e.path,name:we,type:["command","rule","workflow","env","mcps","settings","claudemd","memory"].includes(ve)?ve:"file"};f(Oe),h({content:_e.content||"",parsed:null})}}catch(_e){K.error("Failed to create: "+_e.message)}},W=async(je,we)=>{try{const ve=await ue.renameClaudeFile(je.path,we);ve.success?(K.success("Renamed"),A({open:!1,item:null}),await R(),f({...je,path:ve.newPath,name:we.endsWith(".md")?we:`${we}.md`})):K.error(ve.error||"Failed to rename")}catch(ve){K.error("Failed to rename: "+ve.message)}},ae=async je=>{if(confirm(`Delete ${je.name}?`))try{await ue.deleteClaudeFile(je.path),K.success("Deleted"),(d==null?void 0:d.path)===je.path&&(f(null),h(null)),R()}catch(we){K.error("Failed to delete: "+we.message)}},ne=async(je,we,ve,_e)=>{try{await ue.moveClaudeItem(je,we,ve,_e),K.success(ve==="copy"?"Copied":"Moved"),b({open:!1,item:null}),R()}catch(Oe){K.error("Failed: "+Oe.message)}},Z=async je=>{if(je)try{const we=await ue.addManualSubproject(I.projectDir,je);we.success?(K.success(`Added sub-project: ${je.split("/").pop()}`),L({open:!1,projectDir:null}),R()):K.error(we.error||"Failed to add sub-project")}catch(we){K.error("Failed to add sub-project: "+we.message)}},le=async je=>{const we=s.find(ve=>!ve.isSubproject&&!ve.isHome);if(we)try{const ve=await ue.removeManualSubproject(we.dir,je);ve.success?(K.success("Removed sub-project"),R()):K.error(ve.error||"Failed to remove sub-project")}catch(ve){K.error("Failed to remove sub-project: "+ve.message)}},Ce=async je=>{const we=s.find(ve=>!ve.isSubproject&&!ve.isHome);if(we)try{const ve=await ue.hideSubproject(we.dir,je);ve.success?(K.success("Sub-project hidden"),R()):K.error(ve.error||"Failed to hide sub-project")}catch(ve){K.error("Failed to hide sub-project: "+ve.message)}},Le=()=>{if(!d||!m)return r.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-slate-400",children:r.jsxs("div",{className:"text-center",children:[r.jsx(gp,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"Select a file to edit"})]})});const je=d.path?d.path.replace(/\/.claude\/mcps\.json$/,""):null;switch(d.type){case"global-mcps":return r.jsx(g8,{content:m.content,parsed:m.parsed,onSave:F,registry:u});case"mcps":return r.jsx(OB,{content:m.content,parsed:m.parsed,onSave:F,registry:u,configDir:je});case"settings":return r.jsx(p8,{content:m.content,parsed:m.parsed,onSave:F,filePath:d==null?void 0:d.path});case"command":case"rule":case"workflow":case"claudemd":case"env":return r.jsx(bw,{content:m.content,onSave:F,fileType:d.type});default:return r.jsx(bw,{content:m.content,onSave:F,fileType:"claudemd"})}};if(v)return r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(Tr,{className:"w-6 h-6 animate-spin text-gray-400"})});const Ge=s.some(je=>je.isSubproject),me=(je,we)=>we===0,be=(je,we)=>{const ve=s.findIndex(_e=>_e.isSubproject);return!je.isSubproject&&(ve>=0?we===ve-1:we===s.length-1)};return r.jsxs("div",{className:"h-full flex",children:[r.jsxs("div",{className:"w-76 border-r flex flex-col bg-white dark:bg-slate-950",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[r.jsx("h2",{className:"font-semibold text-sm",children:"Project Config"}),r.jsxs("div",{className:"flex gap-1",children:[q.includes("claude")&&q.includes("antigravity")&&r.jsxs(re,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>M(!0),title:"Sync rules between tools",children:[r.jsx(f5,{className:"w-4 h-4 mr-1"}),"Sync"]}),r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:R,children:r.jsx(Tr,{className:"w-4 h-4"})})]})]}),r.jsx(Ys,{className:"flex-1",children:s.map((je,we)=>r.jsx(uB,{folder:je,isExpanded:x===je.dir,isHome:me(je,we),isProject:be(je,we),isSubproject:je.isSubproject,depth:je.depth||0,onToggle:()=>$(je.dir),onCreateFile:fe,onInstallPlugin:(ve,_e)=>z({open:!0,dir:ve,name:_e}),onSelectItem:G,selectedPath:d==null?void 0:d.path,onContextMenu:ce,expandedFolders:j,onToggleFolder:te,hasSubprojects:Ge,onAddSubproject:ve=>L({open:!0,projectDir:ve}),onRemoveSubproject:le,onHideSubproject:Ce,enabledTools:q},je.dir))})]}),r.jsxs("div",{className:"flex-1 flex flex-col bg-gray-50 dark:bg-slate-900",children:[d&&r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-white dark:bg-slate-950",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm",children:r.jsx("span",{className:"text-gray-500 dark:text-slate-400 font-mono truncate max-w-md",children:d.path})}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>b({open:!0,item:d}),children:r.jsx(Wa,{className:"w-4 h-4"})}),r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>ae(d),children:r.jsx(ys,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"flex-1",children:Le()})]}),U.item&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X({x:0,y:0,item:null})}),r.jsxs("div",{className:"fixed z-50 bg-white dark:bg-slate-950 rounded-md shadow-lg border py-1 min-w-[160px]",style:{left:U.x,top:U.y},children:[(((Be=U.item)==null?void 0:Be.type)==="rule"||((Ke=U.item)==null?void 0:Ke.type)==="command"||((Qe=U.item)==null?void 0:Qe.type)==="workflow")&&r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{A({open:!0,item:U.item}),X({x:0,y:0,item:null})},children:[r.jsx(oS,{className:"w-4 h-4 mr-2"})," Rename"]}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{b({open:!0,item:U.item}),X({x:0,y:0,item:null})},children:[r.jsx(Wa,{className:"w-4 h-4 mr-2"})," Copy to..."]}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{b({open:!0,item:U.item}),X({x:0,y:0,item:null})},children:[r.jsx(iS,{className:"w-4 h-4 mr-2"})," Move to..."]}),r.jsx("div",{className:"border-t my-1"}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center text-red-600",onClick:()=>{ae(U.item),X({x:0,y:0,item:null})},children:[r.jsx(ys,{className:"w-4 h-4 mr-2"})," Delete"]})]})]}),r.jsx(x8,{open:g.open,onClose:()=>b({open:!1,item:null}),item:g.item,intermediatePaths:o,onMove:ne}),r.jsx(y8,{open:k.open,onClose:()=>E({open:!1,dir:null,type:null}),dir:k.dir,type:k.type,onCreate:J}),r.jsx(v8,{open:P.open,onClose:()=>A({open:!1,item:null}),item:P.item,onRename:W}),r.jsx(C6,{open:N,onOpenChange:M,projectDir:e==null?void 0:e.dir,onSynced:R}),r.jsx(nB,{open:B.open,onOpenChange:je=>z({...B,open:je}),projectDir:B.dir,projectName:B.name}),r.jsx(mx,{open:I.open,onOpenChange:je=>L({...I,open:je}),onSelect:Z,type:"directory",title:"Add Sub-project",initialPath:I.projectDir||"~"}),r.jsx(Lj,{open:Y.open,onOpenChange:je=>{H({...Y,open:je}),je||R()},title:"Initialize CLAUDE.md",description:"Running claude -p /init to generate project-aware CLAUDE.md",cwd:Y.dir,initialCommand:"claude -p /init; exit",autoCloseOnExit:!0,autoCloseDelay:2e3})]})}function w8({projects:e=[],activeProject:t=null,onSwitch:s,onAddClick:n,onManageClick:o,disabled:c=!1}){const u=(t==null?void 0:t.name)||"No Project";return r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",className:"gap-2 max-w-[220px] h-9",disabled:c,children:[r.jsx(Ki,{className:"w-4 h-4 text-indigo-500 flex-shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:u}),r.jsx(vr,{className:"w-4 h-4 opacity-50 flex-shrink-0"})]})}),r.jsxs(dn,{align:"start",className:"w-72",children:[r.jsx(xc,{className:"text-xs text-gray-500 font-normal",children:"Projects"}),r.jsx(gs,{}),e.length===0?r.jsxs("div",{className:"px-3 py-6 text-sm text-gray-500 text-center",children:[r.jsx(Kr,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),r.jsx("p",{children:"No projects registered"}),r.jsx("p",{className:"text-xs mt-1",children:"Add a project to get started"})]}):r.jsx("div",{className:"max-h-64 overflow-y-auto",children:e.map(l=>r.jsxs(Nt,{onClick:()=>!l.isActive&&s(l.id),className:`flex items-start gap-2 py-2 cursor-pointer ${l.isActive?"bg-indigo-50":""}`,disabled:l.isActive,children:[r.jsx("div",{className:"mt-0.5 flex-shrink-0",children:l.isActive?r.jsx(It,{className:"w-4 h-4 text-indigo-600"}):l.exists?r.jsx(Kr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vi,{className:"w-4 h-4 text-amber-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:`truncate font-medium ${l.isActive?"text-indigo-700":""}`,children:l.name}),r.jsx("div",{className:"truncate text-xs text-gray-400 font-mono",children:l.path.replace(/^\/Users\/[^/]+/,"~")}),!l.exists&&r.jsx("div",{className:"text-xs text-amber-600 mt-0.5",children:"Path not found"})]}),l.hasClaudeConfig&&r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-2 h-2 rounded-full bg-green-400",title:"Has .claude config"})})]},l.id))}),r.jsx(gs,{}),r.jsxs(Nt,{onClick:n,className:"gap-2 cursor-pointer",children:[r.jsx(Tt,{className:"w-4 h-4"}),"Add Project"]}),e.length>0&&r.jsxs(Nt,{onClick:o,className:"gap-2 cursor-pointer",children:[r.jsx(vp,{className:"w-4 h-4"}),"Manage Projects"]})]})]})}const Fm="claude-config-welcome-seen";function _8({onStartTutorial:e}){const[t,s]=_.useState(!1),[n,o]=_.useState(!0);_.useEffect(()=>{if(!localStorage.getItem(Fm)){const d=setTimeout(()=>s(!0),500);return()=>clearTimeout(d)}},[]);const c=()=>{n&&localStorage.setItem(Fm,"true"),s(!1)},u=()=>{n&&localStorage.setItem(Fm,"true"),s(!1),e==null||e()};return r.jsx(yt,{open:t,onOpenChange:s,children:r.jsxs(ht,{className:"sm:max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg",children:r.jsx(un,{className:"w-6 h-6 text-white"})}),r.jsx(mt,{className:"text-2xl",children:"Welcome to Coder Config"})]}),r.jsx(tr,{className:"text-base pt-2",children:"Your control center for Claude Code and AI coding tools."})]}),r.jsxs("div",{className:"py-4 space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"We built Coder Config because managing AI coding assistants shouldn't require editing JSON files or memorizing command-line flags. You deserve a visual interface that makes configuration easy."}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 py-2",children:[r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(Gn,{className:"w-5 h-5 mx-auto mb-2 text-indigo-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"MCP Servers"})]}),r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(Jn,{className:"w-5 h-5 mx-auto mb-2 text-green-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Permissions"})]}),r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(Ht,{className:"w-5 h-5 mx-auto mb-2 text-amber-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Rules & Memory"})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Take our guided tutorial to learn the basics, or dive in and explore on your own."}),r.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[r.jsx(Rc,{id:"dont-ask",checked:n,onCheckedChange:o}),r.jsx(or,{htmlFor:"dont-ask",className:"text-sm text-muted-foreground cursor-pointer",children:"Don't show this again"})]})]}),r.jsxs(St,{className:"flex gap-2 sm:gap-2",children:[r.jsx(re,{variant:"ghost",onClick:c,children:"Skip for now"}),r.jsxs(re,{onClick:u,className:"gap-2",children:[r.jsx(ku,{className:"w-4 h-4"}),"Start Tutorial",r.jsx(Pg,{className:"w-4 h-4"})]})]})]})})}const Bm="claude-config:claude-init-preference";function fN({open:e,onOpenChange:t,onAdded:s}){const[n,o]=_.useState(""),[c,u]=_.useState(""),[l,d]=_.useState(!1),[f,m]=_.useState(!1),[h,x]=_.useState(!0),[w,j]=_.useState([]),[C,v]=_.useState(null),y=_.useRef(null);_.useEffect(()=>{const E=localStorage.getItem(Bm);E==="never"?x(!1):E==="always"&&x(!0)},[]),_.useEffect(()=>{if(e){o(""),u(""),j([]),v(null);const E=localStorage.getItem(Bm);x(E!=="never")}},[e]),_.useEffect(()=>{y.current&&(y.current.scrollTop=y.current.scrollHeight)},[w]),_.useEffect(()=>{if(n&&!c){const E=n.split("/").pop();u(E||"")}},[n]);const g=E=>{o(E),d(!1)},b=async()=>{if(!n){K.error("Please select a project path");return}m(!0),j([]),v(null);try{if(h){v("running");const P=await new Promise(A=>{const N=new EventSource(`/api/projects/init-stream?path=${encodeURIComponent(n)}`);N.onmessage=M=>{const I=JSON.parse(M.data);I.type==="output"?j(L=>[...L,I.text]):I.type==="status"?j(L=>[...L,I.message+`
620
+ }`}),children:[r.jsx(Tt,{className:"w-4 h-4 mr-1"}),"Add MCP"]}),d==="json"&&r.jsxs(re,{size:"sm",onClick:k,disabled:x,children:[r.jsx(Ms,{className:"w-4 h-4 mr-1"}),"Apply JSON"]})]})]}),r.jsxs("div",{className:"mx-3 mt-3 p-3 rounded-lg bg-orange-50 dark:bg-orange-950/30 border border-orange-200 dark:border-orange-800 flex items-center gap-2",children:[r.jsx(Ts,{className:"w-4 h-4 text-orange-600 shrink-0"}),r.jsxs("span",{className:"text-sm text-orange-800 dark:text-orange-200",children:["Global MCPs are available in ",r.jsx("strong",{children:"all projects"}),". They're stored in ",r.jsx("code",{className:"bg-orange-100 dark:bg-orange-900 px-1 rounded",children:"~/.claude.json"}),"."]})]}),r.jsx(Ys,{className:"flex-1",children:d==="rich"?r.jsx(ir,{children:r.jsxs("div",{className:"p-4 space-y-2",children:[P.map(([A,N])=>{var M;return r.jsxs("div",{className:"p-2 rounded border bg-white dark:bg-slate-950 group",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vs,{className:"w-4 h-4 text-green-500"}),r.jsx("span",{className:"text-sm font-medium",children:A})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tt,{variant:"outline",className:"text-xs",children:"custom"}),r.jsx(re,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>g(A),children:r.jsx(ys,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 font-mono",children:[N.command," ",(M=N.args)==null?void 0:M.join(" ")]})]},`custom-${A}`)}),E.map(A=>{var I;const N=!!u[A],M=n.mcpServers[A];return r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs("div",{className:`flex items-center justify-between p-2 rounded border ${N?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-800":"bg-gray-50 dark:bg-slate-900 border-gray-200 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vs,{className:`w-4 h-4 ${N?"text-green-500":"text-gray-400"}`}),r.jsx("span",{className:`text-sm ${N?"font-medium":"text-gray-500 dark:text-slate-400"}`,children:A}),M.description&&r.jsxs("span",{className:"text-xs text-gray-400 dark:text-slate-500 hidden sm:inline",children:["— ",M.description]})]}),r.jsx(vt,{checked:N,onCheckedChange:()=>y(A),className:N?"data-[state=checked]:bg-green-500":""})]})}),r.jsxs(Dt,{children:[r.jsxs("p",{className:"font-mono text-xs",children:[M.command," ",(I=M.args)==null?void 0:I.join(" ")]}),M.description&&r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:M.description})]})]},`registry-${A}`)}),E.length===0&&P.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No MCPs configured. Use the registry toggle or add a custom MCP."})]})}):r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Edit the mcpServers section (other ~/.claude.json settings are preserved)"}),r.jsx(_t,{value:m,onChange:A=>h(A.target.value),className:"font-mono text-sm h-[400px]",placeholder:"{}"})]})}),r.jsx(yt,{open:j.open,onOpenChange:A=>C({...j,open:A}),children:r.jsxs(ht,{children:[r.jsxs(ft,{children:[r.jsx(mt,{children:"Add Custom MCP"}),r.jsx(tr,{children:'Enter the MCP configuration as JSON with "name" and "config" fields.'})]}),r.jsx(_t,{value:j.json,onChange:A=>C({...j,json:A.target.value}),className:"font-mono text-sm h-48"}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>C({open:!1,json:""}),children:"Cancel"}),r.jsx(re,{onClick:b,children:"Add MCP"})]})]})})]})}function x8({open:e,onClose:t,item:s,intermediatePaths:n,onMove:o}){const[c,u]=_.useState("copy"),[l,d]=_.useState(null),[f,m]=_.useState(""),[h,x]=_.useState(!1),w=()=>{const j=f.trim()||l;if(!j){K.error("Please select or enter a target path");return}o(s.path,j,c,h)};return r.jsx(yt,{open:e,onOpenChange:t,children:r.jsxs(ht,{className:"max-w-md",children:[r.jsxs(ft,{children:[r.jsxs(mt,{children:[c==="copy"?"Copy":"Move"," ",s==null?void 0:s.name]}),r.jsx(tr,{children:"Select a destination for this file"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(re,{variant:c==="copy"?"default":"outline",size:"sm",onClick:()=>u("copy"),children:[r.jsx(Wa,{className:"w-4 h-4 mr-1"})," Copy"]}),r.jsxs(re,{variant:c==="move"?"default":"outline",size:"sm",onClick:()=>u("move"),children:[r.jsx(iS,{className:"w-4 h-4 mr-1"})," Move"]})]}),r.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:n==null?void 0:n.map(j=>r.jsxs("div",{className:Ee("flex items-center justify-between p-2 rounded border cursor-pointer",l===j.dir?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"hover:bg-gray-50 dark:hover:bg-slate-800"),onClick:()=>{d(j.dir),m("")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[j.isHome?r.jsx(Mg,{className:"w-4 h-4"}):r.jsx(Kr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm",children:j.label})]}),j.hasClaudeFolder?r.jsx(tt,{variant:"secondary",className:"text-xs",children:"exists"}):r.jsx(tt,{variant:"outline",className:"text-xs",children:"create"})]},j.dir))}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Or enter custom path:"}),r.jsx(lt,{className:"mt-1 font-mono text-sm",placeholder:"/path/to/directory",value:f,onChange:j=>{m(j.target.value),d(null)}})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vt,{checked:h,onCheckedChange:x}),r.jsx("span",{className:"text-sm",children:"Merge if target exists"})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(re,{onClick:w,children:c==="copy"?"Copy":"Move"})]})]})})}function v8({open:e,onClose:t,item:s,onRename:n}){const[o,c]=_.useState("");_.useEffect(()=>{s!=null&&s.name&&c(s.name.replace(/\.md$/,""))},[s,e]);const u=()=>{if(!o.trim()){K.error("Please enter a name");return}n(s,o.trim())};return r.jsx(yt,{open:e,onOpenChange:t,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsxs(mt,{children:["Rename ",s==null?void 0:s.type]})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"New name"}),r.jsx(lt,{className:"mt-1",placeholder:"new-name",value:o,onChange:l=>c(l.target.value),onKeyDown:l=>l.key==="Enter"&&u()}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:".md extension will be added automatically"})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(re,{onClick:u,children:"Rename"})]})]})})}function y8({open:e,onClose:t,dir:s,type:n,onCreate:o}){const[c,u]=_.useState("");_.useEffect(()=>{u("")},[e]);const l=()=>{if((n==="command"||n==="rule"||n==="workflow"||n==="memory")&&!c.trim()){K.error("Please enter a name");return}const m=n==="command"||n==="rule"||n==="workflow"||n==="memory"?c.endsWith(".md")?c:`${c}.md`:c;o(s,m,n)},d=vc[n]||{},f=n==="command"||n==="rule"||n==="workflow"||n==="memory";return r.jsx(yt,{open:e,onOpenChange:t,children:r.jsxs(ht,{className:"max-w-sm",children:[r.jsx(ft,{children:r.jsxs(mt,{children:["Create ",d.label||n]})}),f&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name"}),r.jsx(lt,{className:"mt-1",placeholder:n==="command"?"my-skill.md":n==="workflow"?"my-workflow.md":n==="memory"?"context.md":"my-rule.md",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>m.key==="Enter"&&l()})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:t,children:"Cancel"}),r.jsx(re,{onClick:l,children:"Create"})]})]})})}function b8({project:e,onRefresh:t}){var Be,Ke,Qe;const[s,n]=_.useState([]),[o,c]=_.useState([]),[u,l]=_.useState(null),[d,f]=_.useState(null),[m,h]=_.useState(null),[x,w]=_.useState(()=>{try{return localStorage.getItem("claude-config-expanded-folder")||null}catch{return null}}),[j,C]=_.useState({}),[v,y]=_.useState(!0),[g,b]=_.useState({open:!1,item:null}),[k,E]=_.useState({open:!1,dir:null,type:null}),[P,A]=_.useState({open:!1,item:null}),[N,M]=_.useState(!1),[I,L]=_.useState({open:!1,projectDir:null}),[B,z]=_.useState({open:!1,dir:null,name:null}),[Y,H]=_.useState({open:!1,dir:null}),[U,X]=_.useState({x:0,y:0,item:null}),[q,O]=_.useState(["claude"]),R=_.useCallback(async()=>{var je;try{y(!0);const[we,ve,_e,Oe]=await Promise.all([ue.getClaudeFolders(),ue.getIntermediatePaths(),ue.getRegistry(),ue.getConfig()]);if(n(we),c(ve),l(_e),O(((je=Oe.config)==null?void 0:je.enabledTools)||["claude"]),we.length>0){const de=localStorage.getItem("claude-config-expanded-folder");if(!de||!we.find(ye=>ye.dir===de)){const ye=we.filter(Je=>!Je.isSubproject),Re=ye.length>1?ye[ye.length-1]:ye[0],ze=(Re==null?void 0:Re.dir)||we[0].dir;w(ze);try{localStorage.setItem("claude-config-expanded-folder",ze)}catch{}}}}catch(we){K.error("Failed to load data: "+we.message)}finally{y(!1)}},[]);_.useEffect(()=>{R(),f(null),h(null)},[R,e==null?void 0:e.dir]);const $=je=>{const we=x===je?null:je;w(we);try{we?localStorage.setItem("claude-config-expanded-folder",we):localStorage.removeItem("claude-config-expanded-folder")}catch{}},G=async je=>{f(je);try{const we=await ue.getClaudeFile(je.path);h(we)}catch(we){K.error("Failed to load file: "+we.message)}},F=async je=>{if(d)try{await ue.saveClaudeFile(d.path,je),K.success("Saved");const we=await ue.getClaudeFile(d.path);h(we),R()}catch(we){K.error("Failed to save: "+we.message)}},te=je=>{C(we=>({...we,[je]:!we[je]}))},ce=(je,we)=>{je.preventDefault(),X({x:je.clientX,y:je.clientY,item:we})},fe=async(je,we)=>{we==="command"||we==="rule"||we==="workflow"||we==="memory"?E({open:!0,dir:je,type:we}):we==="claudemd"?H({open:!0,dir:je}):J(je,we==="mcps"?"mcps.json":we==="settings"?"settings.json":we==="env"?".env":"CLAUDE.md",we)},J=async(je,we,ve)=>{try{const _e=await ue.createClaudeFile(je,we,ve);if(K.success("Created"),E({open:!1,dir:null,type:null}),await R(),_e.path){const Oe={path:_e.path,name:we,type:["command","rule","workflow","env","mcps","settings","claudemd","memory"].includes(ve)?ve:"file"};f(Oe),h({content:_e.content||"",parsed:null})}}catch(_e){K.error("Failed to create: "+_e.message)}},W=async(je,we)=>{try{const ve=await ue.renameClaudeFile(je.path,we);ve.success?(K.success("Renamed"),A({open:!1,item:null}),await R(),f({...je,path:ve.newPath,name:we.endsWith(".md")?we:`${we}.md`})):K.error(ve.error||"Failed to rename")}catch(ve){K.error("Failed to rename: "+ve.message)}},ae=async je=>{if(confirm(`Delete ${je.name}?`))try{await ue.deleteClaudeFile(je.path),K.success("Deleted"),(d==null?void 0:d.path)===je.path&&(f(null),h(null)),R()}catch(we){K.error("Failed to delete: "+we.message)}},ne=async(je,we,ve,_e)=>{try{await ue.moveClaudeItem(je,we,ve,_e),K.success(ve==="copy"?"Copied":"Moved"),b({open:!1,item:null}),R()}catch(Oe){K.error("Failed: "+Oe.message)}},Z=async je=>{if(je)try{const we=await ue.addManualSubproject(I.projectDir,je);we.success?(K.success(`Added sub-project: ${je.split("/").pop()}`),L({open:!1,projectDir:null}),R()):K.error(we.error||"Failed to add sub-project")}catch(we){K.error("Failed to add sub-project: "+we.message)}},le=async je=>{const we=s.find(ve=>!ve.isSubproject&&!ve.isHome);if(we)try{const ve=await ue.removeManualSubproject(we.dir,je);ve.success?(K.success("Removed sub-project"),R()):K.error(ve.error||"Failed to remove sub-project")}catch(ve){K.error("Failed to remove sub-project: "+ve.message)}},Ce=async je=>{const we=s.find(ve=>!ve.isSubproject&&!ve.isHome);if(we)try{const ve=await ue.hideSubproject(we.dir,je);ve.success?(K.success("Sub-project hidden"),R()):K.error(ve.error||"Failed to hide sub-project")}catch(ve){K.error("Failed to hide sub-project: "+ve.message)}},Le=()=>{if(!d||!m)return r.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-slate-400",children:r.jsxs("div",{className:"text-center",children:[r.jsx(gp,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"Select a file to edit"})]})});const je=d.path?d.path.replace(/\/.claude\/mcps\.json$/,""):null;switch(d.type){case"global-mcps":return r.jsx(g8,{content:m.content,parsed:m.parsed,onSave:F,registry:u});case"mcps":return r.jsx(OB,{content:m.content,parsed:m.parsed,onSave:F,registry:u,configDir:je});case"settings":return r.jsx(p8,{content:m.content,parsed:m.parsed,onSave:F,filePath:d==null?void 0:d.path});case"command":case"rule":case"workflow":case"claudemd":case"env":return r.jsx(bw,{content:m.content,onSave:F,fileType:d.type});default:return r.jsx(bw,{content:m.content,onSave:F,fileType:"claudemd"})}};if(v)return r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(Tr,{className:"w-6 h-6 animate-spin text-gray-400"})});const Ge=s.some(je=>je.isSubproject),me=(je,we)=>we===0,be=(je,we)=>{const ve=s.findIndex(_e=>_e.isSubproject);return!je.isSubproject&&(ve>=0?we===ve-1:we===s.length-1)};return r.jsxs("div",{className:"h-full flex",children:[r.jsxs("div",{className:"w-76 border-r flex flex-col bg-white dark:bg-slate-950",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[r.jsx("h2",{className:"font-semibold text-sm",children:"Project Config"}),r.jsxs("div",{className:"flex gap-1",children:[q.includes("claude")&&q.includes("antigravity")&&r.jsxs(re,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>M(!0),title:"Sync rules between tools",children:[r.jsx(f5,{className:"w-4 h-4 mr-1"}),"Sync"]}),r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:R,children:r.jsx(Tr,{className:"w-4 h-4"})})]})]}),r.jsx(Ys,{className:"flex-1",children:s.map((je,we)=>r.jsx(uB,{folder:je,isExpanded:x===je.dir,isHome:me(je,we),isProject:be(je,we),isSubproject:je.isSubproject,depth:je.depth||0,onToggle:()=>$(je.dir),onCreateFile:fe,onInstallPlugin:(ve,_e)=>z({open:!0,dir:ve,name:_e}),onSelectItem:G,selectedPath:d==null?void 0:d.path,onContextMenu:ce,expandedFolders:j,onToggleFolder:te,hasSubprojects:Ge,onAddSubproject:ve=>L({open:!0,projectDir:ve}),onRemoveSubproject:le,onHideSubproject:Ce,enabledTools:q},je.dir))})]}),r.jsxs("div",{className:"flex-1 flex flex-col bg-gray-50 dark:bg-slate-900",children:[d&&r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-white dark:bg-slate-950",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm",children:r.jsx("span",{className:"text-gray-500 dark:text-slate-400 font-mono truncate max-w-md",children:d.path})}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>b({open:!0,item:d}),children:r.jsx(Wa,{className:"w-4 h-4"})}),r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>ae(d),children:r.jsx(ys,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"flex-1",children:Le()})]}),U.item&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X({x:0,y:0,item:null})}),r.jsxs("div",{className:"fixed z-50 bg-white dark:bg-slate-950 rounded-md shadow-lg border py-1 min-w-[160px]",style:{left:U.x,top:U.y},children:[(((Be=U.item)==null?void 0:Be.type)==="rule"||((Ke=U.item)==null?void 0:Ke.type)==="command"||((Qe=U.item)==null?void 0:Qe.type)==="workflow")&&r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{A({open:!0,item:U.item}),X({x:0,y:0,item:null})},children:[r.jsx(oS,{className:"w-4 h-4 mr-2"})," Rename"]}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{b({open:!0,item:U.item}),X({x:0,y:0,item:null})},children:[r.jsx(Wa,{className:"w-4 h-4 mr-2"})," Copy to..."]}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center",onClick:()=>{b({open:!0,item:U.item}),X({x:0,y:0,item:null})},children:[r.jsx(iS,{className:"w-4 h-4 mr-2"})," Move to..."]}),r.jsx("div",{className:"border-t my-1"}),r.jsxs("button",{className:"w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center text-red-600",onClick:()=>{ae(U.item),X({x:0,y:0,item:null})},children:[r.jsx(ys,{className:"w-4 h-4 mr-2"})," Delete"]})]})]}),r.jsx(x8,{open:g.open,onClose:()=>b({open:!1,item:null}),item:g.item,intermediatePaths:o,onMove:ne}),r.jsx(y8,{open:k.open,onClose:()=>E({open:!1,dir:null,type:null}),dir:k.dir,type:k.type,onCreate:J}),r.jsx(v8,{open:P.open,onClose:()=>A({open:!1,item:null}),item:P.item,onRename:W}),r.jsx(C6,{open:N,onOpenChange:M,projectDir:e==null?void 0:e.dir,onSynced:R}),r.jsx(nB,{open:B.open,onOpenChange:je=>z({...B,open:je}),projectDir:B.dir,projectName:B.name}),r.jsx(mx,{open:I.open,onOpenChange:je=>L({...I,open:je}),onSelect:Z,type:"directory",title:"Add Sub-project",initialPath:I.projectDir||"~"}),r.jsx(Lj,{open:Y.open,onOpenChange:je=>{H({...Y,open:je}),je||R()},title:"Initialize CLAUDE.md",description:"Running claude -p /init to generate project-aware CLAUDE.md",cwd:Y.dir,initialCommand:"claude -p /init; exit",autoCloseOnExit:!0,autoCloseDelay:2e3})]})}function w8({projects:e=[],activeProject:t=null,onSwitch:s,onAddClick:n,onManageClick:o,disabled:c=!1}){const u=(t==null?void 0:t.name)||"No Project";return r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",className:"gap-2 max-w-[220px] h-9",disabled:c,children:[r.jsx(Ki,{className:"w-4 h-4 text-indigo-500 flex-shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:u}),r.jsx(vr,{className:"w-4 h-4 opacity-50 flex-shrink-0"})]})}),r.jsxs(dn,{align:"start",className:"w-72",children:[r.jsx(xc,{className:"text-xs text-gray-500 font-normal",children:"Projects"}),r.jsx(gs,{}),e.length===0?r.jsxs("div",{className:"px-3 py-6 text-sm text-gray-500 text-center",children:[r.jsx(Kr,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),r.jsx("p",{children:"No projects registered"}),r.jsx("p",{className:"text-xs mt-1",children:"Add a project to get started"})]}):r.jsx("div",{className:"max-h-64 overflow-y-auto",children:e.map(l=>r.jsxs(Nt,{onClick:()=>!l.isActive&&s(l.id),className:`flex items-start gap-2 py-2 cursor-pointer ${l.isActive?"bg-indigo-50":""}`,disabled:l.isActive,children:[r.jsx("div",{className:"mt-0.5 flex-shrink-0",children:l.isActive?r.jsx(It,{className:"w-4 h-4 text-indigo-600"}):l.exists?r.jsx(Kr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vi,{className:"w-4 h-4 text-amber-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:`truncate font-medium ${l.isActive?"text-indigo-700":""}`,children:l.name}),r.jsx("div",{className:"truncate text-xs text-gray-400 font-mono",children:l.path.replace(/^\/Users\/[^/]+/,"~")}),!l.exists&&r.jsx("div",{className:"text-xs text-amber-600 mt-0.5",children:"Path not found"})]}),l.hasClaudeConfig&&r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-2 h-2 rounded-full bg-green-400",title:"Has .claude config"})})]},l.id))}),r.jsx(gs,{}),r.jsxs(Nt,{onClick:n,className:"gap-2 cursor-pointer",children:[r.jsx(Tt,{className:"w-4 h-4"}),"Add Project"]}),e.length>0&&r.jsxs(Nt,{onClick:o,className:"gap-2 cursor-pointer",children:[r.jsx(vp,{className:"w-4 h-4"}),"Manage Projects"]})]})]})}const Fm="claude-config-welcome-seen";function _8({onStartTutorial:e}){const[t,s]=_.useState(!1),[n,o]=_.useState(!0);_.useEffect(()=>{if(!localStorage.getItem(Fm)){const d=setTimeout(()=>s(!0),500);return()=>clearTimeout(d)}},[]);const c=()=>{n&&localStorage.setItem(Fm,"true"),s(!1)},u=()=>{n&&localStorage.setItem(Fm,"true"),s(!1),e==null||e()};return r.jsx(yt,{open:t,onOpenChange:s,children:r.jsxs(ht,{className:"sm:max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg",children:r.jsx(un,{className:"w-6 h-6 text-white"})}),r.jsx(mt,{className:"text-2xl",children:"Welcome to Coder Config"})]}),r.jsx(tr,{className:"text-base pt-2",children:"Your control center for Claude Code and AI coding tools."})]}),r.jsxs("div",{className:"py-4 space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"We built Coder Config because managing AI coding assistants shouldn't require editing JSON files or memorizing command-line flags. You deserve a visual interface that makes configuration easy."}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 py-2",children:[r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(Gn,{className:"w-5 h-5 mx-auto mb-2 text-indigo-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"MCP Servers"})]}),r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(Jn,{className:"w-5 h-5 mx-auto mb-2 text-green-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Permissions"})]}),r.jsxs("div",{className:"text-center p-3 rounded-lg bg-muted/50",children:[r.jsx(Ht,{className:"w-5 h-5 mx-auto mb-2 text-amber-500"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Rules & Memory"})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Take our guided tutorial to learn the basics, or dive in and explore on your own."}),r.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[r.jsx(Rc,{id:"dont-ask",checked:n,onCheckedChange:o}),r.jsx(or,{htmlFor:"dont-ask",className:"text-sm text-muted-foreground cursor-pointer",children:"Don't show this again"})]})]}),r.jsxs(St,{className:"flex gap-2 sm:gap-2",children:[r.jsx(re,{variant:"ghost",onClick:c,children:"Skip for now"}),r.jsxs(re,{onClick:u,className:"gap-2",children:[r.jsx(ku,{className:"w-4 h-4"}),"Start Tutorial",r.jsx(Pg,{className:"w-4 h-4"})]})]})]})})}const Bm="claude-config:claude-init-preference";function fN({open:e,onOpenChange:t,onAdded:s}){const[n,o]=_.useState(""),[c,u]=_.useState(""),[l,d]=_.useState(!1),[f,m]=_.useState(!1),[h,x]=_.useState(!0),[w,j]=_.useState([]),[C,v]=_.useState(null),y=_.useRef(null);_.useEffect(()=>{const E=localStorage.getItem(Bm);E==="never"?x(!1):E==="always"&&x(!0)},[]),_.useEffect(()=>{if(e){o(""),u(""),j([]),v(null);const E=localStorage.getItem(Bm);x(E!=="never")}},[e]),_.useEffect(()=>{y.current&&(y.current.scrollTop=y.current.scrollHeight)},[w]),_.useEffect(()=>{if(n&&!c){const E=n.split("/").pop();u(E||"")}},[n]);const g=E=>{o(E),d(!1)},b=async()=>{if(!n){K.error("Please select a project path");return}m(!0),j([]),v(null);try{if(h){v("running");const P=await new Promise(A=>{const N=new EventSource(`/api/projects/init-stream?path=${encodeURIComponent(n)}`);N.onmessage=M=>{const I=JSON.parse(M.data);I.type==="output"?j(L=>[...L,I.text]):I.type==="status"?j(L=>[...L,I.message+`
621
621
  `]):I.type==="skip"?j(L=>[...L,I.message+`
622
622
  `]):I.type==="done"?(N.close(),v(I.success?"success":"error"),A(I.success)):I.type==="error"&&(j(L=>[...L,`Error: ${I.message}
623
623
  `]),N.close(),v("error"),A(!1))},N.onerror=()=>{N.close(),j(M=>[...M,`Connection error - is Claude Code installed?
624
624
  `]),v("error"),A(!1)}});await new Promise(A=>setTimeout(A,500))}const E=await ue.addProject(n,c||void 0,!1);E.error?K.error(E.error):(K.success(`Added project: ${E.project.name}`),s==null||s(E.project),t(!1))}catch(E){K.error("Failed to add project: "+E.message)}finally{m(!1)}},k=E=>{localStorage.setItem(Bm,E),E==="never"?x(!1):E==="always"&&x(!0),K.success(`Preference saved: ${E==="always"?"Always":E==="never"?"Never":"Ask each time"} run claude /init`)};return r.jsxs(r.Fragment,{children:[r.jsx(yt,{open:e,onOpenChange:t,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"w-5 h-5 text-indigo-500"}),"Add Project"]}),r.jsx(tr,{children:"Register a project folder to quickly switch between projects in the UI."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(or,{htmlFor:"path",children:"Project Path"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{id:"path",value:n,onChange:E=>o(E.target.value),placeholder:"/path/to/project",className:"font-mono text-sm flex-1"}),r.jsx(re,{variant:"outline",size:"icon",onClick:()=>d(!0),title:"Browse",children:r.jsx(Ki,{className:"w-4 h-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(or,{htmlFor:"name",children:"Display Name"}),r.jsx(lt,{id:"name",value:c,onChange:E=>u(E.target.value),placeholder:"Auto-filled from folder name"}),r.jsx("p",{className:"text-xs text-gray-500",children:"Optional. Leave empty to use folder name."})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Rc,{id:"claudeInit",checked:h,onCheckedChange:x,className:"mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(or,{htmlFor:"claudeInit",className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(Ht,{className:"w-4 h-4 text-orange-500"}),"Initialize with Claude Code"]}),r.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Run ",r.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded",children:"claude /init"})," to create CLAUDE.md"]})]})]}),r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsx(re,{variant:"ghost",size:"sm",className:"text-xs h-7",onClick:()=>k("always"),children:"Always"}),r.jsx(re,{variant:"ghost",size:"sm",className:"text-xs h-7",onClick:()=>k("never"),children:"Never"}),r.jsx(re,{variant:"ghost",size:"sm",className:"text-xs h-7",onClick:()=>k("ask"),children:"Ask each time"})]})]})]}),C&&r.jsxs("div",{className:"border rounded-lg overflow-hidden bg-slate-950",children:[r.jsx("div",{className:"flex items-center gap-2 px-3 py-2 bg-slate-900 border-b border-slate-800",children:C==="running"?r.jsxs(r.Fragment,{children:[r.jsx(et,{className:"w-4 h-4 animate-spin text-blue-400"}),r.jsx("span",{className:"text-sm text-slate-300",children:"Running claude -p /init..."})]}):C==="success"?r.jsxs(r.Fragment,{children:[r.jsx(Mo,{className:"w-4 h-4 text-green-400"}),r.jsx("span",{className:"text-sm text-green-400",children:"Initialized successfully"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Da,{className:"w-4 h-4 text-red-400"}),r.jsx("span",{className:"text-sm text-red-400",children:"Initialization failed"})]})}),r.jsxs("div",{ref:y,className:"p-3 font-mono text-xs text-slate-300 max-h-48 overflow-y-auto whitespace-pre-wrap",children:[w.map((E,P)=>r.jsx("span",{children:E},P)),C==="running"&&r.jsx("span",{className:"animate-pulse",children:"_"})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>t(!1),disabled:C==="running",children:"Cancel"}),r.jsx(re,{onClick:b,disabled:f||!n,children:f?r.jsxs(r.Fragment,{children:[r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}),C==="running"?"Initializing...":"Adding..."]}):"Add Project"})]})]})}),r.jsx(mx,{open:l,onOpenChange:d,onSelect:g,type:"directory",initialPath:"~",title:"Select Project Folder"})]})}const mN=_.createContext({theme:"auto",setTheme:()=>{},resolvedTheme:"light"});function C8({children:e}){const[t,s]=_.useState(()=>{try{return localStorage.getItem("claude-config-theme")||"auto"}catch{return"auto"}}),[n,o]=_.useState("light");_.useEffect(()=>{const u=window.document.documentElement,l=m=>{let h;m==="auto"?h=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h=m,o(h),h==="dark"?u.classList.add("dark"):u.classList.remove("dark")};l(t);const d=window.matchMedia("(prefers-color-scheme: dark)"),f=()=>{t==="auto"&&l("auto")};return d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[t]);const c=u=>{s(u);try{localStorage.setItem("claude-config-theme",u)}catch{}};return r.jsx(mN.Provider,{value:{theme:t,setTheme:c,resolvedTheme:n},children:e})}function S8(){return _.useContext(mN)}function k8(){const{theme:e,setTheme:t,resolvedTheme:s}=S8(),n=s==="dark"?Mb:Ib;return r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"ghost",size:"sm",className:"w-9 px-0",children:[r.jsx(n,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),r.jsxs(dn,{align:"end",children:[r.jsxs(Nt,{onClick:()=>t("light"),className:e==="light"?"bg-accent":"",children:[r.jsx(Ib,{className:"mr-2 h-4 w-4"}),"Light"]}),r.jsxs(Nt,{onClick:()=>t("dark"),className:e==="dark"?"bg-accent":"",children:[r.jsx(Mb,{className:"mr-2 h-4 w-4"}),"Dark"]}),r.jsxs(Nt,{onClick:()=>t("auto"),className:e==="auto"?"bg-accent":"",children:[r.jsx(nS,{className:"mr-2 h-4 w-4"}),"System"]})]})]})}var j8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],N8=j8.reduce((e,t)=>{const s=Xu(`Primitive.${t}`),n=_.forwardRef((o,c)=>{const{asChild:u,...l}=o,d=u?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...l,ref:c})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),E8="Separator",Sw="horizontal",P8=["horizontal","vertical"],pN=_.forwardRef((e,t)=>{const{decorative:s,orientation:n=Sw,...o}=e,c=A8(n)?n:Sw,l=s?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return r.jsx(N8.div,{"data-orientation":c,...l,...o,ref:t})});pN.displayName=E8;function A8(e){return P8.includes(e)}var gN=pN;const xN=_.forwardRef(({className:e,orientation:t="horizontal",decorative:s=!0,...n},o)=>r.jsx(gN,{ref:o,decorative:s,orientation:t,className:Ee("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));xN.displayName=gN.displayName;const kw=e=>{let t;const s=new Set,n=(f,m)=>{const h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){const x=t;t=m??(typeof h!="object"||h===null)?h:Object.assign({},t,h),s.forEach(w=>w(t,x))}},o=()=>t,l={setState:n,getState:o,getInitialState:()=>d,subscribe:f=>(s.add(f),()=>s.delete(f))},d=t=e(n,o,l);return l},T8=(e=>e?kw(e):kw),R8=e=>e;function M8(e,t=R8){const s=Pe.useSyncExternalStore(e.subscribe,Pe.useCallback(()=>t(e.getState()),[e,t]),Pe.useCallback(()=>t(e.getInitialState()),[e,t]));return Pe.useDebugValue(s),s}const jw=e=>{const t=T8(e),s=n=>M8(t,n);return Object.assign(s,t),s},Sh=(e=>e?jw(e):jw),Ex=Sh((e,t)=>({projects:[],activeProject:null,loading:!1,error:null,fetch:async()=>{e({loading:!0,error:null});try{const n=(await ue.getProjects()).projects||[],o=n.find(c=>c.isActive)||null;return e({projects:n,activeProject:o,loading:!1}),n}catch(s){return e({error:s.message,loading:!1}),[]}},add:async(s,n,o=!1)=>{try{const c=await ue.addProject(s,n,o);if(c.success||c.project){const u=c.project||{path:s,name:n,exists:!0};return e(l=>({projects:[...l.projects,u]})),{success:!0,project:u}}return{success:!1,error:c.error}}catch(c){return{success:!1,error:c.message}}},remove:async s=>{try{const n=await ue.removeProject(s);return n.success?(e(o=>{var c;return{projects:o.projects.filter(u=>u.id!==s),activeProject:((c=o.activeProject)==null?void 0:c.id)===s?null:o.activeProject}}),{success:!0}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},update:async(s,n)=>{try{const o=await ue.updateProject(s,n);return o.success?(e(c=>({projects:c.projects.map(u=>u.id===s?{...u,...o.project}:u)})),{success:!0,project:o.project}):{success:!1,error:o.error}}catch(o){return{success:!1,error:o.message}}},setActive:async s=>{try{const n=await ue.setActiveProject(s);return n.success?(e(o=>({projects:o.projects.map(c=>({...c,isActive:c.id===s})),activeProject:n.project})),n):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},clearActive:()=>{e(s=>({projects:s.projects.map(n=>({...n,isActive:!1})),activeProject:null}))}})),vN=Sh((e,t)=>({workstreams:[],activeId:null,loading:!1,error:null,fetch:async()=>{e({loading:!0,error:null});try{const s=await ue.getWorkstreams();return e({workstreams:s.workstreams||[],activeId:s.activeId||null,loading:!1}),s.workstreams||[]}catch(s){return e({error:s.message,loading:!1}),[]}},getActiveWorkstream:()=>{const{workstreams:s,activeId:n}=t();return n?s.find(o=>o.id===n):null},create:async(s,n=[],o="")=>{try{const c=await ue.createWorkstream({name:s,projects:n,rules:o});return c.success||c.workstream?(e(u=>({workstreams:[...u.workstreams,c.workstream]})),{success:!0,workstream:c.workstream}):{success:!1,error:c.error}}catch(c){return{success:!1,error:c.message}}},update:async(s,n)=>{try{const o=await ue.updateWorkstream(s,n);return o.success||o.workstream?(e(c=>({workstreams:c.workstreams.map(u=>u.id===s?{...u,...o.workstream}:u)})),{success:!0,workstream:o.workstream}):{success:!1,error:o.error}}catch(o){return{success:!1,error:o.message}}},delete:async s=>{try{const n=await ue.deleteWorkstream(s);return n.success?(e(o=>({workstreams:o.workstreams.filter(c=>c.id!==s),activeId:o.activeId===s?null:o.activeId})),{success:!0}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},setActive:async s=>{try{const n=await ue.setActiveWorkstream(s);return n.success?(e({activeId:s}),{success:!0}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},addProject:async(s,n)=>{try{const o=await ue.addProjectToWorkstream(s,n);return o.success?(e(c=>({workstreams:c.workstreams.map(u=>u.id===s?{...u,projects:[...u.projects||[],n]}:u)})),{success:!0}):{success:!1,error:o.error}}catch(o){return{success:!1,error:o.message}}},removeProject:async(s,n)=>{try{const o=await ue.removeProjectFromWorkstream(s,n);return o.success?(e(c=>({workstreams:c.workstreams.map(u=>u.id===s?{...u,projects:(u.projects||[]).filter(l=>l!==n)}:u)})),{success:!0}):{success:!1,error:o.error}}catch(o){return{success:!1,error:o.message}}},getWorkstreamsForProject:s=>t().workstreams.filter(n=>{var o;return(o=n.projects)==null?void 0:o.includes(s)}),countWorkstreamsForProject:s=>t().getWorkstreamsForProject(s).length}));Sh((e,t)=>({loops:[],activeLoop:null,config:{},history:[],loading:!1,error:null,fetch:async()=>{var s;e({loading:!0,error:null});try{const n=await ue.getLoops();return e({loops:n.loops||[],activeLoop:n.activeId?(s=n.loops)==null?void 0:s.find(o=>o.id===n.activeId):null,config:n.config||{},loading:!1}),n.loops||[]}catch(n){return e({error:n.message,loading:!1}),[]}},fetchOne:async s=>{try{const n=await ue.getLoop(s);return n.loop?(e(o=>({loops:o.loops.map(c=>c.id===s?n.loop:c)})),n):{error:n.error}}catch(n){return{error:n.message}}},create:async(s,n={})=>{try{const o=await ue.createLoop({task:s,...n});return o.loop?(e(c=>({loops:[...c.loops,o.loop]})),{success:!0,loop:o.loop}):{success:!1,error:o.error}}catch(o){return{success:!1,error:o.message}}},update:async(s,n)=>{try{const o=await ue.updateLoop(s,n);return o.loop?(e(c=>{var u;return{loops:c.loops.map(l=>l.id===s?o.loop:l),activeLoop:((u=c.activeLoop)==null?void 0:u.id)===s?o.loop:c.activeLoop}}),{success:!0,loop:o.loop}):{success:!1,error:o.error}}catch(o){return{success:!1,error:o.message}}},delete:async s=>{try{const n=await ue.deleteLoop(s);return n.success?(e(o=>{var c;return{loops:o.loops.filter(u=>u.id!==s),activeLoop:((c=o.activeLoop)==null?void 0:c.id)===s?null:o.activeLoop}}),{success:!0}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},start:async s=>{try{const n=await ue.startLoop(s);return n.loop?(e(o=>({loops:o.loops.map(c=>c.id===s?n.loop:c),activeLoop:n.loop})),{success:!0,loop:n.loop}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},pause:async s=>{try{const n=await ue.pauseLoop(s);return n.loop?(e(o=>{var c;return{loops:o.loops.map(u=>u.id===s?n.loop:u),activeLoop:((c=o.activeLoop)==null?void 0:c.id)===s?n.loop:o.activeLoop}}),{success:!0,loop:n.loop}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},cancel:async s=>{try{const n=await ue.cancelLoop(s);return n.loop?(e(o=>{var c;return{loops:o.loops.map(u=>u.id===s?n.loop:u),activeLoop:((c=o.activeLoop)==null?void 0:c.id)===s?null:o.activeLoop}}),{success:!0,loop:n.loop}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},complete:async s=>{try{const n=await ue.completeLoop(s);return n.loop?(e(o=>{var c;return{loops:o.loops.filter(u=>u.id!==s),activeLoop:((c=o.activeLoop)==null?void 0:c.id)===s?null:o.activeLoop}}),{success:!0,loop:n.loop}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},fetchHistory:async()=>{try{const s=await ue.getLoopHistory();return e({history:s.history||[]}),s.history||[]}catch{return[]}},updateConfig:async s=>{try{const n=await ue.updateLoopConfig(s);return n.config?(e({config:n.config}),{success:!0,config:n.config}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},setActiveLoop:s=>{e({activeLoop:s})},clearActiveLoop:()=>{e({activeLoop:null})}}));const Nw=Sh((e,t)=>({appConfig:null,loading:!1,error:null,version:null,latestVersion:null,updateAvailable:!1,fetch:async()=>{e({loading:!0,error:null});try{const s=await ue.getConfig();return e({appConfig:s.config||{},loading:!1}),s.config}catch(s){return e({error:s.message,loading:!1}),null}},save:async s=>{try{const n=await ue.saveConfig(s);return n.success?(e({appConfig:s}),{success:!0}):{success:!1,error:n.error}}catch(n){return{success:!1,error:n.message}}},update:async s=>{const o={...t().appConfig||{},...s};return t().save(o)},checkVersion:async()=>{try{const s=await ue.checkVersion();return e({version:s.installedVersion,latestVersion:s.latestVersion,updateAvailable:s.updateAvailable||!1}),s}catch(s){return{error:s.message}}},isFeatureEnabled:s=>{var o;const n=t().appConfig;return((o=n==null?void 0:n.experimental)==null?void 0:o[s])===!0},isToolEnabled:s=>{const n=t().appConfig;return((n==null?void 0:n.enabledTools)||["claude"]).includes(s)},getEnabledTools:()=>{const s=t().appConfig;return(s==null?void 0:s.enabledTools)||["claude"]},setExperimentalFeature:async(s,n)=>{const o=t().appConfig||{},c={...o.experimental||{},[s]:n};return t().save({...o,experimental:c})},setEnabledTools:async s=>{const n=t().appConfig||{};return t().save({...n,enabledTools:s})}}));function D8(e,t){const s={};return(e[e.length-1]===""?[...e,""]:e).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}const I8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,L8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O8={};function Ew(e,t){return(O8.jsx?L8:I8).test(e)}const F8=/[ \t\n\f\r]/g;function B8(e){return typeof e=="object"?e.type==="text"?Pw(e.value):!1:Pw(e)}function Pw(e){return e.replace(F8,"")===""}class Hc{constructor(t,s,n){this.normal=s,this.property=t,n&&(this.space=n)}}Hc.prototype.normal={};Hc.prototype.property={};Hc.prototype.space=void 0;function yN(e,t){const s={},n={};for(const o of e)Object.assign(s,o.property),Object.assign(n,o.normal);return new Hc(s,n,t)}function Op(e){return e.toLowerCase()}class Is{constructor(t,s){this.attribute=s,this.property=t}}Is.prototype.attribute="";Is.prototype.booleanish=!1;Is.prototype.boolean=!1;Is.prototype.commaOrSpaceSeparated=!1;Is.prototype.commaSeparated=!1;Is.prototype.defined=!1;Is.prototype.mustUseProperty=!1;Is.prototype.number=!1;Is.prototype.overloadedBoolean=!1;Is.prototype.property="";Is.prototype.spaceSeparated=!1;Is.prototype.space=void 0;let $8=0;const xt=Ho(),_r=Ho(),Fp=Ho(),Te=Ho(),qt=Ho(),Oa=Ho(),Hs=Ho();function Ho(){return 2**++$8}const Bp=Object.freeze(Object.defineProperty({__proto__:null,boolean:xt,booleanish:_r,commaOrSpaceSeparated:Hs,commaSeparated:Oa,number:Te,overloadedBoolean:Fp,spaceSeparated:qt},Symbol.toStringTag,{value:"Module"})),$m=Object.keys(Bp);class Px extends Is{constructor(t,s,n,o){let c=-1;if(super(t,s),Aw(this,"space",o),typeof n=="number")for(;++c<$m.length;){const u=$m[c];Aw(this,$m[c],(n&Bp[u])===Bp[u])}}}Px.prototype.defined=!0;function Aw(e,t,s){s&&(e[t]=s)}function il(e){const t={},s={};for(const[n,o]of Object.entries(e.properties)){const c=new Px(n,e.transform(e.attributes||{},n),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(c.mustUseProperty=!0),t[n]=c,s[Op(n)]=n,s[Op(c.attribute)]=n}return new Hc(t,s,e.space)}const bN=il({properties:{ariaActiveDescendant:null,ariaAtomic:_r,ariaAutoComplete:null,ariaBusy:_r,ariaChecked:_r,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,ariaControls:qt,ariaCurrent:null,ariaDescribedBy:qt,ariaDetails:null,ariaDisabled:_r,ariaDropEffect:qt,ariaErrorMessage:null,ariaExpanded:_r,ariaFlowTo:qt,ariaGrabbed:_r,ariaHasPopup:null,ariaHidden:_r,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qt,ariaLevel:Te,ariaLive:null,ariaModal:_r,ariaMultiLine:_r,ariaMultiSelectable:_r,ariaOrientation:null,ariaOwns:qt,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:_r,ariaReadOnly:_r,ariaRelevant:null,ariaRequired:_r,ariaRoleDescription:qt,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:_r,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function wN(e,t){return t in e?e[t]:t}function _N(e,t){return wN(e,t.toLowerCase())}const z8=il({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Oa,acceptCharset:qt,accessKey:qt,action:null,allow:null,allowFullScreen:xt,allowPaymentRequest:xt,allowUserMedia:xt,alt:null,as:null,async:xt,autoCapitalize:null,autoComplete:qt,autoFocus:xt,autoPlay:xt,blocking:qt,capture:null,charSet:null,checked:xt,cite:null,className:qt,cols:Te,colSpan:null,content:null,contentEditable:_r,controls:xt,controlsList:qt,coords:Te|Oa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xt,defer:xt,dir:null,dirName:null,disabled:xt,download:Fp,draggable:_r,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xt,formTarget:null,headers:qt,height:Te,hidden:Fp,high:Te,href:null,hrefLang:null,htmlFor:qt,httpEquiv:qt,id:null,imageSizes:null,imageSrcSet:null,inert:xt,inputMode:null,integrity:null,is:null,isMap:xt,itemId:null,itemProp:qt,itemRef:qt,itemScope:xt,itemType:qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xt,low:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,multiple:xt,muted:xt,name:null,nonce:null,noModule:xt,noValidate:xt,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:xt,optimum:Te,pattern:null,ping:qt,placeholder:null,playsInline:xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xt,referrerPolicy:null,rel:qt,required:xt,reversed:xt,rows:Te,rowSpan:Te,sandbox:qt,scope:null,scoped:xt,seamless:xt,selected:xt,shadowRootClonable:xt,shadowRootDelegatesFocus:xt,shadowRootMode:null,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:_r,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:xt,useMap:null,value:_r,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:qt,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xt,declare:xt,event:null,face:null,frame:null,frameBorder:null,hSpace:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:xt,noHref:xt,noShade:xt,noWrap:xt,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:_r,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xt,disableRemotePlayback:xt,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:_N}),H8=il({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:Hs,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,className:qt,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:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,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:Oa,g2:Oa,glyphName:Oa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:Hs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,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:Te,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:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Hs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Hs,rev:Hs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Hs,requiredFeatures:Hs,requiredFonts:Hs,requiredFormats:Hs,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:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:Hs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Hs,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Hs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:wN}),CN=il({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()}}),SN=il({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_N}),kN=il({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),W8={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"},V8=/[A-Z]/g,Tw=/-[a-z]/g,U8=/^data[-\w.:]+$/i;function G8(e,t){const s=Op(t);let n=t,o=Is;if(s in e.normal)return e.property[e.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&U8.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Tw,K8);n="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Tw.test(c)){let u=c.replace(V8,q8);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}o=Px}return new o(n,t)}function q8(e){return"-"+e.toLowerCase()}function K8(e){return e.charAt(1).toUpperCase()}const Y8=yN([bN,z8,CN,SN,kN],"html"),Ax=yN([bN,H8,CN,SN,kN],"svg");function J8(e){return e.join(" ").trim()}var Sa={},zm,Rw;function X8(){if(Rw)return zm;Rw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,s=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
625
625
  `,f="/",m="*",h="",x="comment",w="declaration";function j(v,y){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];y=y||{};var g=1,b=1;function k(Y){var H=Y.match(t);H&&(g+=H.length);var U=Y.lastIndexOf(d);b=~U?Y.length-U:b+Y.length}function E(){var Y={line:g,column:b};return function(H){return H.position=new P(Y),M(),H}}function P(Y){this.start=Y,this.end={line:g,column:b},this.source=y.source}P.prototype.content=v;function A(Y){var H=new Error(y.source+":"+g+":"+b+": "+Y);if(H.reason=Y,H.filename=y.source,H.line=g,H.column=b,H.source=v,!y.silent)throw H}function N(Y){var H=Y.exec(v);if(H){var U=H[0];return k(U),v=v.slice(U.length),H}}function M(){N(s)}function I(Y){var H;for(Y=Y||[];H=L();)H!==!1&&Y.push(H);return Y}function L(){var Y=E();if(!(f!=v.charAt(0)||m!=v.charAt(1))){for(var H=2;h!=v.charAt(H)&&(m!=v.charAt(H)||f!=v.charAt(H+1));)++H;if(H+=2,h===v.charAt(H-1))return A("End of comment missing");var U=v.slice(2,H-2);return b+=2,k(U),v=v.slice(H),b+=2,Y({type:x,comment:U})}}function B(){var Y=E(),H=N(n);if(H){if(L(),!N(o))return A("property missing ':'");var U=N(c),X=Y({type:w,property:C(H[0].replace(e,h)),value:U?C(U[0].replace(e,h)):h});return N(u),X}}function z(){var Y=[];I(Y);for(var H;H=B();)H!==!1&&(Y.push(H),I(Y));return Y}return M(),z()}function C(v){return v?v.replace(l,h):h}return zm=j,zm}var Mw;function Q8(){if(Mw)return Sa;Mw=1;var e=Sa&&Sa.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Sa,"__esModule",{value:!0}),Sa.default=s;const t=e(X8());function s(n,o){let c=null;if(!n||typeof n!="string")return c;const u=(0,t.default)(n),l=typeof o=="function";return u.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:m}=d;l?o(f,m,d):m&&(c=c||{},c[f]=m)}),c}return Sa}var Wl={},Dw;function Z8(){if(Dw)return Wl;Dw=1,Object.defineProperty(Wl,"__esModule",{value:!0}),Wl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,s=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(f){return!f||s.test(f)||e.test(f)},u=function(f,m){return m.toUpperCase()},l=function(f,m){return"".concat(m,"-")},d=function(f,m){return m===void 0&&(m={}),c(f)?f:(f=f.toLowerCase(),m.reactCompat?f=f.replace(o,l):f=f.replace(n,l),f.replace(t,u))};return Wl.camelCase=d,Wl}var Vl,Iw;function e7(){if(Iw)return Vl;Iw=1;var e=Vl&&Vl.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(Q8()),s=Z8();function n(o,c){var u={};return!o||typeof o!="string"||(0,t.default)(o,function(l,d){l&&d&&(u[(0,s.camelCase)(l,c)]=d)}),u}return n.default=n,Vl=n,Vl}var t7=e7();const r7=wc(t7),jN=NN("end"),Tx=NN("start");function NN(e){return t;function t(s){const n=s&&s.position&&s.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 s7(e){const t=Tx(e),s=jN(e);if(t&&s)return{start:t,end:s}}function nc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Lw(e.position):"start"in e||"end"in e?Lw(e):"line"in e||"column"in e?$p(e):""}function $p(e){return Ow(e&&e.line)+":"+Ow(e&&e.column)}function Lw(e){return $p(e&&e.start)+"-"+$p(e&&e.end)}function Ow(e){return e&&typeof e=="number"?e:1}class ds extends Error{constructor(t,s,n){super(),typeof s=="string"&&(n=s,s=void 0);let o="",c={},u=!1;if(s&&("line"in s&&"column"in s?c={place:s}:"start"in s&&"end"in s?c={place:s}:"type"in s?c={ancestors:[s],place:s.position}:c={...s}),typeof t=="string"?o=t:!c.cause&&t&&(u=!0,o=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof n=="string"){const d=n.indexOf(":");d===-1?c.ruleId=n:(c.source=n.slice(0,d),c.ruleId=n.slice(d+1))}if(!c.place&&c.ancestors&&c.ancestors){const d=c.ancestors[c.ancestors.length-1];d&&(c.place=d.position)}const l=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=l?l.line:void 0,this.name=nc(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ds.prototype.file="";ds.prototype.name="";ds.prototype.reason="";ds.prototype.message="";ds.prototype.stack="";ds.prototype.column=void 0;ds.prototype.line=void 0;ds.prototype.ancestors=void 0;ds.prototype.cause=void 0;ds.prototype.fatal=void 0;ds.prototype.place=void 0;ds.prototype.ruleId=void 0;ds.prototype.source=void 0;const Rx={}.hasOwnProperty,n7=new Map,i7=/[A-Z]/g,o7=new Set(["table","tbody","thead","tfoot","tr"]),a7=new Set(["td","th"]),EN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function l7(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const s=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=g7(s,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=p7(s,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ax:Y8,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=PN(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function PN(e,t,s){if(t.type==="element")return c7(e,t,s);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return d7(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return h7(e,t,s);if(t.type==="mdxjsEsm")return u7(e,t);if(t.type==="root")return f7(e,t,s);if(t.type==="text")return m7(e,t)}function c7(e,t,s){const n=e.schema;let o=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(o=Ax,e.schema=o),e.ancestors.push(t);const c=TN(e,t.tagName,!1),u=x7(e,t);let l=Dx(e,t);return o7.has(t.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!B8(d):!0})),AN(e,u,c,t),Mx(u,l),e.ancestors.pop(),e.schema=n,e.create(t,c,u,s)}function d7(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)}bc(e,t.position)}function u7(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bc(e,t.position)}function h7(e,t,s){const n=e.schema;let o=n;t.name==="svg"&&n.space==="html"&&(o=Ax,e.schema=o),e.ancestors.push(t);const c=t.name===null?e.Fragment:TN(e,t.name,!0),u=v7(e,t),l=Dx(e,t);return AN(e,u,c,t),Mx(u,l),e.ancestors.pop(),e.schema=n,e.create(t,c,u,s)}function f7(e,t,s){const n={};return Mx(n,Dx(e,t)),e.create(t,e.Fragment,n,s)}function m7(e,t){return t.value}function AN(e,t,s,n){typeof s!="string"&&s!==e.Fragment&&e.passNode&&(t.node=n)}function Mx(e,t){if(t.length>0){const s=t.length>1?t:t[0];s&&(e.children=s)}}function p7(e,t,s){return n;function n(o,c,u,l){const f=Array.isArray(u.children)?s:t;return l?f(c,u,l):f(c,u)}}function g7(e,t){return s;function s(n,o,c,u){const l=Array.isArray(c.children),d=Tx(n);return t(o,c,u,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function x7(e,t){const s={};let n,o;for(o in t.properties)if(o!=="children"&&Rx.call(t.properties,o)){const c=y7(e,o,t.properties[o]);if(c){const[u,l]=c;e.tableCellAlignToStyle&&u==="align"&&typeof l=="string"&&a7.has(t.tagName)?n=l:s[u]=l}}if(n){const c=s.style||(s.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return s}function v7(e,t){const s={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const c=n.data.estree.body[0];c.type;const u=c.expression;u.type;const l=u.properties[0];l.type,Object.assign(s,e.evaluater.evaluateExpression(l.argument))}else bc(e,t.position);else{const o=n.name;let c;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,c=e.evaluater.evaluateExpression(l.expression)}else bc(e,t.position);else c=n.value===null?!0:n.value;s[o]=c}return s}function Dx(e,t){const s=[];let n=-1;const o=e.passKeys?new Map:n7;for(;++n<t.children.length;){const c=t.children[n];let u;if(e.passKeys){const d=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(d){const f=o.get(d)||0;u=d+"-"+f,o.set(d,f+1)}}const l=PN(e,c,u);l!==void 0&&s.push(l)}return s}function y7(e,t,s){const n=G8(e.schema,t);if(!(s==null||typeof s=="number"&&Number.isNaN(s))){if(Array.isArray(s)&&(s=n.commaSeparated?D8(s):J8(s)),n.property==="style"){let o=typeof s=="object"?s:b7(e,String(s));return e.stylePropertyNameCase==="css"&&(o=w7(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&n.space?W8[n.property]||n.property:n.attribute,s]}}function b7(e,t){try{return r7(t,{reactCompat:!0})}catch(s){if(e.ignoreInvalidStyle)return{};const n=s,o=new ds("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=EN+"#cannot-parse-style-attribute",o}}function TN(e,t,s){let n;if(!s)n={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let c=-1,u;for(;++c<o.length;){const l=Ew(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};u=u?{type:"MemberExpression",object:u,property:l,computed:!!(c&&l.type==="Literal"),optional:!1}:l}n=u}else n=Ew(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const o=n.value;return Rx.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(n);bc(e)}function bc(e,t){const s=new ds("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=EN+"#cannot-handle-mdx-estrees-without-createevaluater",s}function w7(e){const t={};let s;for(s in e)Rx.call(e,s)&&(t[_7(s)]=e[s]);return t}function _7(e){let t=e.replace(i7,C7);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function C7(e){return"-"+e.toLowerCase()}const Hm={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"]},S7={};function k7(e,t){const s=S7,n=typeof s.includeImageAlt=="boolean"?s.includeImageAlt:!0,o=typeof s.includeHtml=="boolean"?s.includeHtml:!0;return RN(e,n,o)}function RN(e,t,s){if(j7(e)){if("value"in e)return e.type==="html"&&!s?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Fw(e.children,t,s)}return Array.isArray(e)?Fw(e,t,s):""}function Fw(e,t,s){const n=[];let o=-1;for(;++o<e.length;)n[o]=RN(e[o],t,s);return n.join("")}function j7(e){return!!(e&&typeof e=="object")}const Bw=document.createElement("i");function Ix(e){const t="&"+e+";";Bw.innerHTML=t;const s=Bw.textContent;return s.charCodeAt(s.length-1)===59&&e!=="semi"||s===t?!1:s}function Yn(e,t,s,n){const o=e.length;let c=0,u;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,s=s>0?s:0,n.length<1e4)u=Array.from(n),u.unshift(t,s),e.splice(...u);else for(s&&e.splice(t,s);c<n.length;)u=n.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function an(e,t){return e.length>0?(Yn(e,e.length,0,t),e):t}const $w={}.hasOwnProperty;function N7(e){const t={};let s=-1;for(;++s<e.length;)E7(t,e[s]);return t}function E7(e,t){let s;for(s in t){const o=($w.call(e,s)?e[s]:void 0)||(e[s]={}),c=t[s];let u;if(c)for(u in c){$w.call(o,u)||(o[u]=[]);const l=c[u];P7(o[u],Array.isArray(l)?l:l?[l]:[])}}}function P7(e,t){let s=-1;const n=[];for(;++s<t.length;)(t[s].add==="after"?e:n).push(t[s]);Yn(e,0,0,n)}function MN(e,t){const s=Number.parseInt(e,t);return s<9||s===11||s>13&&s<32||s>126&&s<160||s>55295&&s<57344||s>64975&&s<65008||(s&65535)===65535||(s&65535)===65534||s>1114111?"�":String.fromCodePoint(s)}function Fa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=to(/[A-Za-z]/),Us=to(/[\dA-Za-z]/),A7=to(/[#-'*+\--9=?A-Z^-~]/);function zp(e){return e!==null&&(e<32||e===127)}const Hp=to(/\d/),T7=to(/[\dA-Fa-f]/),R7=to(/[!-/:-@[-`{-~]/);function dt(e){return e!==null&&e<-2}function Rs(e){return e!==null&&(e<0||e===32)}function Bt(e){return e===-2||e===-1||e===32}const M7=to(new RegExp("\\p{P}|\\p{S}","u")),D7=to(/\s/);function to(e){return t;function t(s){return s!==null&&s>-1&&e.test(String.fromCharCode(s))}}function ol(e){const t=[];let s=-1,n=0,o=0;for(;++s<e.length;){const c=e.charCodeAt(s);let u="";if(c===37&&Us(e.charCodeAt(s+1))&&Us(e.charCodeAt(s+2)))o=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const l=e.charCodeAt(s+1);c<56320&&l>56319&&l<57344?(u=String.fromCharCode(c,l),o=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(n,s),encodeURIComponent(u)),n=s+o+1,u=""),o&&(s+=o,o=0)}return t.join("")+e.slice(n)}function Yt(e,t,s,n){const o=n?n-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(d){return Bt(d)?(e.enter(s),l(d)):t(d)}function l(d){return Bt(d)&&c++<o?(e.consume(d),l):(e.exit(s),t(d))}}const I7={tokenize:L7};function L7(e){const t=e.attempt(this.parser.constructs.contentInitial,n,o);let s;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Yt(e,t,"linePrefix")}function o(l){return e.enter("paragraph"),c(l)}function c(l){const d=e.enter("chunkText",{contentType:"text",previous:s});return s&&(s.next=d),s=d,u(l)}function u(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return dt(l)?(e.consume(l),e.exit("chunkText"),c):(e.consume(l),u)}}const O7={tokenize:F7},zw={tokenize:B7};function F7(e){const t=this,s=[];let n=0,o,c,u;return l;function l(b){if(n<s.length){const k=s[n];return t.containerState=k[1],e.attempt(k[0].continuation,d,f)(b)}return f(b)}function d(b){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&g();const k=t.events.length;let E=k,P;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){P=t.events[E][1].end;break}y(n);let A=k;for(;A<t.events.length;)t.events[A][1].end={...P},A++;return Yn(t.events,E+1,0,t.events.slice(k)),t.events.length=A,f(b)}return l(b)}function f(b){if(n===s.length){if(!o)return x(b);if(o.currentConstruct&&o.currentConstruct.concrete)return j(b);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(zw,m,h)(b)}function m(b){return o&&g(),y(n),x(b)}function h(b){return t.parser.lazy[t.now().line]=n!==s.length,u=t.now().offset,j(b)}function x(b){return t.containerState={},e.attempt(zw,w,j)(b)}function w(b){return n++,s.push([t.currentConstruct,t.containerState]),x(b)}function j(b){if(b===null){o&&g(),y(0),e.consume(b);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),C(b)}function C(b){if(b===null){v(e.exit("chunkFlow"),!0),y(0),e.consume(b);return}return dt(b)?(e.consume(b),v(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(b),C)}function v(b,k){const E=t.sliceStream(b);if(k&&E.push(null),b.previous=c,c&&(c.next=b),c=b,o.defineSkip(b.start),o.write(E),t.parser.lazy[b.start.line]){let P=o.events.length;for(;P--;)if(o.events[P][1].start.offset<u&&(!o.events[P][1].end||o.events[P][1].end.offset>u))return;const A=t.events.length;let N=A,M,I;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){if(M){I=t.events[N][1].end;break}M=!0}for(y(n),P=A;P<t.events.length;)t.events[P][1].end={...I},P++;Yn(t.events,N+1,0,t.events.slice(A)),t.events.length=P}}function y(b){let k=s.length;for(;k-- >b;){const E=s[k];t.containerState=E[1],E[0].exit.call(t,e)}s.length=b}function g(){o.write([null]),c=void 0,o=void 0,t.containerState._closeFlow=void 0}}function B7(e,t,s){return Yt(e,e.attempt(this.parser.constructs.document,t,s),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Hw(e){if(e===null||Rs(e)||D7(e))return 1;if(M7(e))return 2}function Lx(e,t,s){const n=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!n.includes(c)&&(t=c(t,s),n.push(c))}return t}const Wp={name:"attention",resolveAll:$7,tokenize:z7};function $7(e,t){let s=-1,n,o,c,u,l,d,f,m;for(;++s<e.length;)if(e[s][0]==="enter"&&e[s][1].type==="attentionSequence"&&e[s][1]._close){for(n=s;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[s][1]).charCodeAt(0)){if((e[n][1]._close||e[s][1]._open)&&(e[s][1].end.offset-e[s][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[s][1].end.offset-e[s][1].start.offset)%3))continue;d=e[n][1].end.offset-e[n][1].start.offset>1&&e[s][1].end.offset-e[s][1].start.offset>1?2:1;const h={...e[n][1].end},x={...e[s][1].start};Ww(h,-d),Ww(x,d),u={type:d>1?"strongSequence":"emphasisSequence",start:h,end:{...e[n][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[s][1].start},end:x},c={type:d>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[s][1].start}},o={type:d>1?"strong":"emphasis",start:{...u.start},end:{...l.end}},e[n][1].end={...u.start},e[s][1].start={...l.end},f=[],e[n][1].end.offset-e[n][1].start.offset&&(f=an(f,[["enter",e[n][1],t],["exit",e[n][1],t]])),f=an(f,[["enter",o,t],["enter",u,t],["exit",u,t],["enter",c,t]]),f=an(f,Lx(t.parser.constructs.insideSpan.null,e.slice(n+1,s),t)),f=an(f,[["exit",c,t],["enter",l,t],["exit",l,t],["exit",o,t]]),e[s][1].end.offset-e[s][1].start.offset?(m=2,f=an(f,[["enter",e[s][1],t],["exit",e[s][1],t]])):m=0,Yn(e,n-1,s-n+3,f),s=n+f.length-m-2;break}}for(s=-1;++s<e.length;)e[s][1].type==="attentionSequence"&&(e[s][1].type="data");return e}function z7(e,t){const s=this.parser.constructs.attentionMarkers.null,n=this.previous,o=Hw(n);let c;return u;function u(d){return c=d,e.enter("attentionSequence"),l(d)}function l(d){if(d===c)return e.consume(d),l;const f=e.exit("attentionSequence"),m=Hw(d),h=!m||m===2&&o||s.includes(d),x=!o||o===2&&m||s.includes(n);return f._open=!!(c===42?h:h&&(o||!x)),f._close=!!(c===42?x:x&&(m||!h)),t(d)}}function Ww(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const H7={name:"autolink",tokenize:W7};function W7(e,t,s){let n=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(w){return zn(w)?(e.consume(w),u):w===64?s(w):f(w)}function u(w){return w===43||w===45||w===46||Us(w)?(n=1,l(w)):f(w)}function l(w){return w===58?(e.consume(w),n=0,d):(w===43||w===45||w===46||Us(w))&&n++<32?(e.consume(w),l):(n=0,f(w))}function d(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||zp(w)?s(w):(e.consume(w),d)}function f(w){return w===64?(e.consume(w),m):A7(w)?(e.consume(w),f):s(w)}function m(w){return Us(w)?h(w):s(w)}function h(w){return w===46?(e.consume(w),n=0,m):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):x(w)}function x(w){if((w===45||Us(w))&&n++<63){const j=w===45?x:h;return e.consume(w),j}return s(w)}}const kh={partial:!0,tokenize:V7};function V7(e,t,s){return n;function n(c){return Bt(c)?Yt(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||dt(c)?t(c):s(c)}}const DN={continuation:{tokenize:G7},exit:q7,name:"blockQuote",tokenize:U7};function U7(e,t,s){const n=this;return o;function o(u){if(u===62){const l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return s(u)}function c(u){return Bt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function G7(e,t,s){const n=this;return o;function o(u){return Bt(u)?Yt(e,c,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(DN,t,s)(u)}}function q7(e){e.exit("blockQuote")}const IN={name:"characterEscape",tokenize:K7};function K7(e,t,s){return n;function n(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return R7(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):s(c)}}const LN={name:"characterReference",tokenize:Y7};function Y7(e,t,s){const n=this;let o=0,c,u;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),d}function d(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),c=31,u=Us,m(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=T7,m):(e.enter("characterReferenceValue"),c=7,u=Hp,m(h))}function m(h){if(h===59&&o){const x=e.exit("characterReferenceValue");return u===Us&&!Ix(n.sliceSerialize(x))?s(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(h)&&o++<c?(e.consume(h),m):s(h)}}const Vw={partial:!0,tokenize:X7},Uw={concrete:!0,name:"codeFenced",tokenize:J7};function J7(e,t,s){const n=this,o={partial:!0,tokenize:E};let c=0,u=0,l;return d;function d(P){return f(P)}function f(P){const A=n.events[n.events.length-1];return c=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(P)}function m(P){return P===l?(u++,e.consume(P),m):u<3?s(P):(e.exit("codeFencedFenceSequence"),Bt(P)?Yt(e,h,"whitespace")(P):h(P))}function h(P){return P===null||dt(P)?(e.exit("codeFencedFence"),n.interrupt?t(P):e.check(Vw,C,k)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(P))}function x(P){return P===null||dt(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(P)):Bt(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Yt(e,w,"whitespace")(P)):P===96&&P===l?s(P):(e.consume(P),x)}function w(P){return P===null||dt(P)?h(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(P))}function j(P){return P===null||dt(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(P)):P===96&&P===l?s(P):(e.consume(P),j)}function C(P){return e.attempt(o,k,v)(P)}function v(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),y}function y(P){return c>0&&Bt(P)?Yt(e,g,"linePrefix",c+1)(P):g(P)}function g(P){return P===null||dt(P)?e.check(Vw,C,k)(P):(e.enter("codeFlowValue"),b(P))}function b(P){return P===null||dt(P)?(e.exit("codeFlowValue"),g(P)):(e.consume(P),b)}function k(P){return e.exit("codeFenced"),t(P)}function E(P,A,N){let M=0;return I;function I(H){return P.enter("lineEnding"),P.consume(H),P.exit("lineEnding"),L}function L(H){return P.enter("codeFencedFence"),Bt(H)?Yt(P,B,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):B(H)}function B(H){return H===l?(P.enter("codeFencedFenceSequence"),z(H)):N(H)}function z(H){return H===l?(M++,P.consume(H),z):M>=u?(P.exit("codeFencedFenceSequence"),Bt(H)?Yt(P,Y,"whitespace")(H):Y(H)):N(H)}function Y(H){return H===null||dt(H)?(P.exit("codeFencedFence"),A(H)):N(H)}}}function X7(e,t,s){const n=this;return o;function o(u){return u===null?s(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return n.parser.lazy[n.now().line]?s(u):t(u)}}const Wm={name:"codeIndented",tokenize:Z7},Q7={partial:!0,tokenize:e9};function Z7(e,t,s){const n=this;return o;function o(f){return e.enter("codeIndented"),Yt(e,c,"linePrefix",5)(f)}function c(f){const m=n.events[n.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?u(f):s(f)}function u(f){return f===null?d(f):dt(f)?e.attempt(Q7,u,d)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||dt(f)?(e.exit("codeFlowValue"),u(f)):(e.consume(f),l)}function d(f){return e.exit("codeIndented"),t(f)}}function e9(e,t,s){const n=this;return o;function o(u){return n.parser.lazy[n.now().line]?s(u):dt(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):Yt(e,c,"linePrefix",5)(u)}function c(u){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(u):dt(u)?o(u):s(u)}}const t9={name:"codeText",previous:s9,resolve:r9,tokenize:n9};function r9(e){let t=e.length-4,s=3,n,o;if((e[s][1].type==="lineEnding"||e[s][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=s;++n<t;)if(e[n][1].type==="codeTextData"){e[s][1].type="codeTextPadding",e[t][1].type="codeTextPadding",s+=2,t-=2;break}}for(n=s-1,t++;++n<=t;)o===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(o=n):(n===t||e[n][1].type==="lineEnding")&&(e[o][1].type="codeTextData",n!==o+2&&(e[o][1].end=e[n-1][1].end,e.splice(o+2,n-o-2),t-=n-o-2,n=o+2),o=void 0);return e}function s9(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function n9(e,t,s){let n=0,o,c;return u;function u(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),n++,l):(e.exit("codeTextSequence"),d(h))}function d(h){return h===null?s(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),d):h===96?(c=e.enter("codeTextSequence"),o=0,m(h)):dt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||dt(h)?(e.exit("codeTextData"),d(h)):(e.consume(h),f)}function m(h){return h===96?(e.consume(h),o++,m):o===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(c.type="codeTextData",f(h))}}class i9{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,s){const n=s??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,s,n){const o=s||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return n&&Ul(this.left,n),c.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),Ul(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ul(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 s=this.left.splice(t,Number.POSITIVE_INFINITY);Ul(this.right,s.reverse())}else{const s=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ul(this.left,s.reverse())}}}function Ul(e,t){let s=0;if(t.length<1e4)e.push(...t);else for(;s<t.length;)e.push(...t.slice(s,s+1e4)),s+=1e4}function ON(e){const t={};let s=-1,n,o,c,u,l,d,f;const m=new i9(e);for(;++s<m.length;){for(;s in t;)s=t[s];if(n=m.get(s),s&&n[1].type==="chunkFlow"&&m.get(s-1)[1].type==="listItemPrefix"&&(d=n[1]._tokenizer.events,c=0,c<d.length&&d[c][1].type==="lineEndingBlank"&&(c+=2),c<d.length&&d[c][1].type==="content"))for(;++c<d.length&&d[c][1].type!=="content";)d[c][1].type==="chunkText"&&(d[c][1]._isInFirstContentOfListItem=!0,c++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,o9(m,s)),s=t[s],f=!0);else if(n[1]._container){for(c=s,o=void 0;c--;)if(u=m.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(o&&(m.get(o)[1].type="lineEndingBlank"),u[1].type="lineEnding",o=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;o&&(n[1].end={...m.get(o)[1].start},l=m.slice(o,s),l.unshift(n),m.splice(o,s-o+1,l))}}return Yn(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!f}function o9(e,t){const s=e.get(t)[1],n=e.get(t)[2];let o=t-1;const c=[];let u=s._tokenizer;u||(u=n.parser[s.contentType](s.start),s._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const l=u.events,d=[],f={};let m,h,x=-1,w=s,j=0,C=0;const v=[C];for(;w;){for(;e.get(++o)[1]!==w;);c.push(o),w._tokenizer||(m=n.sliceStream(w),w.next||m.push(null),h&&u.defineSkip(w.start),w._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(m),w._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),h=w,w=w.next}for(w=s;++x<l.length;)l[x][0]==="exit"&&l[x-1][0]==="enter"&&l[x][1].type===l[x-1][1].type&&l[x][1].start.line!==l[x][1].end.line&&(C=x+1,v.push(C),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(u.events=[],w?(w._tokenizer=void 0,w.previous=void 0):v.pop(),x=v.length;x--;){const y=l.slice(v[x],v[x+1]),g=c.pop();d.push([g,g+y.length-1]),e.splice(g,2,y)}for(d.reverse(),x=-1;++x<d.length;)f[j+d[x][0]]=j+d[x][1],j+=d[x][1]-d[x][0]-1;return f}const a9={resolve:c9,tokenize:d9},l9={partial:!0,tokenize:u9};function c9(e){return ON(e),e}function d9(e,t){let s;return n;function n(l){return e.enter("content"),s=e.enter("chunkContent",{contentType:"content"}),o(l)}function o(l){return l===null?c(l):dt(l)?e.check(l9,u,c)(l):(e.consume(l),o)}function c(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function u(l){return e.consume(l),e.exit("chunkContent"),s.next=e.enter("chunkContent",{contentType:"content",previous:s}),s=s.next,o}}function u9(e,t,s){const n=this;return o;function o(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Yt(e,c,"linePrefix")}function c(u){if(u===null||dt(u))return s(u);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(u):e.interrupt(n.parser.constructs.flow,s,t)(u)}}function FN(e,t,s,n,o,c,u,l,d){const f=d||Number.POSITIVE_INFINITY;let m=0;return h;function h(y){return y===60?(e.enter(n),e.enter(o),e.enter(c),e.consume(y),e.exit(c),x):y===null||y===32||y===41||zp(y)?s(y):(e.enter(n),e.enter(u),e.enter(l),e.enter("chunkString",{contentType:"string"}),C(y))}function x(y){return y===62?(e.enter(c),e.consume(y),e.exit(c),e.exit(o),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),w(y))}function w(y){return y===62?(e.exit("chunkString"),e.exit(l),x(y)):y===null||y===60||dt(y)?s(y):(e.consume(y),y===92?j:w)}function j(y){return y===60||y===62||y===92?(e.consume(y),w):w(y)}function C(y){return!m&&(y===null||y===41||Rs(y))?(e.exit("chunkString"),e.exit(l),e.exit(u),e.exit(n),t(y)):m<f&&y===40?(e.consume(y),m++,C):y===41?(e.consume(y),m--,C):y===null||y===32||y===40||zp(y)?s(y):(e.consume(y),y===92?v:C)}function v(y){return y===40||y===41||y===92?(e.consume(y),C):C(y)}}function BN(e,t,s,n,o,c){const u=this;let l=0,d;return f;function f(w){return e.enter(n),e.enter(o),e.consume(w),e.exit(o),e.enter(c),m}function m(w){return l>999||w===null||w===91||w===93&&!d||w===94&&!l&&"_hiddenFootnoteSupport"in u.parser.constructs?s(w):w===93?(e.exit(c),e.enter(o),e.consume(w),e.exit(o),e.exit(n),t):dt(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),h(w))}function h(w){return w===null||w===91||w===93||dt(w)||l++>999?(e.exit("chunkString"),m(w)):(e.consume(w),d||(d=!Bt(w)),w===92?x:h)}function x(w){return w===91||w===92||w===93?(e.consume(w),l++,h):h(w)}}function $N(e,t,s,n,o,c){let u;return l;function l(x){return x===34||x===39||x===40?(e.enter(n),e.enter(o),e.consume(x),e.exit(o),u=x===40?41:x,d):s(x)}function d(x){return x===u?(e.enter(o),e.consume(x),e.exit(o),e.exit(n),t):(e.enter(c),f(x))}function f(x){return x===u?(e.exit(c),d(u)):x===null?s(x):dt(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),Yt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===u||x===null||dt(x)?(e.exit("chunkString"),f(x)):(e.consume(x),x===92?h:m)}function h(x){return x===u||x===92?(e.consume(x),m):m(x)}}function ic(e,t){let s;return n;function n(o){return dt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s=!0,n):Bt(o)?Yt(e,n,s?"linePrefix":"lineSuffix")(o):t(o)}}const h9={name:"definition",tokenize:m9},f9={partial:!0,tokenize:p9};function m9(e,t,s){const n=this;let o;return c;function c(w){return e.enter("definition"),u(w)}function u(w){return BN.call(n,e,l,s,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function l(w){return o=Fa(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),d):s(w)}function d(w){return Rs(w)?ic(e,f)(w):f(w)}function f(w){return FN(e,m,s,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function m(w){return e.attempt(f9,h,h)(w)}function h(w){return Bt(w)?Yt(e,x,"whitespace")(w):x(w)}function x(w){return w===null||dt(w)?(e.exit("definition"),n.parser.defined.push(o),t(w)):s(w)}}function p9(e,t,s){return n;function n(l){return Rs(l)?ic(e,o)(l):s(l)}function o(l){return $N(e,c,s,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function c(l){return Bt(l)?Yt(e,u,"whitespace")(l):u(l)}function u(l){return l===null||dt(l)?t(l):s(l)}}const g9={name:"hardBreakEscape",tokenize:x9};function x9(e,t,s){return n;function n(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return dt(c)?(e.exit("hardBreakEscape"),t(c)):s(c)}}const v9={name:"headingAtx",resolve:y9,tokenize:b9};function y9(e,t){let s=e.length-2,n=3,o,c;return e[n][1].type==="whitespace"&&(n+=2),s-2>n&&e[s][1].type==="whitespace"&&(s-=2),e[s][1].type==="atxHeadingSequence"&&(n===s-1||s-4>n&&e[s-2][1].type==="whitespace")&&(s-=n+1===s?2:4),s>n&&(o={type:"atxHeadingText",start:e[n][1].start,end:e[s][1].end},c={type:"chunkText",start:e[n][1].start,end:e[s][1].end,contentType:"text"},Yn(e,n,s-n+1,[["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t]])),e}function b9(e,t,s){let n=0;return o;function o(m){return e.enter("atxHeading"),c(m)}function c(m){return e.enter("atxHeadingSequence"),u(m)}function u(m){return m===35&&n++<6?(e.consume(m),u):m===null||Rs(m)?(e.exit("atxHeadingSequence"),l(m)):s(m)}function l(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||dt(m)?(e.exit("atxHeading"),t(m)):Bt(m)?Yt(e,l,"whitespace")(m):(e.enter("atxHeadingText"),f(m))}function d(m){return m===35?(e.consume(m),d):(e.exit("atxHeadingSequence"),l(m))}function f(m){return m===null||m===35||Rs(m)?(e.exit("atxHeadingText"),l(m)):(e.consume(m),f)}}const w9=["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"],Gw=["pre","script","style","textarea"],_9={concrete:!0,name:"htmlFlow",resolveTo:k9,tokenize:j9},C9={partial:!0,tokenize:E9},S9={partial:!0,tokenize:N9};function k9(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 j9(e,t,s){const n=this;let o,c,u,l,d;return f;function f(F){return m(F)}function m(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),h}function h(F){return F===33?(e.consume(F),x):F===47?(e.consume(F),c=!0,C):F===63?(e.consume(F),o=3,n.interrupt?t:R):zn(F)?(e.consume(F),u=String.fromCharCode(F),v):s(F)}function x(F){return F===45?(e.consume(F),o=2,w):F===91?(e.consume(F),o=5,l=0,j):zn(F)?(e.consume(F),o=4,n.interrupt?t:R):s(F)}function w(F){return F===45?(e.consume(F),n.interrupt?t:R):s(F)}function j(F){const te="CDATA[";return F===te.charCodeAt(l++)?(e.consume(F),l===te.length?n.interrupt?t:B:j):s(F)}function C(F){return zn(F)?(e.consume(F),u=String.fromCharCode(F),v):s(F)}function v(F){if(F===null||F===47||F===62||Rs(F)){const te=F===47,ce=u.toLowerCase();return!te&&!c&&Gw.includes(ce)?(o=1,n.interrupt?t(F):B(F)):w9.includes(u.toLowerCase())?(o=6,te?(e.consume(F),y):n.interrupt?t(F):B(F)):(o=7,n.interrupt&&!n.parser.lazy[n.now().line]?s(F):c?g(F):b(F))}return F===45||Us(F)?(e.consume(F),u+=String.fromCharCode(F),v):s(F)}function y(F){return F===62?(e.consume(F),n.interrupt?t:B):s(F)}function g(F){return Bt(F)?(e.consume(F),g):I(F)}function b(F){return F===47?(e.consume(F),I):F===58||F===95||zn(F)?(e.consume(F),k):Bt(F)?(e.consume(F),b):I(F)}function k(F){return F===45||F===46||F===58||F===95||Us(F)?(e.consume(F),k):E(F)}function E(F){return F===61?(e.consume(F),P):Bt(F)?(e.consume(F),E):b(F)}function P(F){return F===null||F===60||F===61||F===62||F===96?s(F):F===34||F===39?(e.consume(F),d=F,A):Bt(F)?(e.consume(F),P):N(F)}function A(F){return F===d?(e.consume(F),d=null,M):F===null||dt(F)?s(F):(e.consume(F),A)}function N(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Rs(F)?E(F):(e.consume(F),N)}function M(F){return F===47||F===62||Bt(F)?b(F):s(F)}function I(F){return F===62?(e.consume(F),L):s(F)}function L(F){return F===null||dt(F)?B(F):Bt(F)?(e.consume(F),L):s(F)}function B(F){return F===45&&o===2?(e.consume(F),U):F===60&&o===1?(e.consume(F),X):F===62&&o===4?(e.consume(F),$):F===63&&o===3?(e.consume(F),R):F===93&&o===5?(e.consume(F),O):dt(F)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(C9,G,z)(F)):F===null||dt(F)?(e.exit("htmlFlowData"),z(F)):(e.consume(F),B)}function z(F){return e.check(S9,Y,G)(F)}function Y(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),H}function H(F){return F===null||dt(F)?z(F):(e.enter("htmlFlowData"),B(F))}function U(F){return F===45?(e.consume(F),R):B(F)}function X(F){return F===47?(e.consume(F),u="",q):B(F)}function q(F){if(F===62){const te=u.toLowerCase();return Gw.includes(te)?(e.consume(F),$):B(F)}return zn(F)&&u.length<8?(e.consume(F),u+=String.fromCharCode(F),q):B(F)}function O(F){return F===93?(e.consume(F),R):B(F)}function R(F){return F===62?(e.consume(F),$):F===45&&o===2?(e.consume(F),R):B(F)}function $(F){return F===null||dt(F)?(e.exit("htmlFlowData"),G(F)):(e.consume(F),$)}function G(F){return e.exit("htmlFlow"),t(F)}}function N9(e,t,s){const n=this;return o;function o(u){return dt(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):s(u)}function c(u){return n.parser.lazy[n.now().line]?s(u):t(u)}}function E9(e,t,s){return n;function n(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(kh,t,s)}}const P9={name:"htmlText",tokenize:A9};function A9(e,t,s){const n=this;let o,c,u;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),d}function d(R){return R===33?(e.consume(R),f):R===47?(e.consume(R),E):R===63?(e.consume(R),b):zn(R)?(e.consume(R),N):s(R)}function f(R){return R===45?(e.consume(R),m):R===91?(e.consume(R),c=0,j):zn(R)?(e.consume(R),g):s(R)}function m(R){return R===45?(e.consume(R),w):s(R)}function h(R){return R===null?s(R):R===45?(e.consume(R),x):dt(R)?(u=h,X(R)):(e.consume(R),h)}function x(R){return R===45?(e.consume(R),w):h(R)}function w(R){return R===62?U(R):R===45?x(R):h(R)}function j(R){const $="CDATA[";return R===$.charCodeAt(c++)?(e.consume(R),c===$.length?C:j):s(R)}function C(R){return R===null?s(R):R===93?(e.consume(R),v):dt(R)?(u=C,X(R)):(e.consume(R),C)}function v(R){return R===93?(e.consume(R),y):C(R)}function y(R){return R===62?U(R):R===93?(e.consume(R),y):C(R)}function g(R){return R===null||R===62?U(R):dt(R)?(u=g,X(R)):(e.consume(R),g)}function b(R){return R===null?s(R):R===63?(e.consume(R),k):dt(R)?(u=b,X(R)):(e.consume(R),b)}function k(R){return R===62?U(R):b(R)}function E(R){return zn(R)?(e.consume(R),P):s(R)}function P(R){return R===45||Us(R)?(e.consume(R),P):A(R)}function A(R){return dt(R)?(u=A,X(R)):Bt(R)?(e.consume(R),A):U(R)}function N(R){return R===45||Us(R)?(e.consume(R),N):R===47||R===62||Rs(R)?M(R):s(R)}function M(R){return R===47?(e.consume(R),U):R===58||R===95||zn(R)?(e.consume(R),I):dt(R)?(u=M,X(R)):Bt(R)?(e.consume(R),M):U(R)}function I(R){return R===45||R===46||R===58||R===95||Us(R)?(e.consume(R),I):L(R)}function L(R){return R===61?(e.consume(R),B):dt(R)?(u=L,X(R)):Bt(R)?(e.consume(R),L):M(R)}function B(R){return R===null||R===60||R===61||R===62||R===96?s(R):R===34||R===39?(e.consume(R),o=R,z):dt(R)?(u=B,X(R)):Bt(R)?(e.consume(R),B):(e.consume(R),Y)}function z(R){return R===o?(e.consume(R),o=void 0,H):R===null?s(R):dt(R)?(u=z,X(R)):(e.consume(R),z)}function Y(R){return R===null||R===34||R===39||R===60||R===61||R===96?s(R):R===47||R===62||Rs(R)?M(R):(e.consume(R),Y)}function H(R){return R===47||R===62||Rs(R)?M(R):s(R)}function U(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):s(R)}function X(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),q}function q(R){return Bt(R)?Yt(e,O,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):O(R)}function O(R){return e.enter("htmlTextData"),u(R)}}const Ox={name:"labelEnd",resolveAll:D9,resolveTo:I9,tokenize:L9},T9={tokenize:O9},R9={tokenize:F9},M9={tokenize:B9};function D9(e){let t=-1;const s=[];for(;++t<e.length;){const n=e[t][1];if(s.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const o=n.type==="labelImage"?4:2;n.type="data",t+=o}}return e.length!==s.length&&Yn(e,0,e.length,s),e}function I9(e,t){let s=e.length,n=0,o,c,u,l;for(;s--;)if(o=e[s][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[s][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(u){if(e[s][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(c=s,o.type!=="labelLink")){n=2;break}}else o.type==="labelEnd"&&(u=s);const d={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},m={type:"labelText",start:{...e[c+n+2][1].end},end:{...e[u-2][1].start}};return l=[["enter",d,t],["enter",f,t]],l=an(l,e.slice(c+1,c+n+3)),l=an(l,[["enter",m,t]]),l=an(l,Lx(t.parser.constructs.insideSpan.null,e.slice(c+n+4,u-3),t)),l=an(l,[["exit",m,t],e[u-2],e[u-1],["exit",f,t]]),l=an(l,e.slice(u+1)),l=an(l,[["exit",d,t]]),Yn(e,c,e.length,l),e}function L9(e,t,s){const n=this;let o=n.events.length,c,u;for(;o--;)if((n.events[o][1].type==="labelImage"||n.events[o][1].type==="labelLink")&&!n.events[o][1]._balanced){c=n.events[o][1];break}return l;function l(x){return c?c._inactive?h(x):(u=n.parser.defined.includes(Fa(n.sliceSerialize({start:c.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),d):s(x)}function d(x){return x===40?e.attempt(T9,m,u?m:h)(x):x===91?e.attempt(R9,m,u?f:h)(x):u?m(x):h(x)}function f(x){return e.attempt(M9,m,h)(x)}function m(x){return t(x)}function h(x){return c._balanced=!0,s(x)}}function O9(e,t,s){return n;function n(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),o}function o(h){return Rs(h)?ic(e,c)(h):c(h)}function c(h){return h===41?m(h):FN(e,u,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function u(h){return Rs(h)?ic(e,d)(h):m(h)}function l(h){return s(h)}function d(h){return h===34||h===39||h===40?$N(e,f,s,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):m(h)}function f(h){return Rs(h)?ic(e,m)(h):m(h)}function m(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):s(h)}}function F9(e,t,s){const n=this;return o;function o(l){return BN.call(n,e,c,u,"reference","referenceMarker","referenceString")(l)}function c(l){return n.parser.defined.includes(Fa(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):s(l)}function u(l){return s(l)}}function B9(e,t,s){return n;function n(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),o}function o(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):s(c)}}const $9={name:"labelStartImage",resolveAll:Ox.resolveAll,tokenize:z9};function z9(e,t,s){const n=this;return o;function o(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),c}function c(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),u):s(l)}function u(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?s(l):t(l)}}const H9={name:"labelStartLink",resolveAll:Ox.resolveAll,tokenize:W9};function W9(e,t,s){const n=this;return o;function o(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in n.parser.constructs?s(u):t(u)}}const Vm={name:"lineEnding",tokenize:V9};function V9(e,t){return s;function s(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Yt(e,t,"linePrefix")}}const xu={name:"thematicBreak",tokenize:U9};function U9(e,t,s){let n=0,o;return c;function c(f){return e.enter("thematicBreak"),u(f)}function u(f){return o=f,l(f)}function l(f){return f===o?(e.enter("thematicBreakSequence"),d(f)):n>=3&&(f===null||dt(f))?(e.exit("thematicBreak"),t(f)):s(f)}function d(f){return f===o?(e.consume(f),n++,d):(e.exit("thematicBreakSequence"),Bt(f)?Yt(e,l,"whitespace")(f):l(f))}}const Ps={continuation:{tokenize:Y9},exit:X9,name:"list",tokenize:K9},G9={partial:!0,tokenize:Q9},q9={partial:!0,tokenize:J9};function K9(e,t,s){const n=this,o=n.events[n.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,u=0;return l;function l(w){const j=n.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!n.containerState.marker||w===n.containerState.marker:Hp(w)){if(n.containerState.type||(n.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(xu,s,f)(w):f(w);if(!n.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(w)}return s(w)}function d(w){return Hp(w)&&++u<10?(e.consume(w),d):(!n.interrupt||u<2)&&(n.containerState.marker?w===n.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),f(w)):s(w)}function f(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||w,e.check(kh,n.interrupt?s:m,e.attempt(G9,x,h))}function m(w){return n.containerState.initialBlankLine=!0,c++,x(w)}function h(w){return Bt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),x):s(w)}function x(w){return n.containerState.size=c+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function Y9(e,t,s){const n=this;return n.containerState._closeFlow=void 0,e.check(kh,o,c);function o(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Yt(e,t,"listItemIndent",n.containerState.size+1)(l)}function c(l){return n.containerState.furtherBlankLines||!Bt(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,u(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(q9,t,u)(l))}function u(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Yt(e,e.attempt(Ps,t,s),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function J9(e,t,s){const n=this;return Yt(e,o,"listItemIndent",n.containerState.size+1);function o(c){const u=n.events[n.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===n.containerState.size?t(c):s(c)}}function X9(e){e.exit(this.containerState.type)}function Q9(e,t,s){const n=this;return Yt(e,o,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const u=n.events[n.events.length-1];return!Bt(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):s(c)}}const qw={name:"setextUnderline",resolveTo:Z9,tokenize:e$};function Z9(e,t){let s=e.length,n,o,c;for(;s--;)if(e[s][0]==="enter"){if(e[s][1].type==="content"){n=s;break}e[s][1].type==="paragraph"&&(o=s)}else e[s][1].type==="content"&&e.splice(s,1),!c&&e[s][1].type==="definition"&&(c=s);const u={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",c?(e.splice(o,0,["enter",u,t]),e.splice(c+1,0,["exit",e[n][1],t]),e[n][1].end={...e[c][1].end}):e[n][1]=u,e.push(["exit",u,t]),e}function e$(e,t,s){const n=this;let o;return c;function c(f){let m=n.events.length,h;for(;m--;)if(n.events[m][1].type!=="lineEnding"&&n.events[m][1].type!=="linePrefix"&&n.events[m][1].type!=="content"){h=n.events[m][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(e.enter("setextHeadingLine"),o=f,u(f)):s(f)}function u(f){return e.enter("setextHeadingLineSequence"),l(f)}function l(f){return f===o?(e.consume(f),l):(e.exit("setextHeadingLineSequence"),Bt(f)?Yt(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||dt(f)?(e.exit("setextHeadingLine"),t(f)):s(f)}}const t$={tokenize:r$};function r$(e){const t=this,s=e.attempt(kh,n,e.attempt(this.parser.constructs.flowInitial,o,Yt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(a9,o)),"linePrefix")));return s;function n(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,s}function o(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,s}}const s$={resolveAll:HN()},n$=zN("string"),i$=zN("text");function zN(e){return{resolveAll:HN(e==="text"?o$:void 0),tokenize:t};function t(s){const n=this,o=this.parser.constructs[e],c=s.attempt(o,u,l);return u;function u(m){return f(m)?c(m):l(m)}function l(m){if(m===null){s.consume(m);return}return s.enter("data"),s.consume(m),d}function d(m){return f(m)?(s.exit("data"),c(m)):(s.consume(m),d)}function f(m){if(m===null)return!0;const h=o[m];let x=-1;if(h)for(;++x<h.length;){const w=h[x];if(!w.previous||w.previous.call(n,n.previous))return!0}return!1}}}function HN(e){return t;function t(s,n){let o=-1,c;for(;++o<=s.length;)c===void 0?s[o]&&s[o][1].type==="data"&&(c=o,o++):(!s[o]||s[o][1].type!=="data")&&(o!==c+2&&(s[c][1].end=s[o-1][1].end,s.splice(c+2,o-c-2),o=c+2),c=void 0);return e?e(s,n):s}}function o$(e,t){let s=0;for(;++s<=e.length;)if((s===e.length||e[s][1].type==="lineEnding")&&e[s-1][1].type==="data"){const n=e[s-1][1],o=t.sliceStream(n);let c=o.length,u=-1,l=0,d;for(;c--;){const f=o[c];if(typeof f=="string"){for(u=f.length;f.charCodeAt(u-1)===32;)l++,u--;if(u)break;u=-1}else if(f===-2)d=!0,l++;else if(f!==-1){c++;break}}if(t._contentTypeTextTrailing&&s===e.length&&(l=0),l){const f={type:s===e.length||d||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:n.start._bufferIndex+u,_index:n.start._index+c,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...f.start},n.start.offset===n.end.offset?Object.assign(n,f):(e.splice(s,0,["enter",f,t],["exit",f,t]),s+=2)}s++}return e}const a$={42:Ps,43:Ps,45:Ps,48:Ps,49:Ps,50:Ps,51:Ps,52:Ps,53:Ps,54:Ps,55:Ps,56:Ps,57:Ps,62:DN},l$={91:h9},c$={[-2]:Wm,[-1]:Wm,32:Wm},d$={35:v9,42:xu,45:[qw,xu],60:_9,61:qw,95:xu,96:Uw,126:Uw},u$={38:LN,92:IN},h$={[-5]:Vm,[-4]:Vm,[-3]:Vm,33:$9,38:LN,42:Wp,60:[H7,P9],91:H9,92:[g9,IN],93:Ox,95:Wp,96:t9},f$={null:[Wp,s$]},m$={null:[42,95]},p$={null:[]},g$=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:m$,contentInitial:l$,disable:p$,document:a$,flow:d$,flowInitial:c$,insideSpan:f$,string:u$,text:h$},Symbol.toStringTag,{value:"Module"}));function x$(e,t,s){let n={_bufferIndex:-1,_index:0,line:s&&s.line||1,column:s&&s.column||1,offset:s&&s.offset||0};const o={},c=[];let u=[],l=[];const d={attempt:A(E),check:A(P),consume:g,enter:b,exit:k,interrupt:A(P,{interrupt:!0})},f={code:null,containerState:{},defineSkip:C,events:[],now:j,parser:e,previous:null,sliceSerialize:x,sliceStream:w,write:h};let m=t.tokenize.call(f,d);return t.resolveAll&&c.push(t),f;function h(L){return u=an(u,L),v(),u[u.length-1]!==null?[]:(N(t,0),f.events=Lx(c,f.events,f),f.events)}function x(L,B){return y$(w(L),B)}function w(L){return v$(u,L)}function j(){const{_bufferIndex:L,_index:B,line:z,column:Y,offset:H}=n;return{_bufferIndex:L,_index:B,line:z,column:Y,offset:H}}function C(L){o[L.line]=L.column,I()}function v(){let L;for(;n._index<u.length;){const B=u[n._index];if(typeof B=="string")for(L=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===L&&n._bufferIndex<B.length;)y(B.charCodeAt(n._bufferIndex));else y(B)}}function y(L){m=m(L)}function g(L){dt(L)?(n.line++,n.column=1,n.offset+=L===-3?2:1,I()):L!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===u[n._index].length&&(n._bufferIndex=-1,n._index++)),f.previous=L}function b(L,B){const z=B||{};return z.type=L,z.start=j(),f.events.push(["enter",z,f]),l.push(z),z}function k(L){const B=l.pop();return B.end=j(),f.events.push(["exit",B,f]),B}function E(L,B){N(L,B.from)}function P(L,B){B.restore()}function A(L,B){return z;function z(Y,H,U){let X,q,O,R;return Array.isArray(Y)?G(Y):"tokenize"in Y?G([Y]):$(Y);function $(fe){return J;function J(W){const ae=W!==null&&fe[W],ne=W!==null&&fe.null,Z=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return G(Z)(W)}}function G(fe){return X=fe,q=0,fe.length===0?U:F(fe[q])}function F(fe){return J;function J(W){return R=M(),O=fe,fe.partial||(f.currentConstruct=fe),fe.name&&f.parser.constructs.disable.null.includes(fe.name)?ce():fe.tokenize.call(B?Object.assign(Object.create(f),B):f,d,te,ce)(W)}}function te(fe){return L(O,R),H}function ce(fe){return R.restore(),++q<X.length?F(X[q]):U}}}function N(L,B){L.resolveAll&&!c.includes(L)&&c.push(L),L.resolve&&Yn(f.events,B,f.events.length-B,L.resolve(f.events.slice(B),f)),L.resolveTo&&(f.events=L.resolveTo(f.events,f))}function M(){const L=j(),B=f.previous,z=f.currentConstruct,Y=f.events.length,H=Array.from(l);return{from:Y,restore:U};function U(){n=L,f.previous=B,f.currentConstruct=z,f.events.length=Y,l=H,I()}}function I(){n.line in o&&n.column<2&&(n.column=o[n.line],n.offset+=o[n.line]-1)}}function v$(e,t){const s=t.start._index,n=t.start._bufferIndex,o=t.end._index,c=t.end._bufferIndex;let u;if(s===o)u=[e[s].slice(n,c)];else{if(u=e.slice(s,o),n>-1){const l=u[0];typeof l=="string"?u[0]=l.slice(n):u.shift()}c>0&&u.push(e[o].slice(0,c))}return u}function y$(e,t){let s=-1;const n=[];let o;for(;++s<e.length;){const c=e[s];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
626
626
  `;break}case-3:{u=`\r
627
- `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&o)continue;u=" ";break}default:u=String.fromCharCode(c)}o=c===-2,n.push(u)}return n.join("")}function b$(e){const n={constructs:N7([g$,...(e||{}).extensions||[]]),content:o(I7),defined:[],document:o(O7),flow:o(t$),lazy:{},string:o(n$),text:o(i$)};return n;function o(c){return u;function u(l){return x$(n,c,l)}}}function w$(e){for(;!ON(e););return e}const Kw=/[\0\t\n\r]/g;function _$(){let e=1,t="",s=!0,n;return o;function o(c,u,l){const d=[];let f,m,h,x,w;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),h=0,t="",s&&(c.charCodeAt(0)===65279&&h++,s=void 0);h<c.length;){if(Kw.lastIndex=h,f=Kw.exec(c),x=f&&f.index!==void 0?f.index:c.length,w=c.charCodeAt(x),!f){t=c.slice(h);break}if(w===10&&h===x&&n)d.push(-3),n=void 0;else switch(n&&(d.push(-5),n=void 0),h<x&&(d.push(c.slice(h,x)),e+=x-h),w){case 0:{d.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,d.push(-2);e++<m;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:n=!0,e=1}h=x+1}return l&&(n&&d.push(-5),t&&d.push(t),d.push(null)),d}}const C$=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function S$(e){return e.replace(C$,k$)}function k$(e,t,s){if(t)return t;if(s.charCodeAt(0)===35){const o=s.charCodeAt(1),c=o===120||o===88;return MN(s.slice(c?2:1),c?16:10)}return Ix(s)||e}const WN={}.hasOwnProperty;function j$(e,t,s){return typeof t!="string"&&(s=t,t=void 0),N$(s)(w$(b$(s).document().write(_$()(e,t,!0))))}function N$(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Ke),autolinkProtocol:M,autolinkEmail:M,atxHeading:c(Ge),blockQuote:c(ne),characterEscape:M,characterReference:M,codeFenced:c(Z),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(Z,u),codeText:c(le,u),codeTextData:M,data:M,codeFlowValue:M,definition:c(Ce),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Le),hardBreakEscape:c(me),hardBreakTrailing:c(me),htmlFlow:c(be,u),htmlFlowData:M,htmlText:c(be,u),htmlTextData:M,image:c(Be),label:u,link:c(Ke),listItem:c(je),listItemValue:x,listOrdered:c(Qe,h),listUnordered:c(Qe),paragraph:c(we),reference:F,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(Ge),strong:c(ve),thematicBreak:c(Oe)},exit:{atxHeading:d(),atxHeadingSequence:E,autolink:d(),autolinkEmail:ae,autolinkProtocol:W,blockQuote:d(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:fe,characterReference:J,codeFenced:d(v),codeFencedFence:C,codeFencedFenceInfo:w,codeFencedFenceMeta:j,codeFlowValue:I,codeIndented:d(y),codeText:d(H),codeTextData:I,data:I,definition:d(),definitionDestinationString:k,definitionLabelString:g,definitionTitleString:b,emphasis:d(),hardBreakEscape:d(B),hardBreakTrailing:d(B),htmlFlow:d(z),htmlFlowData:I,htmlText:d(Y),htmlTextData:I,image:d(X),label:O,labelText:q,lineEnding:L,link:d(U),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:te,resourceDestinationString:R,resourceTitleString:$,resource:G,setextHeading:d(N),setextHeadingLineSequence:A,setextHeadingText:P,strong:d(),thematicBreak:d()}};VN(t,(e||{}).mdastExtensions||[]);const s={};return n;function n(de){let ye={type:"root",children:[]};const De={stack:[ye],tokenStack:[],config:t,enter:l,exit:f,buffer:u,resume:m,data:s},ze=[];let Je=-1;for(;++Je<de.length;)if(de[Je][1].type==="listOrdered"||de[Je][1].type==="listUnordered")if(de[Je][0]==="enter")ze.push(Je);else{const Et=ze.pop();Je=o(de,Et,Je)}for(Je=-1;++Je<de.length;){const Et=t[de[Je][0]];WN.call(Et,de[Je][1].type)&&Et[de[Je][1].type].call(Object.assign({sliceSerialize:de[Je][2].sliceSerialize},De),de[Je][1])}if(De.tokenStack.length>0){const Et=De.tokenStack[De.tokenStack.length-1];(Et[1]||Yw).call(De,void 0,Et[0])}for(ye.position={start:zi(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:zi(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},Je=-1;++Je<t.transforms.length;)ye=t.transforms[Je](ye)||ye;return ye}function o(de,ye,De){let ze=ye-1,Je=-1,Et=!1,at,ur,Rr,Wr;for(;++ze<=De;){const Jt=de[ze];switch(Jt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Jt[0]==="enter"?Je++:Je--,Wr=void 0;break}case"lineEndingBlank":{Jt[0]==="enter"&&(at&&!Wr&&!Je&&!Rr&&(Rr=ze),Wr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wr=void 0}if(!Je&&Jt[0]==="enter"&&Jt[1].type==="listItemPrefix"||Je===-1&&Jt[0]==="exit"&&(Jt[1].type==="listUnordered"||Jt[1].type==="listOrdered")){if(at){let Cr=ze;for(ur=void 0;Cr--;){const Wt=de[Cr];if(Wt[1].type==="lineEnding"||Wt[1].type==="lineEndingBlank"){if(Wt[0]==="exit")continue;ur&&(de[ur][1].type="lineEndingBlank",Et=!0),Wt[1].type="lineEnding",ur=Cr}else if(!(Wt[1].type==="linePrefix"||Wt[1].type==="blockQuotePrefix"||Wt[1].type==="blockQuotePrefixWhitespace"||Wt[1].type==="blockQuoteMarker"||Wt[1].type==="listItemIndent"))break}Rr&&(!ur||Rr<ur)&&(at._spread=!0),at.end=Object.assign({},ur?de[ur][1].start:Jt[1].end),de.splice(ur||ze,0,["exit",at,Jt[2]]),ze++,De++}if(Jt[1].type==="listItemPrefix"){const Cr={type:"listItem",_spread:!1,start:Object.assign({},Jt[1].start),end:void 0};at=Cr,de.splice(ze,0,["enter",Cr,Jt[2]]),ze++,De++,Rr=void 0,Wr=!0}}}return de[ye][1]._spread=Et,De}function c(de,ye){return De;function De(ze){l.call(this,de(ze),ze),ye&&ye.call(this,ze)}}function u(){this.stack.push({type:"fragment",children:[]})}function l(de,ye,De){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([ye,De||void 0]),de.position={start:zi(ye.start),end:void 0}}function d(de){return ye;function ye(De){de&&de.call(this,De),f.call(this,De)}}function f(de,ye){const De=this.stack.pop(),ze=this.tokenStack.pop();if(ze)ze[0].type!==de.type&&(ye?ye.call(this,de,ze[0]):(ze[1]||Yw).call(this,de,ze[0]));else throw new Error("Cannot close `"+de.type+"` ("+nc({start:de.start,end:de.end})+"): it’s not open");De.position.end=zi(de.end)}function m(){return k7(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function x(de){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function w(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=de}function j(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=de}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de.replace(/(\r?\n|\r)$/g,"")}function g(de){const ye=this.resume(),De=this.stack[this.stack.length-1];De.label=ye,De.identifier=Fa(this.sliceSerialize(de)).toLowerCase()}function b(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.title=de}function k(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.url=de}function E(de){const ye=this.stack[this.stack.length-1];if(!ye.depth){const De=this.sliceSerialize(de).length;ye.depth=De}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function A(de){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function N(){this.data.setextHeadingSlurpLineEnding=void 0}function M(de){const De=this.stack[this.stack.length-1].children;let ze=De[De.length-1];(!ze||ze.type!=="text")&&(ze=_e(),ze.position={start:zi(de.start),end:void 0},De.push(ze)),this.stack.push(ze)}function I(de){const ye=this.stack.pop();ye.value+=this.sliceSerialize(de),ye.position.end=zi(de.end)}function L(de){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=ye.children[ye.children.length-1];De.position.end=zi(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(M.call(this,de),I.call(this,de))}function B(){this.data.atHardBreak=!0}function z(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de}function Y(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de}function H(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de}function U(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ye,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function X(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ye,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function q(de){const ye=this.sliceSerialize(de),De=this.stack[this.stack.length-2];De.label=S$(ye),De.identifier=Fa(ye).toLowerCase()}function O(){const de=this.stack[this.stack.length-1],ye=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const ze=de.children;De.children=ze}else De.alt=ye}function R(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.url=de}function $(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.title=de}function G(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function te(de){const ye=this.resume(),De=this.stack[this.stack.length-1];De.label=ye,De.identifier=Fa(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function ce(de){this.data.characterReferenceType=de.type}function fe(de){const ye=this.sliceSerialize(de),De=this.data.characterReferenceType;let ze;De?(ze=MN(ye,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ze=Ix(ye);const Je=this.stack[this.stack.length-1];Je.value+=ze}function J(de){const ye=this.stack.pop();ye.position.end=zi(de.end)}function W(de){I.call(this,de);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(de)}function ae(de){I.call(this,de);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(de)}function ne(){return{type:"blockquote",children:[]}}function Z(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Le(){return{type:"emphasis",children:[]}}function Ge(){return{type:"heading",depth:0,children:[]}}function me(){return{type:"break"}}function be(){return{type:"html",value:""}}function Be(){return{type:"image",title:null,url:"",alt:null}}function Ke(){return{type:"link",title:null,url:"",children:[]}}function Qe(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function je(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function we(){return{type:"paragraph",children:[]}}function ve(){return{type:"strong",children:[]}}function _e(){return{type:"text",value:""}}function Oe(){return{type:"thematicBreak"}}}function zi(e){return{line:e.line,column:e.column,offset:e.offset}}function VN(e,t){let s=-1;for(;++s<t.length;){const n=t[s];Array.isArray(n)?VN(e,n):E$(e,n)}}function E$(e,t){let s;for(s in t)if(WN.call(t,s))switch(s){case"canContainEols":{const n=t[s];n&&e[s].push(...n);break}case"transforms":{const n=t[s];n&&e[s].push(...n);break}case"enter":case"exit":{const n=t[s];n&&Object.assign(e[s],n);break}}}function Yw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+nc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+nc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+nc({start:t.start,end:t.end})+") is still open")}function P$(e){const t=this;t.parser=s;function s(n){return j$(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function A$(e,t){const s={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,s),e.applyData(t,s)}function T$(e,t){const s={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,s),[e.applyData(t,s),{type:"text",value:`
627
+ `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&o)continue;u=" ";break}default:u=String.fromCharCode(c)}o=c===-2,n.push(u)}return n.join("")}function b$(e){const n={constructs:N7([g$,...(e||{}).extensions||[]]),content:o(I7),defined:[],document:o(O7),flow:o(t$),lazy:{},string:o(n$),text:o(i$)};return n;function o(c){return u;function u(l){return x$(n,c,l)}}}function w$(e){for(;!ON(e););return e}const Kw=/[\0\t\n\r]/g;function _$(){let e=1,t="",s=!0,n;return o;function o(c,u,l){const d=[];let f,m,h,x,w;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),h=0,t="",s&&(c.charCodeAt(0)===65279&&h++,s=void 0);h<c.length;){if(Kw.lastIndex=h,f=Kw.exec(c),x=f&&f.index!==void 0?f.index:c.length,w=c.charCodeAt(x),!f){t=c.slice(h);break}if(w===10&&h===x&&n)d.push(-3),n=void 0;else switch(n&&(d.push(-5),n=void 0),h<x&&(d.push(c.slice(h,x)),e+=x-h),w){case 0:{d.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,d.push(-2);e++<m;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:n=!0,e=1}h=x+1}return l&&(n&&d.push(-5),t&&d.push(t),d.push(null)),d}}const C$=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function S$(e){return e.replace(C$,k$)}function k$(e,t,s){if(t)return t;if(s.charCodeAt(0)===35){const o=s.charCodeAt(1),c=o===120||o===88;return MN(s.slice(c?2:1),c?16:10)}return Ix(s)||e}const WN={}.hasOwnProperty;function j$(e,t,s){return typeof t!="string"&&(s=t,t=void 0),N$(s)(w$(b$(s).document().write(_$()(e,t,!0))))}function N$(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Ke),autolinkProtocol:M,autolinkEmail:M,atxHeading:c(Ge),blockQuote:c(ne),characterEscape:M,characterReference:M,codeFenced:c(Z),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(Z,u),codeText:c(le,u),codeTextData:M,data:M,codeFlowValue:M,definition:c(Ce),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Le),hardBreakEscape:c(me),hardBreakTrailing:c(me),htmlFlow:c(be,u),htmlFlowData:M,htmlText:c(be,u),htmlTextData:M,image:c(Be),label:u,link:c(Ke),listItem:c(je),listItemValue:x,listOrdered:c(Qe,h),listUnordered:c(Qe),paragraph:c(we),reference:F,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(Ge),strong:c(ve),thematicBreak:c(Oe)},exit:{atxHeading:d(),atxHeadingSequence:E,autolink:d(),autolinkEmail:ae,autolinkProtocol:W,blockQuote:d(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:fe,characterReference:J,codeFenced:d(v),codeFencedFence:C,codeFencedFenceInfo:w,codeFencedFenceMeta:j,codeFlowValue:I,codeIndented:d(y),codeText:d(H),codeTextData:I,data:I,definition:d(),definitionDestinationString:k,definitionLabelString:g,definitionTitleString:b,emphasis:d(),hardBreakEscape:d(B),hardBreakTrailing:d(B),htmlFlow:d(z),htmlFlowData:I,htmlText:d(Y),htmlTextData:I,image:d(X),label:O,labelText:q,lineEnding:L,link:d(U),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:te,resourceDestinationString:R,resourceTitleString:$,resource:G,setextHeading:d(N),setextHeadingLineSequence:A,setextHeadingText:P,strong:d(),thematicBreak:d()}};VN(t,(e||{}).mdastExtensions||[]);const s={};return n;function n(de){let ye={type:"root",children:[]};const Re={stack:[ye],tokenStack:[],config:t,enter:l,exit:f,buffer:u,resume:m,data:s},ze=[];let Je=-1;for(;++Je<de.length;)if(de[Je][1].type==="listOrdered"||de[Je][1].type==="listUnordered")if(de[Je][0]==="enter")ze.push(Je);else{const Et=ze.pop();Je=o(de,Et,Je)}for(Je=-1;++Je<de.length;){const Et=t[de[Je][0]];WN.call(Et,de[Je][1].type)&&Et[de[Je][1].type].call(Object.assign({sliceSerialize:de[Je][2].sliceSerialize},Re),de[Je][1])}if(Re.tokenStack.length>0){const Et=Re.tokenStack[Re.tokenStack.length-1];(Et[1]||Yw).call(Re,void 0,Et[0])}for(ye.position={start:zi(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:zi(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},Je=-1;++Je<t.transforms.length;)ye=t.transforms[Je](ye)||ye;return ye}function o(de,ye,Re){let ze=ye-1,Je=-1,Et=!1,at,ur,Rr,Wr;for(;++ze<=Re;){const Jt=de[ze];switch(Jt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Jt[0]==="enter"?Je++:Je--,Wr=void 0;break}case"lineEndingBlank":{Jt[0]==="enter"&&(at&&!Wr&&!Je&&!Rr&&(Rr=ze),Wr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wr=void 0}if(!Je&&Jt[0]==="enter"&&Jt[1].type==="listItemPrefix"||Je===-1&&Jt[0]==="exit"&&(Jt[1].type==="listUnordered"||Jt[1].type==="listOrdered")){if(at){let Cr=ze;for(ur=void 0;Cr--;){const Wt=de[Cr];if(Wt[1].type==="lineEnding"||Wt[1].type==="lineEndingBlank"){if(Wt[0]==="exit")continue;ur&&(de[ur][1].type="lineEndingBlank",Et=!0),Wt[1].type="lineEnding",ur=Cr}else if(!(Wt[1].type==="linePrefix"||Wt[1].type==="blockQuotePrefix"||Wt[1].type==="blockQuotePrefixWhitespace"||Wt[1].type==="blockQuoteMarker"||Wt[1].type==="listItemIndent"))break}Rr&&(!ur||Rr<ur)&&(at._spread=!0),at.end=Object.assign({},ur?de[ur][1].start:Jt[1].end),de.splice(ur||ze,0,["exit",at,Jt[2]]),ze++,Re++}if(Jt[1].type==="listItemPrefix"){const Cr={type:"listItem",_spread:!1,start:Object.assign({},Jt[1].start),end:void 0};at=Cr,de.splice(ze,0,["enter",Cr,Jt[2]]),ze++,Re++,Rr=void 0,Wr=!0}}}return de[ye][1]._spread=Et,Re}function c(de,ye){return Re;function Re(ze){l.call(this,de(ze),ze),ye&&ye.call(this,ze)}}function u(){this.stack.push({type:"fragment",children:[]})}function l(de,ye,Re){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([ye,Re||void 0]),de.position={start:zi(ye.start),end:void 0}}function d(de){return ye;function ye(Re){de&&de.call(this,Re),f.call(this,Re)}}function f(de,ye){const Re=this.stack.pop(),ze=this.tokenStack.pop();if(ze)ze[0].type!==de.type&&(ye?ye.call(this,de,ze[0]):(ze[1]||Yw).call(this,de,ze[0]));else throw new Error("Cannot close `"+de.type+"` ("+nc({start:de.start,end:de.end})+"): it’s not open");Re.position.end=zi(de.end)}function m(){return k7(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function x(de){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function w(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=de}function j(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=de}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de.replace(/(\r?\n|\r)$/g,"")}function g(de){const ye=this.resume(),Re=this.stack[this.stack.length-1];Re.label=ye,Re.identifier=Fa(this.sliceSerialize(de)).toLowerCase()}function b(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.title=de}function k(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.url=de}function E(de){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Re=this.sliceSerialize(de).length;ye.depth=Re}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function A(de){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function N(){this.data.setextHeadingSlurpLineEnding=void 0}function M(de){const Re=this.stack[this.stack.length-1].children;let ze=Re[Re.length-1];(!ze||ze.type!=="text")&&(ze=_e(),ze.position={start:zi(de.start),end:void 0},Re.push(ze)),this.stack.push(ze)}function I(de){const ye=this.stack.pop();ye.value+=this.sliceSerialize(de),ye.position.end=zi(de.end)}function L(de){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=ye.children[ye.children.length-1];Re.position.end=zi(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(M.call(this,de),I.call(this,de))}function B(){this.data.atHardBreak=!0}function z(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de}function Y(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de}function H(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.value=de}function U(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ye,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function X(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ye,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function q(de){const ye=this.sliceSerialize(de),Re=this.stack[this.stack.length-2];Re.label=S$(ye),Re.identifier=Fa(ye).toLowerCase()}function O(){const de=this.stack[this.stack.length-1],ye=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const ze=de.children;Re.children=ze}else Re.alt=ye}function R(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.url=de}function $(){const de=this.resume(),ye=this.stack[this.stack.length-1];ye.title=de}function G(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function te(de){const ye=this.resume(),Re=this.stack[this.stack.length-1];Re.label=ye,Re.identifier=Fa(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function ce(de){this.data.characterReferenceType=de.type}function fe(de){const ye=this.sliceSerialize(de),Re=this.data.characterReferenceType;let ze;Re?(ze=MN(ye,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ze=Ix(ye);const Je=this.stack[this.stack.length-1];Je.value+=ze}function J(de){const ye=this.stack.pop();ye.position.end=zi(de.end)}function W(de){I.call(this,de);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(de)}function ae(de){I.call(this,de);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(de)}function ne(){return{type:"blockquote",children:[]}}function Z(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Le(){return{type:"emphasis",children:[]}}function Ge(){return{type:"heading",depth:0,children:[]}}function me(){return{type:"break"}}function be(){return{type:"html",value:""}}function Be(){return{type:"image",title:null,url:"",alt:null}}function Ke(){return{type:"link",title:null,url:"",children:[]}}function Qe(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function je(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function we(){return{type:"paragraph",children:[]}}function ve(){return{type:"strong",children:[]}}function _e(){return{type:"text",value:""}}function Oe(){return{type:"thematicBreak"}}}function zi(e){return{line:e.line,column:e.column,offset:e.offset}}function VN(e,t){let s=-1;for(;++s<t.length;){const n=t[s];Array.isArray(n)?VN(e,n):E$(e,n)}}function E$(e,t){let s;for(s in t)if(WN.call(t,s))switch(s){case"canContainEols":{const n=t[s];n&&e[s].push(...n);break}case"transforms":{const n=t[s];n&&e[s].push(...n);break}case"enter":case"exit":{const n=t[s];n&&Object.assign(e[s],n);break}}}function Yw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+nc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+nc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+nc({start:t.start,end:t.end})+") is still open")}function P$(e){const t=this;t.parser=s;function s(n){return j$(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function A$(e,t){const s={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,s),e.applyData(t,s)}function T$(e,t){const s={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,s),[e.applyData(t,s),{type:"text",value:`
628
628
  `}]}function R$(e,t){const s=t.value?t.value+`
629
629
  `:"",n={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(n.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:n,children:[{type:"text",value:s}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function M$(e,t){const s={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function D$(e,t){const s={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function I$(e,t){const s=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),o=ol(n.toLowerCase()),c=e.footnoteOrder.indexOf(n);let u,l=e.footnoteCounts.get(n);l===void 0?(l=0,e.footnoteOrder.push(n),u=e.footnoteOrder.length):u=c+1,l+=1,e.footnoteCounts.set(n,l);const d={type:"element",tagName:"a",properties:{href:"#"+s+"fn-"+o,id:s+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function L$(e,t){const s={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function O$(e,t){if(e.options.allowDangerousHtml){const s={type:"raw",value:t.value};return e.patch(t,s),e.applyData(t,s)}}function UN(e,t){const s=t.referenceType;let n="]";if(s==="collapsed"?n+="[]":s==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const o=e.all(t),c=o[0];c&&c.type==="text"?c.value="["+c.value:o.unshift({type:"text",value:"["});const u=o[o.length-1];return u&&u.type==="text"?u.value+=n:o.push({type:"text",value:n}),o}function F$(e,t){const s=String(t.identifier).toUpperCase(),n=e.definitionById.get(s);if(!n)return UN(e,t);const o={src:ol(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(o.title=n.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,c),e.applyData(t,c)}function B$(e,t){const s={src:ol(t.url)};t.alt!==null&&t.alt!==void 0&&(s.alt=t.alt),t.title!==null&&t.title!==void 0&&(s.title=t.title);const n={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,n),e.applyData(t,n)}function $$(e,t){const s={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,s);const n={type:"element",tagName:"code",properties:{},children:[s]};return e.patch(t,n),e.applyData(t,n)}function z$(e,t){const s=String(t.identifier).toUpperCase(),n=e.definitionById.get(s);if(!n)return UN(e,t);const o={href:ol(n.url||"")};n.title!==null&&n.title!==void 0&&(o.title=n.title);const c={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function H$(e,t){const s={href:ol(t.url)};t.title!==null&&t.title!==void 0&&(s.title=t.title);const n={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function W$(e,t,s){const n=e.all(t),o=s?V$(s):GN(t),c={},u=[];if(typeof t.checked=="boolean"){const m=n[0];let h;m&&m.type==="element"&&m.tagName==="p"?h=m:(h={type:"element",tagName:"p",properties:{},children:[]},n.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const m=n[l];(o||l!==0||m.type!=="element"||m.tagName!=="p")&&u.push({type:"text",value:`
630
630
  `}),m.type==="element"&&m.tagName==="p"&&!o?u.push(...m.children):u.push(m)}const d=n[n.length-1];d&&(o||d.type!=="element"||d.tagName!=="p")&&u.push({type:"text",value:`
@@ -634,7 +634,7 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
634
634
  `});++n<e.length;)n&&s.push({type:"text",value:`
635
635
  `}),s.push(e[n]);return t&&e.length>0&&s.push({type:"text",value:`
636
636
  `}),s}function s_(e){let t=0,s=e.charCodeAt(t);for(;s===9||s===32;)t++,s=e.charCodeAt(t);return e.slice(t)}function n_(e,t){const s=yz(e,t),n=s.one(e,void 0),o=lz(s),c=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
637
- `},o),c}function Sz(e,t){return e&&"run"in e?async function(s,n){const o=n_(s,{file:n,...t});await e.run(o,n)}:function(s,n){return n_(s,{file:n,...e||t})}}function i_(e){if(e)throw e}var Um,o_;function kz(){if(o_)return Um;o_=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},c=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var m=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!h)return!1;var x;for(x in f);return typeof x>"u"||e.call(f,x)},u=function(f,m){s&&m.name==="__proto__"?s(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},l=function(f,m){if(m==="__proto__")if(e.call(f,m)){if(n)return n(f,m).value}else return;return f[m]};return Um=function d(){var f,m,h,x,w,j,C=arguments[0],v=1,y=arguments.length,g=!1;for(typeof C=="boolean"&&(g=C,C=arguments[1]||{},v=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});v<y;++v)if(f=arguments[v],f!=null)for(m in f)h=l(C,m),x=l(f,m),C!==x&&(g&&x&&(c(x)||(w=o(x)))?(w?(w=!1,j=h&&o(h)?h:[]):j=h&&c(h)?h:{},u(C,{name:m,newValue:d(g,j,x)})):typeof x<"u"&&u(C,{name:m,newValue:x}));return C},Um}var jz=kz();const Gm=wc(jz);function Up(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Nz(){const e=[],t={run:s,use:n};return t;function s(...o){let c=-1;const u=o.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);l(null,...o);function l(d,...f){const m=e[++c];let h=-1;if(d){u(d);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,m?Ez(m,l)(...f):u(null,...f)}}function n(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function Ez(e,t){let s;return n;function n(...u){const l=e.length>u.length;let d;l&&u.push(o);try{d=e.apply(this,u)}catch(f){const m=f;if(l&&s)throw m;return o(m)}l||(d&&d.then&&typeof d.then=="function"?d.then(c,o):d instanceof Error?o(d):c(d))}function o(u,...l){s||(s=!0,t(u,...l))}function c(u){o(null,u)}}const Fn={basename:Pz,dirname:Az,extname:Tz,join:Rz,sep:"/"};function Pz(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Wc(e);let s=0,n=-1,o=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){s=o+1;break}}else n<0&&(c=!0,n=o+1);return n<0?"":e.slice(s,n)}if(t===e)return"";let u=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){s=o+1;break}}else u<0&&(c=!0,u=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(n=o):(l=-1,n=u));return s===n?n=u:n<0&&(n=e.length),e.slice(s,n)}function Az(e){if(Wc(e),e.length===0)return".";let t=-1,s=e.length,n;for(;--s;)if(e.codePointAt(s)===47){if(n){t=s;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Tz(e){Wc(e);let t=e.length,s=-1,n=0,o=-1,c=0,u;for(;t--;){const l=e.codePointAt(t);if(l===47){if(u){n=t+1;break}continue}s<0&&(u=!0,s=t+1),l===46?o<0?o=t:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||s<0||c===0||c===1&&o===s-1&&o===n+1?"":e.slice(o,s)}function Rz(...e){let t=-1,s;for(;++t<e.length;)Wc(e[t]),e[t]&&(s=s===void 0?e[t]:s+"/"+e[t]);return s===void 0?".":Mz(s)}function Mz(e){Wc(e);const t=e.codePointAt(0)===47;let s=Dz(e,!t);return s.length===0&&!t&&(s="."),s.length>0&&e.codePointAt(e.length-1)===47&&(s+="/"),t?"/"+s:s}function Dz(e,t){let s="",n=0,o=-1,c=0,u=-1,l,d;for(;++u<=e.length;){if(u<e.length)l=e.codePointAt(u);else{if(l===47)break;l=47}if(l===47){if(!(o===u-1||c===1))if(o!==u-1&&c===2){if(s.length<2||n!==2||s.codePointAt(s.length-1)!==46||s.codePointAt(s.length-2)!==46){if(s.length>2){if(d=s.lastIndexOf("/"),d!==s.length-1){d<0?(s="",n=0):(s=s.slice(0,d),n=s.length-1-s.lastIndexOf("/")),o=u,c=0;continue}}else if(s.length>0){s="",n=0,o=u,c=0;continue}}t&&(s=s.length>0?s+"/..":"..",n=2)}else s.length>0?s+="/"+e.slice(o+1,u):s=e.slice(o+1,u),n=u-o-1;o=u,c=0}else l===46&&c>-1?c++:c=-1}return s}function Wc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Iz={cwd:Lz};function Lz(){return"/"}function Gp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Oz(e){if(typeof e=="string")e=new URL(e);else if(!Gp(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Fz(e)}function Fz(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let s=-1;for(;++s<t.length;)if(t.codePointAt(s)===37&&t.codePointAt(s+1)===50){const n=t.codePointAt(s+2);if(n===70||n===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const qm=["history","path","basename","stem","extname","dirname"];class ZN{constructor(t){let s;t?Gp(t)?s={path:t}:typeof t=="string"||Bz(t)?s={value:t}:s=t:s={},this.cwd="cwd"in s?"":Iz.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<qm.length;){const c=qm[n];c in s&&s[c]!==void 0&&s[c]!==null&&(this[c]=c==="history"?[...s[c]]:s[c])}let o;for(o in s)qm.includes(o)||(this[o]=s[o])}get basename(){return typeof this.path=="string"?Fn.basename(this.path):void 0}set basename(t){Ym(t,"basename"),Km(t,"basename"),this.path=Fn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Fn.dirname(this.path):void 0}set dirname(t){a_(this.basename,"dirname"),this.path=Fn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Fn.extname(this.path):void 0}set extname(t){if(Km(t,"extname"),a_(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Fn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Gp(t)&&(t=Oz(t)),Ym(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Fn.basename(this.path,this.extname):void 0}set stem(t){Ym(t,"stem"),Km(t,"stem"),this.path=Fn.join(this.dirname||"",t+(this.extname||""))}fail(t,s,n){const o=this.message(t,s,n);throw o.fatal=!0,o}info(t,s,n){const o=this.message(t,s,n);return o.fatal=void 0,o}message(t,s,n){const o=new ds(t,s,n);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Km(e,t){if(e&&e.includes(Fn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Fn.sep+"`")}function Ym(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function a_(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Bz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $z=(function(e){const n=this.constructor.prototype,o=n[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,n),c}),zz={}.hasOwnProperty;class Hx extends $z{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Nz()}copy(){const t=new Hx;let s=-1;for(;++s<this.attachers.length;){const n=this.attachers[s];t.use(...n)}return t.data(Gm(!0,{},this.namespace)),t}data(t,s){return typeof t=="string"?arguments.length===2?(Qm("data",this.frozen),this.namespace[t]=s,this):zz.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Qm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[s,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const o=s.call(t,...n);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const s=au(t),n=this.parser||this.Parser;return Jm("parse",n),n(String(s),s)}process(t,s){const n=this;return this.freeze(),Jm("process",this.parser||this.Parser),Xm("process",this.compiler||this.Compiler),s?o(void 0,s):new Promise(o);function o(c,u){const l=au(t),d=n.parse(l);n.run(d,l,function(m,h,x){if(m||!h||!x)return f(m);const w=h,j=n.stringify(w,x);Vz(j)?x.value=j:x.result=j,f(m,x)});function f(m,h){m||!h?u(m):c?c(h):s(void 0,h)}}}processSync(t){let s=!1,n;return this.freeze(),Jm("processSync",this.parser||this.Parser),Xm("processSync",this.compiler||this.Compiler),this.process(t,o),c_("processSync","process",s),n;function o(c,u){s=!0,i_(c),n=u}}run(t,s,n){l_(t),this.freeze();const o=this.transformers;return!n&&typeof s=="function"&&(n=s,s=void 0),n?c(void 0,n):new Promise(c);function c(u,l){const d=au(s);o.run(t,d,f);function f(m,h,x){const w=h||t;m?l(m):u?u(w):n(void 0,w,x)}}}runSync(t,s){let n=!1,o;return this.run(t,s,c),c_("runSync","run",n),o;function c(u,l){i_(u),o=l,n=!0}}stringify(t,s){this.freeze();const n=au(s),o=this.compiler||this.Compiler;return Xm("stringify",o),l_(t),o(t,n)}use(t,...s){const n=this.attachers,o=this.namespace;if(Qm("use",this.frozen),t!=null)if(typeof t=="function")d(t,s);else if(typeof t=="object")Array.isArray(t)?l(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[m,...h]=f;d(m,h)}else u(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function u(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(f.plugins),f.settings&&(o.settings=Gm(!0,o.settings,f.settings))}function l(f){let m=-1;if(f!=null)if(Array.isArray(f))for(;++m<f.length;){const h=f[m];c(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,m){let h=-1,x=-1;for(;++h<n.length;)if(n[h][0]===f){x=h;break}if(x===-1)n.push([f,...m]);else if(m.length>0){let[w,...j]=m;const C=n[x][1];Up(C)&&Up(w)&&(w=Gm(!0,C,w)),n[x]=[f,w,...j]}}}}const Hz=new Hx().freeze();function Jm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Xm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Qm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function l_(e){if(!Up(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function c_(e,t,s){if(!s)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function au(e){return Wz(e)?e:new ZN(e)}function Wz(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Vz(e){return typeof e=="string"||Uz(e)}function Uz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Gz="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",d_=[],u_={allowDangerousHtml:!0},qz=/^(https?|ircs?|mailto|xmpp)$/i,Kz=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Yz(e){const t=Jz(e),s=Xz(e);return Qz(t.runSync(t.parse(s),s),e)}function Jz(e){const t=e.rehypePlugins||d_,s=e.remarkPlugins||d_,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...u_}:u_;return Hz().use(P$).use(s).use(Sz,n).use(t)}function Xz(e){const t=e.children||"",s=new ZN;return typeof t=="string"&&(s.value=t),s}function Qz(e,t){const s=t.allowedElements,n=t.allowElement,o=t.components,c=t.disallowedElements,u=t.skipHtml,l=t.unwrapDisallowed,d=t.urlTransform||Zz;for(const m of Kz)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Gz+m.id,void 0);return QN(e,f),l7(e,{Fragment:r.Fragment,components:o,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function f(m,h,x){if(m.type==="raw"&&x&&typeof h=="number")return u?x.children.splice(h,1):x.children[h]={type:"text",value:m.value},h;if(m.type==="element"){let w;for(w in Hm)if(Object.hasOwn(Hm,w)&&Object.hasOwn(m.properties,w)){const j=m.properties[w],C=Hm[w];(C===null||C.includes(m.tagName))&&(m.properties[w]=d(String(j||""),w,m))}}if(m.type==="element"){let w=s?!s.includes(m.tagName):c?c.includes(m.tagName):!1;if(!w&&n&&typeof h=="number"&&(w=!n(m,h,x)),w&&x&&typeof h=="number")return l&&m.children?x.children.splice(h,1,...m.children):x.children.splice(h,1),h}}}function Zz(e){const t=e.indexOf(":"),s=e.indexOf("?"),n=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||s!==-1&&t>s||n!==-1&&t>n||qz.test(e.slice(0,t))?e:""}function eH({onConfigChange:e}){var R,$,G;const[t,s]=_.useState(null),[n,o]=_.useState(""),[c,u]=_.useState({open:!1,field:null,type:"directory"}),[l,d]=_.useState(!0),[f,m]=_.useState(!1),[h,x]=_.useState(null),[w,j]=_.useState(!1),[C,v]=_.useState(null),[y,g]=_.useState([]),[b,k]=_.useState({open:!1,content:"",loading:!1}),[E,P]=_.useState({open:!1,feature:null}),[A,N]=_.useState({open:!1});_.useEffect(()=>{H(),M(),I()},[]);const M=async()=>{try{const F=await ue.checkVersion();x(F)}catch(F){console.error("Failed to load version info:",F)}},I=async()=>{try{const F=await ue.getProject();v(F.dir),L(F.dir)}catch(F){console.error("Failed to load project info:",F)}},L=async F=>{if(F)try{const te=await ue.getHiddenSubprojects(F);g(te.hidden||[])}catch(te){console.error("Failed to load hidden sub-projects:",te)}},B=async F=>{if(C)try{const te=await ue.unhideSubproject(C,F);te.success?(K.success("Sub-project unhidden"),L(C)):K.error(te.error||"Failed to unhide")}catch(te){K.error("Failed to unhide: "+te.message)}},z=async()=>{if(!(h!=null&&h.updateAvailable)){K.error("No update available");return}j(!0);try{const F=await ue.performUpdate({updateMethod:h.updateMethod,sourcePath:h.sourcePath});if(F.success){K.success(`Updated to v${F.newVersion}! Restarting server...`);try{await ue.restartServer()}catch{}let te=0;const ce=setInterval(async()=>{te++;try{await ue.checkVersion(),clearInterval(ce),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{te>30&&(clearInterval(ce),K.info("Server restarting. Please refresh the page."),j(!1))}},500)}else K.error("Update failed: "+F.error),j(!1)}catch(F){K.error("Update failed: "+F.message),j(!1)}},Y=async()=>{k(F=>({...F,open:!0,loading:!0}));try{const F=await ue.getChangelog();F.success?k(te=>({...te,content:F.content,loading:!1})):(K.error("Failed to load changelog"),k(te=>({...te,open:!1,loading:!1})))}catch(F){K.error("Failed to load changelog: "+F.message),k(te=>({...te,open:!1,loading:!1}))}},H=async()=>{try{d(!0);const F=await ue.getConfig();s(F.config),o(F.path)}catch{K.error("Failed to load settings")}finally{d(!1)}},U=async()=>{m(!0);try{await ue.saveConfig(t),K.success("Preferences saved!")}catch{K.error("Failed to save preferences")}finally{m(!1)}},X=(F,te)=>{s(ce=>({...ce,[F]:te}))},q=(F,te,ce)=>{s(fe=>({...fe,[F]:{...fe[F],[te]:ce}}))},O=async F=>{const te=(t==null?void 0:t.enabledTools)||["claude"];let ce;if(te.includes(F)){if(te.length<=1){K.error("At least one tool must be enabled");return}ce=te.filter(J=>J!==F)}else ce=[...te,F];const fe={...t,enabledTools:ce};s(fe);try{await ue.saveConfig(fe),e==null||e(fe);const J={claude:"Claude Code",gemini:"Gemini CLI",antigravity:"Antigravity",codex:"Codex CLI"}[F]||F;K.success(`${J} ${ce.includes(F)?"enabled":"disabled"}`)}catch{s(t),K.error("Failed to save preference")}};return l?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-muted flex items-center justify-center",children:r.jsx(cS,{className:"w-5 h-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"coder-config Preferences"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tool settings for this configuration manager"})]})]}),r.jsxs("div",{className:"bg-card rounded-xl border border-border p-6 shadow-sm",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("div",{children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded",children:n})]})}),r.jsxs(re,{onClick:U,disabled:f,children:[f?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(Ms,{className:"w-4 h-4 mr-2"}),"Save"]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Kr,{className:"w-4 h-4"}),"Directories"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"MCP Tools Directories"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Folders containing local MCP tool repositories for discovery"}),r.jsxs("div",{className:"space-y-2",children:[((t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[])).map((F,te)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:F||"",onChange:ce=>{const fe=[...(t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[])];fe[te]=ce.target.value,X("toolsDirs",fe),t!=null&&t.toolsDir&&s(J=>{const{toolsDir:W,...ae}=J;return{...ae,toolsDirs:fe}})},placeholder:"~/mcp-tools",className:"font-mono flex-1"}),r.jsx(re,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:te}),title:"Browse...",children:r.jsx(Ki,{className:"w-4 h-4"})}),r.jsx(re,{variant:"outline",size:"icon",onClick:()=>{const fe=((t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[])).filter((J,W)=>W!==te);s(J=>{const{toolsDir:W,...ae}=J;return{...ae,toolsDirs:fe.length>0?fe:void 0}})},title:"Remove",className:"text-destructive hover:text-destructive",children:r.jsx(hi,{className:"w-4 h-4"})})]},te)),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:-1}),className:"mt-2",children:[r.jsx(ui,{className:"w-4 h-4 mr-2"}),"Add Tools Folder"]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Global Registry Path"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Path to the global MCP registry file"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:(t==null?void 0:t.registryPath)||"",onChange:F=>X("registryPath",F.target.value),placeholder:"~/.claude/registry.json",className:"font-mono flex-1"}),r.jsx(re,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"registryPath",type:"file"}),title:"Browse...",children:r.jsx(Ki,{className:"w-4 h-4"})})]})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(DM,{className:"w-4 h-4"}),"User Interface"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Port"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Port for the web UI server"}),r.jsx(lt,{type:"number",value:((R=t==null?void 0:t.ui)==null?void 0:R.port)||3333,onChange:F=>q("ui","port",parseInt(F.target.value)||3333),placeholder:"3333",className:"w-32"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Open Browser on Start"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically open browser when starting the UI"})]}),r.jsx(vt,{checked:(($=t==null?void 0:t.ui)==null?void 0:$.openBrowser)??!0,onCheckedChange:F=>q("ui","openBrowser",F)})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(x5,{className:"w-4 h-4"}),"AI Assistant"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Choose which AI assistant to use for features like MCP creation and tool import."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${((t==null?void 0:t.aiAssistant)||"claude")==="claude"?"border-orange-500 bg-orange-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>X("aiAssistant","claude"),children:[r.jsx("input",{type:"radio",name:"aiAssistant",value:"claude",checked:((t==null?void 0:t.aiAssistant)||"claude")==="claude",onChange:()=>X("aiAssistant","claude"),className:"sr-only"}),r.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-orange-500"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Command: ",r.jsx("code",{className:"text-xs",children:"claude"})]})]}),((t==null?void 0:t.aiAssistant)||"claude")==="claude"&&r.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${(t==null?void 0:t.aiAssistant)==="gemini"?"border-blue-500 bg-blue-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>X("aiAssistant","gemini"),children:[r.jsx("input",{type:"radio",name:"aiAssistant",value:"gemini",checked:(t==null?void 0:t.aiAssistant)==="gemini",onChange:()=>X("aiAssistant","gemini"),className:"sr-only"}),r.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:r.jsx(Kt,{className:"w-4 h-4 text-blue-500"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI coding assistant • Command: ",r.jsx("code",{className:"text-xs",children:"gemini"})]})]}),(t==null?void 0:t.aiAssistant)==="gemini"&&r.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(z5,{className:"w-4 h-4"}),"Enabled AI Tools"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Select which AI coding tools to generate MCP configurations for. The Apply button will update all enabled tools."}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-orange-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:".mcp.json"})]})]})]}),r.jsx(vt,{checked:((t==null?void 0:t.enabledTools)||["claude"]).includes("claude"),onCheckedChange:()=>O("claude")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-blue-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's terminal AI coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:"~/.gemini/settings.json"})]})]})]}),r.jsx(vt,{checked:((t==null?void 0:t.enabledTools)||["claude"]).includes("gemini"),onCheckedChange:()=>O("gemini")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-purple-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-purple-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Antigravity"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI IDE • Output: ",r.jsx("code",{className:"text-xs",children:"~/.gemini/antigravity/mcp_config.json"})]})]})]}),r.jsx(vt,{checked:((t==null?void 0:t.enabledTools)||["claude"]).includes("antigravity"),onCheckedChange:()=>O("antigravity")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-green-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-green-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Codex CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["OpenAI's terminal coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:".codex/mcp.json"})]})]})]}),r.jsx(vt,{checked:((t==null?void 0:t.enabledTools)||["claude"]).includes("codex"),onCheckedChange:()=>O("codex")})]}),r.jsxs("p",{className:"text-xs text-muted-foreground italic",children:["Note: Antigravity does not support environment variable interpolation (",r.jsx("code",{children:"${VAR}"}),"). Variables are resolved to actual values when generating its config."]})]})]}),y.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(rS,{className:"w-4 h-4"}),"Hidden Sub-projects"]}),r.jsx("div",{className:"space-y-2",children:y.map(F=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Kr,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:F.name}),r.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:F.dir.replace(C+"/","")})]})]}),r.jsxs(re,{size:"sm",variant:"outline",onClick:()=>B(F.dir),className:"h-7",children:[r.jsx(Ag,{className:"w-3 h-3 mr-1"}),"Unhide"]})]},F.dir))})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(bm,{className:"w-4 h-4"}),"Experimental Features"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"These features are experimental and may change or be removed in future versions."}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg border border-yellow-500/20",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-yellow-500/10 flex items-center justify-center",children:r.jsx(bm,{className:"w-4 h-4 text-yellow-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Ralph Loops"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Autonomous development loops with Claude Code"})]})]}),r.jsx(vt,{checked:((G=t==null?void 0:t.experimental)==null?void 0:G.ralphLoops)||!1,onCheckedChange:F=>{if(F)P({open:!0,feature:"ralphLoops"});else{const te={...t,experimental:{...t==null?void 0:t.experimental,ralphLoops:!1}};s(te),ue.saveConfig(te),e==null||e(te),K.success("Ralph Loops disabled")}}})]})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(zr,{className:"w-4 h-4"}),"About"]}),r.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Installed Version"}),r.jsx("span",{className:"font-medium font-mono text-foreground",children:(h==null?void 0:h.installedVersion)||"Loading..."})]}),(h==null?void 0:h.updateAvailable)&&r.jsx("div",{className:"p-3 bg-green-500/10 border border-green-500/20 rounded-lg",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Update Available!"}),r.jsxs("p",{className:"text-xs text-green-600/80 dark:text-green-400/80",children:["Version ",h.latestVersion," via ",h.updateMethod==="npm"?"npm":h.sourcePath]})]}),r.jsxs(re,{size:"sm",onClick:z,disabled:w,className:"bg-green-600 hover:bg-green-700 text-white",children:[w?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(xi,{className:"w-4 h-4 mr-2"}),"Update Now"]})]})}),!(h!=null&&h.updateAvailable)&&(h==null?void 0:h.latestVersion)&&r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Latest Version"}),r.jsxs("span",{className:"font-mono text-green-600 dark:text-green-400",children:[h.latestVersion," ✓"]})]}),(h==null?void 0:h.sourcePath)&&!(h!=null&&h.updateAvailable)&&r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Dev Source"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-xs text-muted-foreground",children:h.sourcePath}),r.jsx(re,{size:"sm",variant:"outline",onClick:z,disabled:w,className:"h-7",children:w?r.jsx(et,{className:"w-3 h-3 animate-spin"}):r.jsx(Tr,{className:"w-3 h-3"})})]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Install Location"}),r.jsx("code",{className:"text-xs text-muted-foreground",children:(h==null?void 0:h.installDir)||"~/.coder-config"})]}),r.jsxs("div",{className:"flex items-center justify-between text-sm pt-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Auto-Update"}),r.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Automatically install updates when available"})]}),r.jsx(vt,{checked:(t==null?void 0:t.autoUpdate)||!1,onCheckedChange:F=>{X("autoUpdate",F),ue.saveConfig({...t,autoUpdate:F}),K.success(F?"Auto-update enabled":"Auto-update disabled")}})]}),r.jsxs("div",{className:"flex items-center justify-between text-sm pt-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Release Channel"}),r.jsx("p",{className:"text-xs text-muted-foreground/70",children:(t==null?void 0:t.releaseChannel)==="beta"?r.jsxs("span",{className:"text-yellow-500 flex items-center gap-1",children:[r.jsx(Vi,{className:"w-3 h-3"}),"Beta builds may have bugs"]}):"Stable releases (recommended)"})]}),r.jsxs("select",{value:(t==null?void 0:t.releaseChannel)||"stable",onChange:F=>{const te=F.target.value;te==="beta"?N({open:!0}):(X("releaseChannel",te),ue.saveConfig({...t,releaseChannel:te}),K.success("Switched to stable releases"))},className:"bg-background border border-border rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"stable",children:"Stable"}),r.jsx("option",{value:"beta",children:"Beta"})]})]}),r.jsxs("div",{className:"border-t border-border pt-3 mt-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Documentation"}),r.jsx("a",{href:"https://github.com/regression-io/coder-config",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"GitHub"})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"What's New"}),r.jsxs("button",{onClick:Y,className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(ju,{className:"w-3 h-3"}),"Changelog"]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["After updating, restart the server with ",r.jsx("code",{className:"bg-muted-foreground/10 px-1 rounded",children:"coder-config ui"})]})]})]})]})]})]}),r.jsx(mx,{open:c.open,onOpenChange:F=>u(te=>({...te,open:F})),onSelect:F=>{if(c.field==="toolsDirs"){const te=(t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[]);if(c.index===-1)s(ce=>{const{toolsDir:fe,...J}=ce;return{...J,toolsDirs:[...te,F]}});else{const ce=[...te];ce[c.index]=F,s(fe=>{const{toolsDir:J,...W}=fe;return{...W,toolsDirs:ce}})}}else c.field&&X(c.field,F)},type:c.type,initialPath:c.field==="toolsDirs"&&c.index>=0?((t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[]))[c.index]||"~":(t==null?void 0:t[c.field])||"~",title:c.type==="directory"?"Select Directory":"Select File"}),r.jsx(yt,{open:b.open,onOpenChange:F=>k(te=>({...te,open:F})),children:r.jsxs(ht,{className:"max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[r.jsx(ft,{className:"flex-shrink-0",children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(ju,{className:"w-5 h-5"}),"Changelog"]})}),b.loading?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(et,{className:"w-6 h-6 animate-spin text-primary"})}):r.jsx(Ys,{className:"h-[60vh]",children:r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none pr-4",children:r.jsx(Yz,{components:{h1:({children:F})=>r.jsx("h1",{className:"text-xl font-bold text-foreground mb-4",children:F}),h2:({children:F})=>r.jsx("h2",{className:"text-lg font-semibold text-foreground mt-6 mb-3 pb-2 border-b border-border",children:F}),h3:({children:F})=>r.jsx("h3",{className:"text-base font-medium text-foreground mt-4 mb-2",children:F}),p:({children:F})=>r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:F}),ul:({children:F})=>r.jsx("ul",{className:"text-sm text-muted-foreground list-disc pl-5 mb-3 space-y-1",children:F}),li:({children:F})=>r.jsx("li",{className:"text-sm",children:F}),code:({children:F})=>r.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-xs font-mono",children:F}),hr:()=>r.jsx("hr",{className:"my-4 border-border"}),strong:({children:F})=>r.jsx("strong",{className:"font-semibold text-foreground",children:F})},children:b.content})})})]})}),r.jsx(yt,{open:E.open,onOpenChange:F=>P(te=>({...te,open:F})),children:r.jsxs(ht,{className:"max-w-md",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2 text-yellow-600 dark:text-yellow-400",children:[r.jsx(Vi,{className:"w-5 h-5"}),"Experimental Feature Warning"]}),r.jsx(tr,{className:"pt-2",children:r.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[r.jsxs("p",{children:[r.jsx("strong",{className:"text-foreground",children:"Ralph Loops"})," is an experimental feature that enables autonomous development loops with Claude Code."]}),r.jsxs("div",{className:"bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-3",children:[r.jsx("p",{className:"text-yellow-700 dark:text-yellow-300 font-medium mb-2",children:"Please be aware:"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-yellow-600 dark:text-yellow-400",children:[r.jsx("li",{children:"This feature runs Claude autonomously with minimal intervention"}),r.jsx("li",{children:"It may make many API calls and incur costs"}),r.jsx("li",{children:"Always review generated code before committing"}),r.jsx("li",{children:"This feature may change or be removed in future versions"})]})]}),r.jsx("p",{children:"Do you want to enable Ralph Loops?"})]})})]}),r.jsxs(St,{className:"gap-2 sm:gap-0",children:[r.jsx(re,{variant:"outline",onClick:()=>P({open:!1,feature:null}),children:"Cancel"}),r.jsxs(re,{variant:"default",className:"bg-yellow-600 hover:bg-yellow-700 text-white",onClick:()=>{const F={...t,experimental:{...t==null?void 0:t.experimental,ralphLoops:!0}};s(F),ue.saveConfig(F),e==null||e(F),K.success("Ralph Loops enabled"),P({open:!1,feature:null})},children:[r.jsx(bm,{className:"w-4 h-4 mr-2"}),"Enable Feature"]})]})]})}),r.jsx(yt,{open:A.open,onOpenChange:F=>N({open:F}),children:r.jsxs(ht,{className:"max-w-md",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2 text-red-600 dark:text-red-400",children:[r.jsx(Vi,{className:"w-5 h-5"}),"Switch to Beta Channel?"]}),r.jsx(tr,{className:"pt-2",children:r.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[r.jsxs("p",{children:["You are about to switch to ",r.jsx("strong",{className:"text-foreground",children:"beta releases"}),"."]}),r.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-3",children:[r.jsx("p",{className:"text-red-700 dark:text-red-300 font-medium mb-2",children:"Warning:"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-red-600 dark:text-red-400",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Things may break"})," - beta releases are not fully tested"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Data loss possible"})," - bugs could corrupt your configuration"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Frequent changes"})," - behavior may change unexpectedly"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"No rollback"})," - you'll need to manually downgrade if issues occur"]})]})]}),r.jsx("p",{className:"text-yellow-600 dark:text-yellow-400",children:"Only enable this if you're comfortable debugging issues and reporting bugs."})]})})]}),r.jsxs(St,{className:"gap-2 sm:gap-0",children:[r.jsx(re,{variant:"outline",onClick:()=>N({open:!1}),children:"Stay on Stable"}),r.jsxs(re,{variant:"destructive",onClick:()=>{X("releaseChannel","beta"),ue.saveConfig({...t,releaseChannel:"beta"}),K.warning("Switched to beta releases - expect bugs!"),N({open:!1})},children:[r.jsx(Vi,{className:"w-4 h-4 mr-2"}),"Switch to Beta"]})]})]})})]})}function tH(){const[e,t]=_.useState(null),[s,n]=_.useState({}),[o,c]=_.useState(!0);_.useEffect(()=>{u()},[]);const u=async()=>{try{c(!0);const[d,f]=await Promise.all([ue.getClaudeSettings(),ue.getRegistry()]);t(d.settings),n(f.mcpServers||{})}catch(d){console.error("Failed to load Claude settings:",d)}finally{c(!1)}},l=async d=>{try{await ue.saveClaudeSettings(d),t(d),K.success("Claude Code settings saved!")}catch(f){K.error("Failed to save settings: "+f.message)}};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:r.jsx(uN,{settings:e,onSave:l,loading:o,settingsPath:"~/.claude/settings.json",mcpServers:s})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config init # Initialize project"}),r.jsx("p",{children:"coder-config apply # Generate .mcp.json from config"}),r.jsx("p",{children:"coder-config show # Show current project config"})]})]})]})}function rH(){const[e,t]=_.useState(null),[s,n]=_.useState(!0);_.useEffect(()=>{o()},[]);const o=async()=>{try{n(!0);const u=await ue.getGeminiSettings();t(u.settings)}catch(u){console.error("Failed to load Gemini settings:",u)}finally{n(!1)}},c=async u=>{try{await ue.saveGeminiSettings(u),t(u),K.success("Gemini CLI settings saved!")}catch(l){K.error("Failed to save settings: "+l.message)}};return s?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-blue-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:r.jsx(hN,{settings:e,onSave:c,loading:s,settingsPath:"~/.gemini/settings.json"})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config apply # Generate settings for all tools"}),r.jsx("p",{children:"coder-config apply --gemini # Generate Gemini settings only"})]})]})]})}const sH=[{id:"off",name:"Off",description:"Never auto-execute; requires allow list"},{id:"auto",name:"Auto",description:"Safety model determines execution"},{id:"turbo",name:"Turbo",description:"Auto-execute unless in deny list",dangerous:!0}],nH=[{id:"always-proceed",name:"Always Proceed",description:"Agent never requests review"},{id:"agent-decides",name:"Agent Decides",description:"Agent determines when review is needed"},{id:"request-review",name:"Request Review",description:"Agent always requests review"}],iH=[{id:"always-proceed",name:"Always Proceed",description:"Maximum autonomy",dangerous:!0},{id:"request-review",name:"Request Review",description:"Ask before browser JavaScript"},{id:"disabled",name:"Disabled",description:"Never run browser JavaScript"}];function oH({settings:e,onSave:t,loading:s,settingsPath:n}){const[o,c]=_.useState(e||{}),[u,l]=_.useState(!1),[d,f]=_.useState("rich"),[m,h]=_.useState(JSON.stringify(e||{},null,2)),[x,w]=_.useState({open:!1,name:"",json:""}),[j,C]=_.useState({}),v=async()=>{l(!0);try{if(d==="json")try{const A=JSON.parse(m);await t(A),c(A)}catch{K.error("Invalid JSON"),l(!1);return}else await t(o),h(JSON.stringify(o,null,2));K.success("Settings saved")}finally{l(!1)}},y=(A,N)=>{c(M=>({...M,[A]:N}))},g=(A,N)=>(o==null?void 0:o[A])??N,b=o.mcpServers||{},k=()=>{const{name:A,json:N}=x;if(!A.trim()){K.error("Please enter a name for the MCP");return}let M;try{M=JSON.parse(N)}catch{K.error("Invalid JSON configuration");return}if(!M.command){K.error('MCP config must have a "command" field');return}c(I=>({...I,mcpServers:{...I.mcpServers,[A.trim()]:M}})),w({open:!1,name:"",json:""}),K.success(`Added MCP: ${A}`)},E=A=>{c(N=>{const{[A]:M,...I}=N.mcpServers||{};return{...N,mcpServers:I}}),K.success(`Removed MCP: ${A}`)},P=A=>{C(N=>({...N,[A]:!N[A]}))};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/10 flex items-center justify-center",children:r.jsx(Nc,{className:"w-5 h-5 text-purple-500"})}),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Antigravity Settings",r.jsx(tt,{variant:"outline",className:"text-xs font-normal text-purple-600 border-purple-300 dark:border-purple-700",children:"Google"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",r.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:n})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${d==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>f("rich"),children:"Settings"}),r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${d==="json"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{h(JSON.stringify(o,null,2)),f("json")},children:"JSON"})]}),r.jsxs(re,{onClick:v,disabled:u||s,children:[u?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(Ms,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),d==="json"?r.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:r.jsx(_t,{value:m,onChange:A=>h(A.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"{ }"})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Jn,{className:"w-4 h-4 text-purple-500"}),"Security Policies"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Terminal Command Execution"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Control how the agent executes shell commands"})]}),r.jsxs(Br,{value:g("terminalPolicy","auto"),onValueChange:A=>y("terminalPolicy",A),children:[r.jsx(Pr,{className:"w-44",children:r.jsx($r,{})}),r.jsx(Ar,{children:sH.map(A=>r.jsx(Ft,{value:A.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:A.name}),A.dangerous&&r.jsx(tt,{variant:"destructive",className:"text-xs",children:"Risk"})]})},A.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Review Policy"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When the agent should request human review"})]}),r.jsxs(Br,{value:g("reviewPolicy","agent-decides"),onValueChange:A=>y("reviewPolicy",A),children:[r.jsx(Pr,{className:"w-44",children:r.jsx($r,{})}),r.jsx(Ar,{children:nH.map(A=>r.jsx(Ft,{value:A.id,children:A.name},A.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"JavaScript Execution"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Control browser JavaScript execution"})]}),r.jsxs(Br,{value:g("jsPolicy","request-review"),onValueChange:A=>y("jsPolicy",A),children:[r.jsx(Pr,{className:"w-44",children:r.jsx($r,{})}),r.jsx(Ar,{children:iH.map(A=>r.jsx(Ft,{value:A.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:A.name}),A.dangerous&&r.jsx(tt,{variant:"destructive",className:"text-xs",children:"Risk"})]})},A.id))})]})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[r.jsx(vs,{className:"w-4 h-4 text-purple-500"}),"MCP Servers",r.jsx(tt,{variant:"secondary",className:"text-xs",children:Object.keys(b).length})]}),r.jsxs(re,{size:"sm",variant:"outline",onClick:()=>w({open:!0,name:"",json:`{
637
+ `},o),c}function Sz(e,t){return e&&"run"in e?async function(s,n){const o=n_(s,{file:n,...t});await e.run(o,n)}:function(s,n){return n_(s,{file:n,...e||t})}}function i_(e){if(e)throw e}var Um,o_;function kz(){if(o_)return Um;o_=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},c=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var m=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!h)return!1;var x;for(x in f);return typeof x>"u"||e.call(f,x)},u=function(f,m){s&&m.name==="__proto__"?s(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},l=function(f,m){if(m==="__proto__")if(e.call(f,m)){if(n)return n(f,m).value}else return;return f[m]};return Um=function d(){var f,m,h,x,w,j,C=arguments[0],v=1,y=arguments.length,g=!1;for(typeof C=="boolean"&&(g=C,C=arguments[1]||{},v=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});v<y;++v)if(f=arguments[v],f!=null)for(m in f)h=l(C,m),x=l(f,m),C!==x&&(g&&x&&(c(x)||(w=o(x)))?(w?(w=!1,j=h&&o(h)?h:[]):j=h&&c(h)?h:{},u(C,{name:m,newValue:d(g,j,x)})):typeof x<"u"&&u(C,{name:m,newValue:x}));return C},Um}var jz=kz();const Gm=wc(jz);function Up(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Nz(){const e=[],t={run:s,use:n};return t;function s(...o){let c=-1;const u=o.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);l(null,...o);function l(d,...f){const m=e[++c];let h=-1;if(d){u(d);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,m?Ez(m,l)(...f):u(null,...f)}}function n(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function Ez(e,t){let s;return n;function n(...u){const l=e.length>u.length;let d;l&&u.push(o);try{d=e.apply(this,u)}catch(f){const m=f;if(l&&s)throw m;return o(m)}l||(d&&d.then&&typeof d.then=="function"?d.then(c,o):d instanceof Error?o(d):c(d))}function o(u,...l){s||(s=!0,t(u,...l))}function c(u){o(null,u)}}const Fn={basename:Pz,dirname:Az,extname:Tz,join:Rz,sep:"/"};function Pz(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Wc(e);let s=0,n=-1,o=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){s=o+1;break}}else n<0&&(c=!0,n=o+1);return n<0?"":e.slice(s,n)}if(t===e)return"";let u=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){s=o+1;break}}else u<0&&(c=!0,u=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(n=o):(l=-1,n=u));return s===n?n=u:n<0&&(n=e.length),e.slice(s,n)}function Az(e){if(Wc(e),e.length===0)return".";let t=-1,s=e.length,n;for(;--s;)if(e.codePointAt(s)===47){if(n){t=s;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Tz(e){Wc(e);let t=e.length,s=-1,n=0,o=-1,c=0,u;for(;t--;){const l=e.codePointAt(t);if(l===47){if(u){n=t+1;break}continue}s<0&&(u=!0,s=t+1),l===46?o<0?o=t:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||s<0||c===0||c===1&&o===s-1&&o===n+1?"":e.slice(o,s)}function Rz(...e){let t=-1,s;for(;++t<e.length;)Wc(e[t]),e[t]&&(s=s===void 0?e[t]:s+"/"+e[t]);return s===void 0?".":Mz(s)}function Mz(e){Wc(e);const t=e.codePointAt(0)===47;let s=Dz(e,!t);return s.length===0&&!t&&(s="."),s.length>0&&e.codePointAt(e.length-1)===47&&(s+="/"),t?"/"+s:s}function Dz(e,t){let s="",n=0,o=-1,c=0,u=-1,l,d;for(;++u<=e.length;){if(u<e.length)l=e.codePointAt(u);else{if(l===47)break;l=47}if(l===47){if(!(o===u-1||c===1))if(o!==u-1&&c===2){if(s.length<2||n!==2||s.codePointAt(s.length-1)!==46||s.codePointAt(s.length-2)!==46){if(s.length>2){if(d=s.lastIndexOf("/"),d!==s.length-1){d<0?(s="",n=0):(s=s.slice(0,d),n=s.length-1-s.lastIndexOf("/")),o=u,c=0;continue}}else if(s.length>0){s="",n=0,o=u,c=0;continue}}t&&(s=s.length>0?s+"/..":"..",n=2)}else s.length>0?s+="/"+e.slice(o+1,u):s=e.slice(o+1,u),n=u-o-1;o=u,c=0}else l===46&&c>-1?c++:c=-1}return s}function Wc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Iz={cwd:Lz};function Lz(){return"/"}function Gp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Oz(e){if(typeof e=="string")e=new URL(e);else if(!Gp(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Fz(e)}function Fz(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let s=-1;for(;++s<t.length;)if(t.codePointAt(s)===37&&t.codePointAt(s+1)===50){const n=t.codePointAt(s+2);if(n===70||n===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const qm=["history","path","basename","stem","extname","dirname"];class ZN{constructor(t){let s;t?Gp(t)?s={path:t}:typeof t=="string"||Bz(t)?s={value:t}:s=t:s={},this.cwd="cwd"in s?"":Iz.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<qm.length;){const c=qm[n];c in s&&s[c]!==void 0&&s[c]!==null&&(this[c]=c==="history"?[...s[c]]:s[c])}let o;for(o in s)qm.includes(o)||(this[o]=s[o])}get basename(){return typeof this.path=="string"?Fn.basename(this.path):void 0}set basename(t){Ym(t,"basename"),Km(t,"basename"),this.path=Fn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Fn.dirname(this.path):void 0}set dirname(t){a_(this.basename,"dirname"),this.path=Fn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Fn.extname(this.path):void 0}set extname(t){if(Km(t,"extname"),a_(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Fn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Gp(t)&&(t=Oz(t)),Ym(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Fn.basename(this.path,this.extname):void 0}set stem(t){Ym(t,"stem"),Km(t,"stem"),this.path=Fn.join(this.dirname||"",t+(this.extname||""))}fail(t,s,n){const o=this.message(t,s,n);throw o.fatal=!0,o}info(t,s,n){const o=this.message(t,s,n);return o.fatal=void 0,o}message(t,s,n){const o=new ds(t,s,n);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Km(e,t){if(e&&e.includes(Fn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Fn.sep+"`")}function Ym(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function a_(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Bz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $z=(function(e){const n=this.constructor.prototype,o=n[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,n),c}),zz={}.hasOwnProperty;class Hx extends $z{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Nz()}copy(){const t=new Hx;let s=-1;for(;++s<this.attachers.length;){const n=this.attachers[s];t.use(...n)}return t.data(Gm(!0,{},this.namespace)),t}data(t,s){return typeof t=="string"?arguments.length===2?(Qm("data",this.frozen),this.namespace[t]=s,this):zz.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Qm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[s,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const o=s.call(t,...n);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const s=au(t),n=this.parser||this.Parser;return Jm("parse",n),n(String(s),s)}process(t,s){const n=this;return this.freeze(),Jm("process",this.parser||this.Parser),Xm("process",this.compiler||this.Compiler),s?o(void 0,s):new Promise(o);function o(c,u){const l=au(t),d=n.parse(l);n.run(d,l,function(m,h,x){if(m||!h||!x)return f(m);const w=h,j=n.stringify(w,x);Vz(j)?x.value=j:x.result=j,f(m,x)});function f(m,h){m||!h?u(m):c?c(h):s(void 0,h)}}}processSync(t){let s=!1,n;return this.freeze(),Jm("processSync",this.parser||this.Parser),Xm("processSync",this.compiler||this.Compiler),this.process(t,o),c_("processSync","process",s),n;function o(c,u){s=!0,i_(c),n=u}}run(t,s,n){l_(t),this.freeze();const o=this.transformers;return!n&&typeof s=="function"&&(n=s,s=void 0),n?c(void 0,n):new Promise(c);function c(u,l){const d=au(s);o.run(t,d,f);function f(m,h,x){const w=h||t;m?l(m):u?u(w):n(void 0,w,x)}}}runSync(t,s){let n=!1,o;return this.run(t,s,c),c_("runSync","run",n),o;function c(u,l){i_(u),o=l,n=!0}}stringify(t,s){this.freeze();const n=au(s),o=this.compiler||this.Compiler;return Xm("stringify",o),l_(t),o(t,n)}use(t,...s){const n=this.attachers,o=this.namespace;if(Qm("use",this.frozen),t!=null)if(typeof t=="function")d(t,s);else if(typeof t=="object")Array.isArray(t)?l(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[m,...h]=f;d(m,h)}else u(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function u(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(f.plugins),f.settings&&(o.settings=Gm(!0,o.settings,f.settings))}function l(f){let m=-1;if(f!=null)if(Array.isArray(f))for(;++m<f.length;){const h=f[m];c(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,m){let h=-1,x=-1;for(;++h<n.length;)if(n[h][0]===f){x=h;break}if(x===-1)n.push([f,...m]);else if(m.length>0){let[w,...j]=m;const C=n[x][1];Up(C)&&Up(w)&&(w=Gm(!0,C,w)),n[x]=[f,w,...j]}}}}const Hz=new Hx().freeze();function Jm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Xm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Qm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function l_(e){if(!Up(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function c_(e,t,s){if(!s)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function au(e){return Wz(e)?e:new ZN(e)}function Wz(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Vz(e){return typeof e=="string"||Uz(e)}function Uz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Gz="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",d_=[],u_={allowDangerousHtml:!0},qz=/^(https?|ircs?|mailto|xmpp)$/i,Kz=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Yz(e){const t=Jz(e),s=Xz(e);return Qz(t.runSync(t.parse(s),s),e)}function Jz(e){const t=e.rehypePlugins||d_,s=e.remarkPlugins||d_,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...u_}:u_;return Hz().use(P$).use(s).use(Sz,n).use(t)}function Xz(e){const t=e.children||"",s=new ZN;return typeof t=="string"&&(s.value=t),s}function Qz(e,t){const s=t.allowedElements,n=t.allowElement,o=t.components,c=t.disallowedElements,u=t.skipHtml,l=t.unwrapDisallowed,d=t.urlTransform||Zz;for(const m of Kz)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Gz+m.id,void 0);return QN(e,f),l7(e,{Fragment:r.Fragment,components:o,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function f(m,h,x){if(m.type==="raw"&&x&&typeof h=="number")return u?x.children.splice(h,1):x.children[h]={type:"text",value:m.value},h;if(m.type==="element"){let w;for(w in Hm)if(Object.hasOwn(Hm,w)&&Object.hasOwn(m.properties,w)){const j=m.properties[w],C=Hm[w];(C===null||C.includes(m.tagName))&&(m.properties[w]=d(String(j||""),w,m))}}if(m.type==="element"){let w=s?!s.includes(m.tagName):c?c.includes(m.tagName):!1;if(!w&&n&&typeof h=="number"&&(w=!n(m,h,x)),w&&x&&typeof h=="number")return l&&m.children?x.children.splice(h,1,...m.children):x.children.splice(h,1),h}}}function Zz(e){const t=e.indexOf(":"),s=e.indexOf("?"),n=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||s!==-1&&t>s||n!==-1&&t>n||qz.test(e.slice(0,t))?e:""}function eH({onConfigChange:e}){var R,$,G;const[t,s]=_.useState(null),[n,o]=_.useState(""),[c,u]=_.useState({open:!1,field:null,type:"directory"}),[l,d]=_.useState(!0),[f,m]=_.useState(!1),[h,x]=_.useState(null),[w,j]=_.useState(!1),[C,v]=_.useState(null),[y,g]=_.useState([]),[b,k]=_.useState({open:!1,content:"",loading:!1}),[E,P]=_.useState({open:!1,feature:null}),[A,N]=_.useState({open:!1});_.useEffect(()=>{H(),M(),I()},[]);const M=async()=>{try{const F=await ue.checkVersion();x(F)}catch(F){console.error("Failed to load version info:",F)}},I=async()=>{try{const F=await ue.getProject();v(F.dir),L(F.dir)}catch(F){console.error("Failed to load project info:",F)}},L=async F=>{if(F)try{const te=await ue.getHiddenSubprojects(F);g(te.hidden||[])}catch(te){console.error("Failed to load hidden sub-projects:",te)}},B=async F=>{if(C)try{const te=await ue.unhideSubproject(C,F);te.success?(K.success("Sub-project unhidden"),L(C)):K.error(te.error||"Failed to unhide")}catch(te){K.error("Failed to unhide: "+te.message)}},z=async()=>{if(!(h!=null&&h.updateAvailable)){K.error("No update available");return}j(!0);try{const F=await ue.performUpdate({updateMethod:h.updateMethod,sourcePath:h.sourcePath,channel:h.channel});if(F.success){K.success(`Updated to v${F.newVersion}! Restarting server...`);try{await ue.restartServer()}catch{}let te=0;const ce=setInterval(async()=>{te++;try{await ue.checkVersion(),clearInterval(ce),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{te>30&&(clearInterval(ce),K.info("Server restarting. Please refresh the page."),j(!1))}},500)}else K.error("Update failed: "+F.error),j(!1)}catch(F){K.error("Update failed: "+F.message),j(!1)}},Y=async()=>{k(F=>({...F,open:!0,loading:!0}));try{const F=await ue.getChangelog();F.success?k(te=>({...te,content:F.content,loading:!1})):(K.error("Failed to load changelog"),k(te=>({...te,open:!1,loading:!1})))}catch(F){K.error("Failed to load changelog: "+F.message),k(te=>({...te,open:!1,loading:!1}))}},H=async()=>{try{d(!0);const F=await ue.getConfig();s(F.config),o(F.path)}catch{K.error("Failed to load settings")}finally{d(!1)}},U=async()=>{m(!0);try{await ue.saveConfig(t),K.success("Preferences saved!")}catch{K.error("Failed to save preferences")}finally{m(!1)}},X=(F,te)=>{s(ce=>({...ce,[F]:te}))},q=(F,te,ce)=>{s(fe=>({...fe,[F]:{...fe[F],[te]:ce}}))},O=async F=>{const te=(t==null?void 0:t.enabledTools)||["claude"];let ce;if(te.includes(F)){if(te.length<=1){K.error("At least one tool must be enabled");return}ce=te.filter(J=>J!==F)}else ce=[...te,F];const fe={...t,enabledTools:ce};s(fe);try{await ue.saveConfig(fe),e==null||e(fe);const J={claude:"Claude Code",gemini:"Gemini CLI",antigravity:"Antigravity",codex:"Codex CLI"}[F]||F;K.success(`${J} ${ce.includes(F)?"enabled":"disabled"}`)}catch{s(t),K.error("Failed to save preference")}};return l?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-muted flex items-center justify-center",children:r.jsx(cS,{className:"w-5 h-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"coder-config Preferences"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tool settings for this configuration manager"})]})]}),r.jsxs("div",{className:"bg-card rounded-xl border border-border p-6 shadow-sm",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("div",{children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded",children:n})]})}),r.jsxs(re,{onClick:U,disabled:f,children:[f?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(Ms,{className:"w-4 h-4 mr-2"}),"Save"]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Kr,{className:"w-4 h-4"}),"Directories"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"MCP Tools Directories"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Folders containing local MCP tool repositories for discovery"}),r.jsxs("div",{className:"space-y-2",children:[((t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[])).map((F,te)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:F||"",onChange:ce=>{const fe=[...(t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[])];fe[te]=ce.target.value,X("toolsDirs",fe),t!=null&&t.toolsDir&&s(J=>{const{toolsDir:W,...ae}=J;return{...ae,toolsDirs:fe}})},placeholder:"~/mcp-tools",className:"font-mono flex-1"}),r.jsx(re,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:te}),title:"Browse...",children:r.jsx(Ki,{className:"w-4 h-4"})}),r.jsx(re,{variant:"outline",size:"icon",onClick:()=>{const fe=((t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[])).filter((J,W)=>W!==te);s(J=>{const{toolsDir:W,...ae}=J;return{...ae,toolsDirs:fe.length>0?fe:void 0}})},title:"Remove",className:"text-destructive hover:text-destructive",children:r.jsx(hi,{className:"w-4 h-4"})})]},te)),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:-1}),className:"mt-2",children:[r.jsx(ui,{className:"w-4 h-4 mr-2"}),"Add Tools Folder"]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Global Registry Path"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Path to the global MCP registry file"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:(t==null?void 0:t.registryPath)||"",onChange:F=>X("registryPath",F.target.value),placeholder:"~/.claude/registry.json",className:"font-mono flex-1"}),r.jsx(re,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"registryPath",type:"file"}),title:"Browse...",children:r.jsx(Ki,{className:"w-4 h-4"})})]})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(DM,{className:"w-4 h-4"}),"User Interface"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Port"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Port for the web UI server"}),r.jsx(lt,{type:"number",value:((R=t==null?void 0:t.ui)==null?void 0:R.port)||3333,onChange:F=>q("ui","port",parseInt(F.target.value)||3333),placeholder:"3333",className:"w-32"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Open Browser on Start"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically open browser when starting the UI"})]}),r.jsx(vt,{checked:(($=t==null?void 0:t.ui)==null?void 0:$.openBrowser)??!0,onCheckedChange:F=>q("ui","openBrowser",F)})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(x5,{className:"w-4 h-4"}),"AI Assistant"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Choose which AI assistant to use for features like MCP creation and tool import."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${((t==null?void 0:t.aiAssistant)||"claude")==="claude"?"border-orange-500 bg-orange-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>X("aiAssistant","claude"),children:[r.jsx("input",{type:"radio",name:"aiAssistant",value:"claude",checked:((t==null?void 0:t.aiAssistant)||"claude")==="claude",onChange:()=>X("aiAssistant","claude"),className:"sr-only"}),r.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-orange-500"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Command: ",r.jsx("code",{className:"text-xs",children:"claude"})]})]}),((t==null?void 0:t.aiAssistant)||"claude")==="claude"&&r.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${(t==null?void 0:t.aiAssistant)==="gemini"?"border-blue-500 bg-blue-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>X("aiAssistant","gemini"),children:[r.jsx("input",{type:"radio",name:"aiAssistant",value:"gemini",checked:(t==null?void 0:t.aiAssistant)==="gemini",onChange:()=>X("aiAssistant","gemini"),className:"sr-only"}),r.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:r.jsx(Kt,{className:"w-4 h-4 text-blue-500"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI coding assistant • Command: ",r.jsx("code",{className:"text-xs",children:"gemini"})]})]}),(t==null?void 0:t.aiAssistant)==="gemini"&&r.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(z5,{className:"w-4 h-4"}),"Enabled AI Tools"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Select which AI coding tools to generate MCP configurations for. The Apply button will update all enabled tools."}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-orange-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:".mcp.json"})]})]})]}),r.jsx(vt,{checked:((t==null?void 0:t.enabledTools)||["claude"]).includes("claude"),onCheckedChange:()=>O("claude")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-blue-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's terminal AI coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:"~/.gemini/settings.json"})]})]})]}),r.jsx(vt,{checked:((t==null?void 0:t.enabledTools)||["claude"]).includes("gemini"),onCheckedChange:()=>O("gemini")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-purple-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-purple-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Antigravity"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI IDE • Output: ",r.jsx("code",{className:"text-xs",children:"~/.gemini/antigravity/mcp_config.json"})]})]})]}),r.jsx(vt,{checked:((t==null?void 0:t.enabledTools)||["claude"]).includes("antigravity"),onCheckedChange:()=>O("antigravity")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-green-500/10 flex items-center justify-center",children:r.jsx(Ht,{className:"w-4 h-4 text-green-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Codex CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["OpenAI's terminal coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:".codex/mcp.json"})]})]})]}),r.jsx(vt,{checked:((t==null?void 0:t.enabledTools)||["claude"]).includes("codex"),onCheckedChange:()=>O("codex")})]}),r.jsxs("p",{className:"text-xs text-muted-foreground italic",children:["Note: Antigravity does not support environment variable interpolation (",r.jsx("code",{children:"${VAR}"}),"). Variables are resolved to actual values when generating its config."]})]})]}),y.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(rS,{className:"w-4 h-4"}),"Hidden Sub-projects"]}),r.jsx("div",{className:"space-y-2",children:y.map(F=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Kr,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:F.name}),r.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:F.dir.replace(C+"/","")})]})]}),r.jsxs(re,{size:"sm",variant:"outline",onClick:()=>B(F.dir),className:"h-7",children:[r.jsx(Ag,{className:"w-3 h-3 mr-1"}),"Unhide"]})]},F.dir))})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(bm,{className:"w-4 h-4"}),"Experimental Features"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"These features are experimental and may change or be removed in future versions."}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg border border-yellow-500/20",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-yellow-500/10 flex items-center justify-center",children:r.jsx(bm,{className:"w-4 h-4 text-yellow-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Ralph Loops"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Autonomous development loops with Claude Code"})]})]}),r.jsx(vt,{checked:((G=t==null?void 0:t.experimental)==null?void 0:G.ralphLoops)||!1,onCheckedChange:F=>{if(F)P({open:!0,feature:"ralphLoops"});else{const te={...t,experimental:{...t==null?void 0:t.experimental,ralphLoops:!1}};s(te),ue.saveConfig(te),e==null||e(te),K.success("Ralph Loops disabled")}}})]})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(zr,{className:"w-4 h-4"}),"About"]}),r.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Installed Version"}),r.jsx("span",{className:"font-medium font-mono text-foreground",children:(h==null?void 0:h.installedVersion)||"Loading..."})]}),(h==null?void 0:h.updateAvailable)&&r.jsx("div",{className:"p-3 bg-green-500/10 border border-green-500/20 rounded-lg",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Update Available!"}),r.jsxs("p",{className:"text-xs text-green-600/80 dark:text-green-400/80",children:["Version ",h.latestVersion," via ",h.updateMethod==="npm"?"npm":h.sourcePath]})]}),r.jsxs(re,{size:"sm",onClick:z,disabled:w,className:"bg-green-600 hover:bg-green-700 text-white",children:[w?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(xi,{className:"w-4 h-4 mr-2"}),"Update Now"]})]})}),!(h!=null&&h.updateAvailable)&&(h==null?void 0:h.latestVersion)&&r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Latest Version"}),r.jsxs("span",{className:"font-mono text-green-600 dark:text-green-400",children:[h.latestVersion," ✓"]})]}),(h==null?void 0:h.sourcePath)&&!(h!=null&&h.updateAvailable)&&r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Dev Source"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-xs text-muted-foreground",children:h.sourcePath}),r.jsx(re,{size:"sm",variant:"outline",onClick:z,disabled:w,className:"h-7",children:w?r.jsx(et,{className:"w-3 h-3 animate-spin"}):r.jsx(Tr,{className:"w-3 h-3"})})]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Install Location"}),r.jsx("code",{className:"text-xs text-muted-foreground",children:(h==null?void 0:h.installDir)||"~/.coder-config"})]}),r.jsxs("div",{className:"flex items-center justify-between text-sm pt-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Auto-Update"}),r.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Automatically install updates when available"})]}),r.jsx(vt,{checked:(t==null?void 0:t.autoUpdate)||!1,onCheckedChange:F=>{X("autoUpdate",F),ue.saveConfig({...t,autoUpdate:F}),K.success(F?"Auto-update enabled":"Auto-update disabled")}})]}),r.jsxs("div",{className:"flex items-center justify-between text-sm pt-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Release Channel"}),r.jsx("p",{className:"text-xs text-muted-foreground/70",children:(t==null?void 0:t.releaseChannel)==="beta"?r.jsxs("span",{className:"text-yellow-500 flex items-center gap-1",children:[r.jsx(Vi,{className:"w-3 h-3"}),"Beta builds may have bugs"]}):"Stable releases (recommended)"})]}),r.jsxs("select",{value:(t==null?void 0:t.releaseChannel)||"stable",onChange:F=>{const te=F.target.value;te==="beta"?N({open:!0}):(X("releaseChannel",te),ue.saveConfig({...t,releaseChannel:te}),K.success("Switched to stable releases"))},className:"bg-background border border-border rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"stable",children:"Stable"}),r.jsx("option",{value:"beta",children:"Beta"})]})]}),r.jsxs("div",{className:"border-t border-border pt-3 mt-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Documentation"}),r.jsx("a",{href:"https://github.com/regression-io/coder-config",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"GitHub"})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"What's New"}),r.jsxs("button",{onClick:Y,className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(ju,{className:"w-3 h-3"}),"Changelog"]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["After updating, restart the server with ",r.jsx("code",{className:"bg-muted-foreground/10 px-1 rounded",children:"coder-config ui"})]})]})]})]})]})]}),r.jsx(mx,{open:c.open,onOpenChange:F=>u(te=>({...te,open:F})),onSelect:F=>{if(c.field==="toolsDirs"){const te=(t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[]);if(c.index===-1)s(ce=>{const{toolsDir:fe,...J}=ce;return{...J,toolsDirs:[...te,F]}});else{const ce=[...te];ce[c.index]=F,s(fe=>{const{toolsDir:J,...W}=fe;return{...W,toolsDirs:ce}})}}else c.field&&X(c.field,F)},type:c.type,initialPath:c.field==="toolsDirs"&&c.index>=0?((t==null?void 0:t.toolsDirs)||(t!=null&&t.toolsDir?[t.toolsDir]:[]))[c.index]||"~":(t==null?void 0:t[c.field])||"~",title:c.type==="directory"?"Select Directory":"Select File"}),r.jsx(yt,{open:b.open,onOpenChange:F=>k(te=>({...te,open:F})),children:r.jsxs(ht,{className:"max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[r.jsx(ft,{className:"flex-shrink-0",children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(ju,{className:"w-5 h-5"}),"Changelog"]})}),b.loading?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(et,{className:"w-6 h-6 animate-spin text-primary"})}):r.jsx(Ys,{className:"h-[60vh]",children:r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none pr-4",children:r.jsx(Yz,{components:{h1:({children:F})=>r.jsx("h1",{className:"text-xl font-bold text-foreground mb-4",children:F}),h2:({children:F})=>r.jsx("h2",{className:"text-lg font-semibold text-foreground mt-6 mb-3 pb-2 border-b border-border",children:F}),h3:({children:F})=>r.jsx("h3",{className:"text-base font-medium text-foreground mt-4 mb-2",children:F}),p:({children:F})=>r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:F}),ul:({children:F})=>r.jsx("ul",{className:"text-sm text-muted-foreground list-disc pl-5 mb-3 space-y-1",children:F}),li:({children:F})=>r.jsx("li",{className:"text-sm",children:F}),code:({children:F})=>r.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-xs font-mono",children:F}),hr:()=>r.jsx("hr",{className:"my-4 border-border"}),strong:({children:F})=>r.jsx("strong",{className:"font-semibold text-foreground",children:F})},children:b.content})})})]})}),r.jsx(yt,{open:E.open,onOpenChange:F=>P(te=>({...te,open:F})),children:r.jsxs(ht,{className:"max-w-md",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2 text-yellow-600 dark:text-yellow-400",children:[r.jsx(Vi,{className:"w-5 h-5"}),"Experimental Feature Warning"]}),r.jsx(tr,{className:"pt-2",children:r.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[r.jsxs("p",{children:[r.jsx("strong",{className:"text-foreground",children:"Ralph Loops"})," is an experimental feature that enables autonomous development loops with Claude Code."]}),r.jsxs("div",{className:"bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-3",children:[r.jsx("p",{className:"text-yellow-700 dark:text-yellow-300 font-medium mb-2",children:"Please be aware:"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-yellow-600 dark:text-yellow-400",children:[r.jsx("li",{children:"This feature runs Claude autonomously with minimal intervention"}),r.jsx("li",{children:"It may make many API calls and incur costs"}),r.jsx("li",{children:"Always review generated code before committing"}),r.jsx("li",{children:"This feature may change or be removed in future versions"})]})]}),r.jsx("p",{children:"Do you want to enable Ralph Loops?"})]})})]}),r.jsxs(St,{className:"gap-2 sm:gap-0",children:[r.jsx(re,{variant:"outline",onClick:()=>P({open:!1,feature:null}),children:"Cancel"}),r.jsxs(re,{variant:"default",className:"bg-yellow-600 hover:bg-yellow-700 text-white",onClick:()=>{const F={...t,experimental:{...t==null?void 0:t.experimental,ralphLoops:!0}};s(F),ue.saveConfig(F),e==null||e(F),K.success("Ralph Loops enabled"),P({open:!1,feature:null})},children:[r.jsx(bm,{className:"w-4 h-4 mr-2"}),"Enable Feature"]})]})]})}),r.jsx(yt,{open:A.open,onOpenChange:F=>N({open:F}),children:r.jsxs(ht,{className:"max-w-md",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2 text-red-600 dark:text-red-400",children:[r.jsx(Vi,{className:"w-5 h-5"}),"Switch to Beta Channel?"]}),r.jsx(tr,{className:"pt-2",children:r.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[r.jsxs("p",{children:["You are about to switch to ",r.jsx("strong",{className:"text-foreground",children:"beta releases"}),"."]}),r.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-3",children:[r.jsx("p",{className:"text-red-700 dark:text-red-300 font-medium mb-2",children:"Warning:"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-red-600 dark:text-red-400",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Things may break"})," - beta releases are not fully tested"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Data loss possible"})," - bugs could corrupt your configuration"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Frequent changes"})," - behavior may change unexpectedly"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"No rollback"})," - you'll need to manually downgrade if issues occur"]})]})]}),r.jsx("p",{className:"text-yellow-600 dark:text-yellow-400",children:"Only enable this if you're comfortable debugging issues and reporting bugs."})]})})]}),r.jsxs(St,{className:"gap-2 sm:gap-0",children:[r.jsx(re,{variant:"outline",onClick:()=>N({open:!1}),children:"Stay on Stable"}),r.jsxs(re,{variant:"destructive",onClick:()=>{X("releaseChannel","beta"),ue.saveConfig({...t,releaseChannel:"beta"}),K.warning("Switched to beta releases - expect bugs!"),N({open:!1})},children:[r.jsx(Vi,{className:"w-4 h-4 mr-2"}),"Switch to Beta"]})]})]})})]})}function tH(){const[e,t]=_.useState(null),[s,n]=_.useState({}),[o,c]=_.useState(!0);_.useEffect(()=>{u()},[]);const u=async()=>{try{c(!0);const[d,f]=await Promise.all([ue.getClaudeSettings(),ue.getRegistry()]);t(d.settings),n(f.mcpServers||{})}catch(d){console.error("Failed to load Claude settings:",d)}finally{c(!1)}},l=async d=>{try{await ue.saveClaudeSettings(d),t(d),K.success("Claude Code settings saved!")}catch(f){K.error("Failed to save settings: "+f.message)}};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:r.jsx(uN,{settings:e,onSave:l,loading:o,settingsPath:"~/.claude/settings.json",mcpServers:s})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config init # Initialize project"}),r.jsx("p",{children:"coder-config apply # Generate .mcp.json from config"}),r.jsx("p",{children:"coder-config show # Show current project config"})]})]})]})}function rH(){const[e,t]=_.useState(null),[s,n]=_.useState(!0);_.useEffect(()=>{o()},[]);const o=async()=>{try{n(!0);const u=await ue.getGeminiSettings();t(u.settings)}catch(u){console.error("Failed to load Gemini settings:",u)}finally{n(!1)}},c=async u=>{try{await ue.saveGeminiSettings(u),t(u),K.success("Gemini CLI settings saved!")}catch(l){K.error("Failed to save settings: "+l.message)}};return s?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-blue-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:r.jsx(hN,{settings:e,onSave:c,loading:s,settingsPath:"~/.gemini/settings.json"})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config apply # Generate settings for all tools"}),r.jsx("p",{children:"coder-config apply --gemini # Generate Gemini settings only"})]})]})]})}const sH=[{id:"off",name:"Off",description:"Never auto-execute; requires allow list"},{id:"auto",name:"Auto",description:"Safety model determines execution"},{id:"turbo",name:"Turbo",description:"Auto-execute unless in deny list",dangerous:!0}],nH=[{id:"always-proceed",name:"Always Proceed",description:"Agent never requests review"},{id:"agent-decides",name:"Agent Decides",description:"Agent determines when review is needed"},{id:"request-review",name:"Request Review",description:"Agent always requests review"}],iH=[{id:"always-proceed",name:"Always Proceed",description:"Maximum autonomy",dangerous:!0},{id:"request-review",name:"Request Review",description:"Ask before browser JavaScript"},{id:"disabled",name:"Disabled",description:"Never run browser JavaScript"}];function oH({settings:e,onSave:t,loading:s,settingsPath:n}){const[o,c]=_.useState(e||{}),[u,l]=_.useState(!1),[d,f]=_.useState("rich"),[m,h]=_.useState(JSON.stringify(e||{},null,2)),[x,w]=_.useState({open:!1,name:"",json:""}),[j,C]=_.useState({}),v=async()=>{l(!0);try{if(d==="json")try{const A=JSON.parse(m);await t(A),c(A)}catch{K.error("Invalid JSON"),l(!1);return}else await t(o),h(JSON.stringify(o,null,2));K.success("Settings saved")}finally{l(!1)}},y=(A,N)=>{c(M=>({...M,[A]:N}))},g=(A,N)=>(o==null?void 0:o[A])??N,b=o.mcpServers||{},k=()=>{const{name:A,json:N}=x;if(!A.trim()){K.error("Please enter a name for the MCP");return}let M;try{M=JSON.parse(N)}catch{K.error("Invalid JSON configuration");return}if(!M.command){K.error('MCP config must have a "command" field');return}c(I=>({...I,mcpServers:{...I.mcpServers,[A.trim()]:M}})),w({open:!1,name:"",json:""}),K.success(`Added MCP: ${A}`)},E=A=>{c(N=>{const{[A]:M,...I}=N.mcpServers||{};return{...N,mcpServers:I}}),K.success(`Removed MCP: ${A}`)},P=A=>{C(N=>({...N,[A]:!N[A]}))};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/10 flex items-center justify-center",children:r.jsx(Nc,{className:"w-5 h-5 text-purple-500"})}),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Antigravity Settings",r.jsx(tt,{variant:"outline",className:"text-xs font-normal text-purple-600 border-purple-300 dark:border-purple-700",children:"Google"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",r.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:n})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${d==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>f("rich"),children:"Settings"}),r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${d==="json"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{h(JSON.stringify(o,null,2)),f("json")},children:"JSON"})]}),r.jsxs(re,{onClick:v,disabled:u||s,children:[u?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(Ms,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),d==="json"?r.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:r.jsx(_t,{value:m,onChange:A=>h(A.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"{ }"})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Jn,{className:"w-4 h-4 text-purple-500"}),"Security Policies"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Terminal Command Execution"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Control how the agent executes shell commands"})]}),r.jsxs(Br,{value:g("terminalPolicy","auto"),onValueChange:A=>y("terminalPolicy",A),children:[r.jsx(Pr,{className:"w-44",children:r.jsx($r,{})}),r.jsx(Ar,{children:sH.map(A=>r.jsx(Ft,{value:A.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:A.name}),A.dangerous&&r.jsx(tt,{variant:"destructive",className:"text-xs",children:"Risk"})]})},A.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Review Policy"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When the agent should request human review"})]}),r.jsxs(Br,{value:g("reviewPolicy","agent-decides"),onValueChange:A=>y("reviewPolicy",A),children:[r.jsx(Pr,{className:"w-44",children:r.jsx($r,{})}),r.jsx(Ar,{children:nH.map(A=>r.jsx(Ft,{value:A.id,children:A.name},A.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"JavaScript Execution"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Control browser JavaScript execution"})]}),r.jsxs(Br,{value:g("jsPolicy","request-review"),onValueChange:A=>y("jsPolicy",A),children:[r.jsx(Pr,{className:"w-44",children:r.jsx($r,{})}),r.jsx(Ar,{children:iH.map(A=>r.jsx(Ft,{value:A.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:A.name}),A.dangerous&&r.jsx(tt,{variant:"destructive",className:"text-xs",children:"Risk"})]})},A.id))})]})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[r.jsx(vs,{className:"w-4 h-4 text-purple-500"}),"MCP Servers",r.jsx(tt,{variant:"secondary",className:"text-xs",children:Object.keys(b).length})]}),r.jsxs(re,{size:"sm",variant:"outline",onClick:()=>w({open:!0,name:"",json:`{
638
638
  "command": "npx",
639
639
  "args": ["-y", "@example/mcp-server"]
640
640
  }`}),children:[r.jsx(Tt,{className:"w-4 h-4 mr-1"}),"Add MCP"]})]}),r.jsx("div",{className:"space-y-2",children:Object.keys(b).length===0?r.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No MCP servers configured"}):Object.entries(b).map(([A,N])=>r.jsxs(Bc,{open:j[A],onOpenChange:()=>P(A),children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-background group",children:[r.jsxs($c,{className:"flex items-center gap-2 flex-1 text-left",children:[j[A]?r.jsx(vr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(xs,{className:"w-4 h-4 text-muted-foreground"}),r.jsx(vs,{className:"w-4 h-4 text-purple-500"}),r.jsx("span",{className:"font-medium text-sm",children:A}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:N.command})]}),r.jsx(re,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 text-destructive hover:text-destructive",onClick:()=>E(A),children:r.jsx(ys,{className:"w-4 h-4"})})]}),r.jsx(zc,{children:r.jsx("div",{className:"mt-2 ml-6 p-3 rounded-lg bg-muted/50 border",children:r.jsx("pre",{className:"text-xs font-mono text-muted-foreground overflow-x-auto",children:JSON.stringify(N,null,2)})})})]},A))})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-purple-500"}),"Browser Settings"]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"URL Allowlist"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Domains the agent can visit (one per line)"}),r.jsx(_t,{value:g("browserAllowlist",""),onChange:A=>y("browserAllowlist",A.target.value),placeholder:`github.com
@@ -2996,11 +2996,11 @@ When reporting issues, include:
2996
2996
  - Operating system
2997
2997
  - Error messages or logs
2998
2998
  `}},dW={...qH,...KH,...YH,...JH,...XH,...QH,...ZH,...eW,...tW,...rW,...sW,...nW,...iW,...oW,...aW,...lW,...cW};function x2(e){let t=e.replace(/```(\w*)\n([\s\S]*?)```/g,(s,n,o)=>`<pre class="bg-zinc-900 text-zinc-100 p-4 rounded-lg overflow-x-auto my-4"><code class="text-sm">${o.replace(/\\\`/g,"`").replace(/</g,"&lt;").replace(/>/g,"&gt;").trim()}</code></pre>`);return t=t.replace(/(\|[^\n]+\|\n\|[-| :]+\|\n(?:\|[^\n]+\|\n?)+)/g,s=>{const n=s.trim().split(`
2999
- `);if(n.length<2)return s;const o=n[0].split("|").filter(u=>u.trim()).map(u=>`<th class="border border-border px-3 py-2 bg-muted font-semibold text-left">${u.trim()}</th>`).join(""),c=n.slice(2).map(u=>`<tr>${u.split("|").filter(d=>d.trim()).map(d=>`<td class="border border-border px-3 py-2">${d.trim()}</td>`).join("")}</tr>`).join("");return`<table class="w-full border-collapse border border-border my-4"><thead><tr>${o}</tr></thead><tbody>${c}</tbody></table>`}),t.replace(/^### (.*$)/gim,'<h3 class="text-lg font-semibold mt-6 mb-2 text-foreground">$1</h3>').replace(/^## (.*$)/gim,'<h2 class="text-xl font-semibold mt-8 mb-4 text-foreground">$1</h2>').replace(/^# (.*$)/gim,'<h1 class="text-2xl font-bold mb-6 text-foreground">$1</h1>').replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1" class="rounded-lg shadow-lg my-4 max-w-full border border-border" />').replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`([^`]+)`/g,'<code class="bg-muted px-1.5 py-0.5 rounded text-sm font-mono">$1</code>').replace(/^- (.*$)/gim,'<li class="ml-4">$1</li>').replace(/(<li.*<\/li>\n?)+/g,'<ul class="list-disc my-2">$&</ul>').replace(/^\d+\. (.*$)/gim,'<li class="ml-4">$1</li>').replace(/\n\n/g,'</p><p class="my-3 text-foreground">').replace(/\n/g,"<br/>")}function uW(){const[e,t]=_.useState("installation"),[s,n]=_.useState({"getting-started":!0}),o=u=>{n(l=>({...l,[u]:!l[u]}))},c=dW[e];return r.jsxs("div",{className:"flex h-full",children:[r.jsxs("div",{className:"w-64 border-r border-border bg-muted/50 flex flex-col",children:[r.jsx("div",{className:"p-4 border-b border-border",children:r.jsxs("h2",{className:"font-semibold flex items-center gap-2 text-foreground",children:[r.jsx(To,{className:"w-5 h-5"}),"Documentation"]})}),r.jsx(Ys,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:GH.map(u=>r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{className:Ee("w-full flex items-center gap-2 px-3 py-2 text-sm rounded-md hover:bg-accent text-left",(e===u.id||u.subsections.some(l=>l.id===e))&&"bg-accent"),onClick:()=>{u.subsections.length>0?(o(u.id),s[u.id]||t(u.subsections[0].id)):t(u.id)},children:[r.jsx(u.icon,{className:"w-4 h-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1",children:u.title}),u.isNew&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-green-500/20 text-green-600 dark:text-green-400",children:"new"}),u.subsections.length>0&&r.jsx(xs,{className:Ee("w-4 h-4 text-muted-foreground transition-transform",s[u.id]&&"rotate-90")})]}),u.subsections.length>0&&s[u.id]&&r.jsx("div",{className:"ml-6 mt-1 space-y-1",children:u.subsections.map(l=>r.jsx("button",{className:Ee("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground",e===l.id&&"bg-accent text-primary font-medium"),onClick:()=>t(l.id),children:l.title},l.id))})]},u.id))})})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(Ys,{className:"h-full",children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:c?r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:x2(c.content)}})}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(To,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a topic from the sidebar"})]})})})})]})}var hW={};const p_={development:"bg-blue-100 text-blue-700 border-blue-200 dark:bg-blue-900/30 dark:text-blue-400 dark:border-blue-800",productivity:"bg-green-100 text-green-700 border-green-200 dark:bg-green-900/30 dark:text-green-400 dark:border-green-800",integration:"bg-purple-100 text-purple-700 border-purple-200 dark:bg-purple-900/30 dark:text-purple-400 dark:border-purple-800",external:"bg-orange-100 text-orange-700 border-orange-200 dark:bg-orange-900/30 dark:text-orange-400 dark:border-orange-800",lsp:"bg-cyan-100 text-cyan-700 border-cyan-200 dark:bg-cyan-900/30 dark:text-cyan-400 dark:border-cyan-800",default:"bg-gray-100 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-700"};function fW(){var ae,ne,Z,le,Ce,Le,Ge;const[e,t]=_.useState(!0),[s,n]=_.useState({allPlugins:[],categories:[],marketplaces:[],enabledPlugins:null}),[o,c]=_.useState(""),[u,l]=_.useState([]),[d,f]=_.useState([]),[m,h]=_.useState(!0),[x,w]=_.useState(!0),[j,C]=_.useState(!0),[v,y]=_.useState(!0),[g,b]=_.useState("name"),[k,E]=_.useState(null),[P,A]=_.useState({open:!1,repo:""}),[N,M]=_.useState(!1),[I,L]=_.useState({open:!1,plugin:null}),[B,z]=_.useState(!1),Y=async()=>{t(!0);try{const me=await ue.getPlugins();n(me)}catch(me){K.error("Failed to load plugins: "+me.message)}finally{t(!1)}};_.useEffect(()=>{Y()},[]);const H=_.useMemo(()=>{let me=s.allPlugins||[];if(o){const be=o.toLowerCase();me=me.filter(Be=>{var Ke,Qe,je;return((Ke=Be.name)==null?void 0:Ke.toLowerCase().includes(be))||((Qe=Be.description)==null?void 0:Qe.toLowerCase().includes(be))||((je=Be.category)==null?void 0:je.toLowerCase().includes(be))})}return me=me.filter(be=>!(be.sourceType==="external"&&!x||be.sourceType==="internal"&&!m)),me=me.filter(be=>!(be.installed&&!j||!be.installed&&!v)),u.length>0&&(me=me.filter(be=>u.includes(be.category))),d.length>0&&(me=me.filter(be=>d.includes(be.marketplace))),me.sort((be,Be)=>{if(g==="installed"){if(be.installed&&!Be.installed)return-1;if(!be.installed&&Be.installed)return 1}if(g==="category"){const Ke=(be.category||"zzz").localeCompare(Be.category||"zzz");if(Ke!==0)return Ke}return be.name.localeCompare(Be.name)}),me},[s.allPlugins,o,x,m,j,v,u,d,g]),U=me=>{l(be=>be.includes(me)?be.filter(Be=>Be!==me):[...be,me])},X=me=>{f(be=>be.includes(me)?be.filter(Be=>Be!==me):[...be,me])},q=async me=>{E(me);try{const be=await ue.refreshMarketplace(me);be.success?(K.success(`Refreshed ${me}`),await Y()):K.error(be.error||"Failed to refresh marketplace")}catch(be){K.error("Failed to refresh: "+be.message)}finally{E(null)}},O=async()=>{if(!P.repo.trim()){K.error("Please enter a repository URL");return}try{const me=await ue.addMarketplace("",P.repo.trim());me.success?(K.success("Marketplace added"),A({open:!1,repo:""}),await Y()):K.error(me.error||"Failed to add marketplace")}catch(me){K.error("Failed to add marketplace: "+me.message)}},R=async(me,be,Be)=>{z(!0);try{const Ke=Be!==!0,Qe=await ue.setPluginEnabled(me,be,Ke);Qe.success?(K.success(`Plugin ${Ke?"enabled":"disabled"} for ${me===hW.HOME?"~":me}`),await Y()):K.error(Qe.error||"Failed to update plugin state")}catch(Ke){K.error("Failed to update plugin: "+Ke.message)}finally{z(!1)}},$=async(me,be)=>{z(!0);try{const Be=await ue.setPluginEnabled(me,be,null);Be.success?(K.success("Plugin override removed"),await Y()):K.error(Be.error||"Failed to remove override")}catch(Be){K.error("Failed to update plugin: "+Be.message)}finally{z(!1)}},G=me=>{L({open:!0,plugin:me})},F=(s.allPlugins||[]).filter(me=>me.installed).length,te=(s.allPlugins||[]).filter(me=>!me.installed).length,ce=(s.allPlugins||[]).filter(me=>me.sourceType==="internal").length,fe=(s.allPlugins||[]).filter(me=>me.sourceType==="external").length,J=s.marketplaces||[],W=s.categories||[];return e?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-indigo-50 dark:bg-indigo-950/30 border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 flex items-start gap-3",children:[r.jsx(Yu,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-indigo-800 dark:text-indigo-300",children:[r.jsx("p",{className:"font-medium",children:"Install plugins from Project Explorer"}),r.jsxs("p",{className:"text-indigo-600 dark:text-indigo-400 mt-1",children:["Use the ",r.jsx("kbd",{className:"px-1.5 py-0.5 bg-indigo-100 dark:bg-indigo-900 rounded text-xs",children:"+"}),' menu on any project and select "Install Plugins" to add plugins with project-level scope control.']})]})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsxs("div",{className:"p-5 border-b border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[r.jsx(Do,{className:"w-5 h-5 text-indigo-600"}),"Plugin Directory",r.jsxs(tt,{variant:"outline",className:"ml-2 font-normal",children:[H.length," of ",((ae=s.allPlugins)==null?void 0:ae.length)||0]})]}),r.jsx(re,{variant:"ghost",size:"sm",onClick:Y,disabled:e,children:r.jsx(Tr,{className:`w-4 h-4 ${e?"animate-spin":""}`})})]}),r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ec,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),r.jsx(lt,{value:o,onChange:me=>c(me.target.value),placeholder:"Search plugins...",className:"pl-9 bg-white dark:bg-slate-900 border-gray-300 dark:border-slate-700"})]}),r.jsxs(Br,{value:g,onValueChange:b,children:[r.jsx(Pr,{className:"w-40",children:r.jsx($r,{placeholder:"Sort by"})}),r.jsxs(Ar,{children:[r.jsx(Ft,{value:"name",children:"Name"}),r.jsx(Ft,{value:"installed",children:"Installed first"}),r.jsx(Ft,{value:"category",children:"Category"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1",children:[r.jsx(Jd,{className:"w-3 h-3"}),"Marketplace",d.length>0&&r.jsx(tt,{variant:"secondary",className:"ml-1 h-4 px-1 text-[10px]",children:d.length}),r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"start",className:"w-56",children:[r.jsx(xc,{className:"text-xs",children:"Filter by marketplace"}),r.jsx(gs,{}),J.length>0?J.map(me=>r.jsx(gc,{checked:d.includes(me.name),onCheckedChange:()=>X(me.name),children:me.name},me.name)):r.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No marketplaces"}),r.jsx(gs,{}),r.jsxs(Nt,{onClick:()=>M(!0),children:[r.jsx(un,{className:"w-3 h-3 mr-2"}),"Manage Marketplaces"]}),d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(gs,{}),r.jsx(Nt,{onClick:()=>f([]),children:"Clear filters"})]})]})]}),r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1",children:[r.jsx(Rg,{className:"w-3 h-3"}),"Category",u.length>0&&r.jsx(tt,{variant:"secondary",className:"ml-1 h-4 px-1 text-[10px]",children:u.length}),r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"start",className:"w-48",children:[r.jsx(xc,{className:"text-xs",children:"Filter by category"}),r.jsx(gs,{}),W.map(me=>r.jsx(gc,{checked:u.includes(me),onCheckedChange:()=>U(me),children:me},me)),u.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(gs,{}),r.jsx(Nt,{onClick:()=>l([]),children:"Clear filters"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(vt,{checked:j,onCheckedChange:C,className:"h-4 w-7 data-[state=checked]:bg-green-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400",children:["Installed (",F,")"]})]}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(vt,{checked:v,onCheckedChange:y,className:"h-4 w-7 data-[state=checked]:bg-blue-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400",children:["Available (",te,")"]})]}),r.jsx("span",{className:"text-gray-300 dark:text-slate-600",children:"|"}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(vt,{checked:m,onCheckedChange:h,className:"h-4 w-7 data-[state=checked]:bg-indigo-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400 flex items-center gap-1",children:[r.jsx(eS,{className:"w-3 h-3"})," Anthropic (",ce,")"]})]}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(vt,{checked:x,onCheckedChange:w,className:"h-4 w-7 data-[state=checked]:bg-orange-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400 flex items-center gap-1",children:[r.jsx(Yi,{className:"w-3 h-3"})," Community (",fe,")"]})]})]})]})]}),r.jsxs("div",{className:"p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[H.map((me,be)=>{const Be=p_[me.category]||p_.default,Ke=me.mcpServers?Object.keys(me.mcpServers).length:0,Qe=me.lspServers?Object.keys(me.lspServers).length:0,je=`${me.name}@${me.marketplace}`,we=me.enabledState,ve=(we==null?void 0:we.merged)===!0;return(we==null?void 0:we.merged)!==null&&(we==null||we.merged),r.jsxs(Ra.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:Math.min(be*.02,.3)},className:`rounded-lg border p-4 transition-all hover:shadow-md ${ve?"bg-emerald-50 border-emerald-200 dark:bg-emerald-950/20 dark:border-emerald-800":me.installed?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-white border-gray-200 dark:bg-slate-900 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:me.name}),me.sourceType==="external"&&r.jsx(Yi,{className:"w-3.5 h-3.5 text-orange-500 flex-shrink-0",title:"Community plugin"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[me.installed&&r.jsxs(tt,{variant:"outline",className:"text-green-600 border-green-300 dark:text-green-400 dark:border-green-700 text-[10px]",children:[r.jsx(It,{className:"w-2.5 h-2.5 mr-0.5"}),"Installed"]}),ve&&r.jsxs(tt,{variant:"outline",className:"text-emerald-600 border-emerald-300 dark:text-emerald-400 dark:border-emerald-700 text-[10px]",children:[r.jsx(Db,{className:"w-2.5 h-2.5 mr-0.5"}),"Enabled"]})]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[me.installed&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-60 hover:opacity-100",onClick:()=>G(me),children:r.jsx(un,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:r.jsx("p",{children:"Configure per-directory"})})]})}),me.homepage&&r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-60 hover:opacity-100",onClick:()=>window.open(me.homepage,"_blank"),children:r.jsx(hu,{className:"w-4 h-4"})})]})]}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-3 line-clamp-2",children:me.description||"No description available"}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:[me.category&&r.jsx(tt,{variant:"outline",className:`text-[10px] px-1.5 py-0 ${Be}`,children:me.category}),me.version&&r.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-slate-500",children:["v",me.version]})]}),(Ke>0||Qe>0||me.commands)&&r.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-gray-500 dark:text-slate-500 pt-2 border-t border-gray-100 dark:border-slate-800",children:[Qe>0&&r.jsxs("span",{className:"flex items-center gap-1 bg-cyan-50 dark:bg-cyan-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(Gn,{className:"w-3 h-3 text-cyan-600"}),Qe," LSP"]}),Ke>0&&r.jsxs("span",{className:"flex items-center gap-1 bg-blue-50 dark:bg-blue-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(vs,{className:"w-3 h-3 text-blue-600"}),Ke," MCP"]}),me.commands&&r.jsxs("span",{className:"flex items-center gap-1 bg-green-50 dark:bg-green-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(Kt,{className:"w-3 h-3 text-green-600"}),"Commands"]})]})]},je)}),H.length===0&&r.jsxs("div",{className:"col-span-full text-center py-12 text-gray-500 dark:text-slate-400",children:[r.jsx(Do,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{className:"font-medium",children:"No plugins found"}),r.jsx("p",{className:"text-sm mt-1",children:"Try adjusting your filters or search query"}),(u.length>0||d.length>0||o)&&r.jsx(re,{variant:"link",size:"sm",onClick:()=>{l([]),f([]),c("")},className:"mt-2",children:"Clear all filters"})]})]})]}),r.jsx(yt,{open:P.open,onOpenChange:me=>A({...P,open:me}),children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Jd,{className:"w-5 h-5 text-purple-600"}),"Add Plugin Marketplace"]}),r.jsx(tr,{children:"Add a marketplace from a GitHub repository URL or local path."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Repository URL or Path"}),r.jsx(lt,{value:P.repo,onChange:me=>A({...P,repo:me.target.value}),placeholder:"owner/repo or full GitHub URL",className:"mt-1"}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-2",children:"Supported formats:"}),r.jsxs("ul",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 space-y-1 ml-2",children:[r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"owner/repo"})," — GitHub shorthand"]}),r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"https://github.com/owner/repo"})," — Full URL"]}),r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"/local/path"})," — Local directory"]})]}),r.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-2",children:["Search GitHub for ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"claude-plugins"})," to find community marketplaces."]})]})}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:()=>A({open:!1,repo:""}),children:"Cancel"}),r.jsxs(re,{onClick:O,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Marketplace"]})]})]})}),r.jsx(yt,{open:N,onOpenChange:M,children:r.jsxs(ht,{className:"max-w-2xl",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Jd,{className:"w-5 h-5 text-purple-600"}),"Plugin Marketplaces",r.jsx(tt,{variant:"outline",className:"ml-2 font-normal",children:J.length})]}),r.jsx(tr,{children:"Manage your plugin marketplaces. Add external marketplaces to discover more plugins."})]}),r.jsx("div",{className:"py-4",children:J.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:J.map(me=>{var Be,Ke,Qe;const be=(((Be=me.plugins)==null?void 0:Be.length)||0)+(((Ke=me.externalPlugins)==null?void 0:Ke.length)||0);return r.jsxs("div",{className:"bg-purple-50 dark:bg-purple-950/20 rounded-lg border border-purple-200 dark:border-purple-800 p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h3",{className:"font-semibold text-purple-900 dark:text-purple-200",children:me.name}),r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>q(me.name),disabled:k===me.name,className:"h-7 w-7 p-0",children:r.jsx(Tr,{className:`w-4 h-4 text-purple-600 dark:text-purple-400 ${k===me.name?"animate-spin":""}`})})]}),r.jsx("p",{className:"text-sm text-purple-700 dark:text-purple-300 mb-2 truncate",children:typeof me.source=="string"?me.source:((Qe=me.source)==null?void 0:Qe.repo)||"Unknown source"}),r.jsxs("div",{className:"flex items-center justify-between text-xs text-purple-600 dark:text-purple-400",children:[r.jsxs("span",{children:[be," plugins"]}),me.lastUpdated&&r.jsxs("span",{children:["Updated: ",new Date(me.lastUpdated).toLocaleDateString()]})]})]},me.name)})}):r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-slate-400",children:[r.jsx(Jd,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No marketplaces configured."}),r.jsx("p",{className:"text-sm mt-1",children:"Add a marketplace to discover plugins."})]})}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>M(!1),children:"Close"}),r.jsxs(re,{onClick:()=>{M(!1),A({open:!0,repo:""})},className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Marketplace"]})]})]})}),r.jsx(yt,{open:I.open,onOpenChange:me=>L({...I,open:me}),children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Rb,{className:"w-5 h-5 text-emerald-600"}),"Configure Plugin: ",(ne=I.plugin)==null?void 0:ne.name]}),r.jsx(tr,{children:"Enable or disable this plugin for specific directories. Child directories inherit parent settings unless overridden."})]}),r.jsxs("div",{className:"space-y-3 py-4 max-h-[400px] overflow-y-auto",children:[(Ce=(le=(Z=I.plugin)==null?void 0:Z.enabledState)==null?void 0:le.perDir)==null?void 0:Ce.map((me,be)=>{const Be=`${I.plugin.name}@${I.plugin.marketplace}`,Ke=me.enabled!==null&&me.enabled!==void 0,Qe=me.enabled===!0,je=me.enabled===!1;let we=null;if(!Ke&&be>0)for(let ve=be-1;ve>=0;ve--){const _e=I.plugin.enabledState.perDir[ve];if(_e.enabled!==null&&_e.enabled!==void 0){we=_e.enabled;break}}return r.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg border ${Qe?"bg-emerald-50 border-emerald-200 dark:bg-emerald-950/30 dark:border-emerald-800":je?"bg-red-50 border-red-200 dark:bg-red-950/30 dark:border-red-800":"bg-gray-50 border-gray-200 dark:bg-slate-800/50 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:me.label}),!Ke&&we!==null&&r.jsxs(tt,{variant:"outline",className:"text-[10px] text-gray-500",children:["inherited: ",we?"on":"off"]})]}),Ke&&r.jsx("p",{className:"text-[10px] text-gray-500 dark:text-slate-400 mt-0.5",children:Qe?"Explicitly enabled":"Explicitly disabled"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[Ke&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-gray-400 hover:text-gray-600",onClick:()=>$(me.dir,Be),disabled:B,children:r.jsx(jM,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:r.jsx("p",{children:"Remove override (inherit from parent)"})})]})}),r.jsxs("div",{className:"flex items-center gap-1 border rounded-lg overflow-hidden",children:[r.jsx(re,{variant:Qe?"default":"ghost",size:"sm",className:`h-7 px-2 rounded-none ${Qe?"bg-emerald-600 hover:bg-emerald-700 text-white":""}`,onClick:()=>R(me.dir,Be,!1),disabled:B||Qe,children:r.jsx(Db,{className:"w-3 h-3"})}),r.jsx(re,{variant:je?"default":"ghost",size:"sm",className:`h-7 px-2 rounded-none ${je?"bg-red-600 hover:bg-red-700 text-white":""}`,onClick:()=>R(me.dir,Be,!0),disabled:B||je,children:r.jsx(WM,{className:"w-3 h-3"})})]})]})]},me.dir)}),(!((Ge=(Le=I.plugin)==null?void 0:Le.enabledState)!=null&&Ge.perDir)||I.plugin.enabledState.perDir.length===0)&&r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-slate-400",children:[r.jsx(Rb,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No config hierarchy found."}),r.jsx("p",{className:"text-sm mt-1",children:"Create a .claude/mcps.json in your project first."})]})]}),r.jsx(St,{children:r.jsx(re,{variant:"ghost",onClick:()=>L({open:!1,plugin:null}),children:"Done"})})]})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands (Claude Code)"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{className:"text-gray-400 dark:text-slate-500",children:"# Add marketplace (one-time)"}),r.jsx("p",{children:"claude plugin marketplace add regression-io/coder-config-plugins"}),r.jsx("p",{className:"text-gray-400 dark:text-slate-500 mt-2",children:"# Install plugins from marketplace"}),r.jsx("p",{children:"claude plugin install <name>@coder-config-plugins"}),r.jsx("p",{className:"text-gray-400 dark:text-slate-500 mt-2",children:"# Manage plugins"}),r.jsx("p",{children:"claude plugin list # List installed"}),r.jsx("p",{children:"claude plugin uninstall <name> # Remove plugin"})]})]})]})}function mW({onWorkstreamChange:e}){var io,Tn,Ko,oo,Zn,fs,ao,Mr;const{projects:t,fetch:s}=Ex(),{workstreams:n,loading:o,fetch:c,create:u,update:l,delete:d,addProject:f,removeProject:m,countWorkstreamsForProject:h}=vN(),[x,w]=_.useState(null),[j,C]=_.useState(!1),[v,y]=_.useState(null),[g,b]=_.useState(!1),[k,E]=_.useState(null),[P,A]=_.useState(new Set),[N,M]=_.useState(""),[I,L]=_.useState(""),[B,z]=_.useState([]),[Y,H]=_.useState(!1),[U,X]=_.useState(!1),[q,O]=_.useState({}),[R,$]=_.useState({}),[G,F]=_.useState({}),[te,ce]=_.useState({isInstalled:!1,loading:!0}),[fe,J]=_.useState(!1),[W,ae]=_.useState(null),[ne,Z]=_.useState([]),[le,Ce]=_.useState(!1),[Le,Ge]=_.useState(()=>{try{return JSON.parse(localStorage.getItem("dismissedWorkstreamSuggestions")||"[]")}catch{return[]}}),[me,be]=_.useState(!1),[Be,Ke]=_.useState(""),[Qe,je]=_.useState([]),[we,ve]=_.useState("llama3.2"),[_e,Oe]=_.useState(null),[de,ye]=_.useState(""),[De,ze]=_.useState(!1),[Je,Et]=_.useState({installed:!1,loading:!0}),[at,ur]=_.useState({workstreamAutoActivate:!0}),[Rr,Wr]=_.useState(!1),[Jt,Cr]=_.useState(!1),[Wt,yr]=_.useState(null),[us,Xr]=_.useState("");_.useEffect(()=>{c(),s(),zt(),rr(),Os(),it(),Ls()},[c,s]);const Ls=async()=>{try{const Q=await ue.getAvailableAITools();Q.success&&Q.tools&&(je(Q.tools),Q.tools.find(qe=>qe.id==="claude"&&qe.available)&&Ke("claude"))}catch(Q){console.error("Failed to load AI tools:",Q)}},Os=async()=>{try{const Q=await ue.getCdHookStatus();Et({...Q,loading:!1})}catch(Q){Et({installed:!1,loading:!1,error:Q.message})}},it=async()=>{try{const Q=await ue.getWorkstreamSettings();ur(Q.settings||{workstreamAutoActivate:!0})}catch(Q){console.error("Failed to load global settings:",Q)}},zt=async()=>{try{const Q=await ue.getWorkstreamHookStatus();ce({...Q,loading:!1})}catch(Q){ce({isInstalled:!1,loading:!1,error:Q.message})}},rr=async()=>{try{Ce(!0);const[Q,Ie]=await Promise.all([ue.getActivitySummary(),ue.getWorkstreamSuggestions()]);ae(Q),Z(Ie.suggestions||[])}catch(Q){console.log("Activity data not available:",Q.message)}finally{Ce(!1)}},ar=Q=>{M(Q.name),z([...Q.projects]),L(`# Auto-generated workstream based on activity patterns
2999
+ `);if(n.length<2)return s;const o=n[0].split("|").filter(u=>u.trim()).map(u=>`<th class="border border-border px-3 py-2 bg-muted font-semibold text-left">${u.trim()}</th>`).join(""),c=n.slice(2).map(u=>`<tr>${u.split("|").filter(d=>d.trim()).map(d=>`<td class="border border-border px-3 py-2">${d.trim()}</td>`).join("")}</tr>`).join("");return`<table class="w-full border-collapse border border-border my-4"><thead><tr>${o}</tr></thead><tbody>${c}</tbody></table>`}),t.replace(/^### (.*$)/gim,'<h3 class="text-lg font-semibold mt-6 mb-2 text-foreground">$1</h3>').replace(/^## (.*$)/gim,'<h2 class="text-xl font-semibold mt-8 mb-4 text-foreground">$1</h2>').replace(/^# (.*$)/gim,'<h1 class="text-2xl font-bold mb-6 text-foreground">$1</h1>').replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1" class="rounded-lg shadow-lg my-4 max-w-full border border-border" />').replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`([^`]+)`/g,'<code class="bg-muted px-1.5 py-0.5 rounded text-sm font-mono">$1</code>').replace(/^- (.*$)/gim,'<li class="ml-4">$1</li>').replace(/(<li.*<\/li>\n?)+/g,'<ul class="list-disc my-2">$&</ul>').replace(/^\d+\. (.*$)/gim,'<li class="ml-4">$1</li>').replace(/\n\n/g,'</p><p class="my-3 text-foreground">').replace(/\n/g,"<br/>")}function uW(){const[e,t]=_.useState("installation"),[s,n]=_.useState({"getting-started":!0}),o=u=>{n(l=>({...l,[u]:!l[u]}))},c=dW[e];return r.jsxs("div",{className:"flex h-full",children:[r.jsxs("div",{className:"w-64 border-r border-border bg-muted/50 flex flex-col",children:[r.jsx("div",{className:"p-4 border-b border-border",children:r.jsxs("h2",{className:"font-semibold flex items-center gap-2 text-foreground",children:[r.jsx(To,{className:"w-5 h-5"}),"Documentation"]})}),r.jsx(Ys,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:GH.map(u=>r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{className:Ee("w-full flex items-center gap-2 px-3 py-2 text-sm rounded-md hover:bg-accent text-left",(e===u.id||u.subsections.some(l=>l.id===e))&&"bg-accent"),onClick:()=>{u.subsections.length>0?(o(u.id),s[u.id]||t(u.subsections[0].id)):t(u.id)},children:[r.jsx(u.icon,{className:"w-4 h-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1",children:u.title}),u.isNew&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-green-500/20 text-green-600 dark:text-green-400",children:"new"}),u.subsections.length>0&&r.jsx(xs,{className:Ee("w-4 h-4 text-muted-foreground transition-transform",s[u.id]&&"rotate-90")})]}),u.subsections.length>0&&s[u.id]&&r.jsx("div",{className:"ml-6 mt-1 space-y-1",children:u.subsections.map(l=>r.jsx("button",{className:Ee("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground",e===l.id&&"bg-accent text-primary font-medium"),onClick:()=>t(l.id),children:l.title},l.id))})]},u.id))})})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(Ys,{className:"h-full",children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:c?r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:x2(c.content)}})}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(To,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a topic from the sidebar"})]})})})})]})}var hW={};const p_={development:"bg-blue-100 text-blue-700 border-blue-200 dark:bg-blue-900/30 dark:text-blue-400 dark:border-blue-800",productivity:"bg-green-100 text-green-700 border-green-200 dark:bg-green-900/30 dark:text-green-400 dark:border-green-800",integration:"bg-purple-100 text-purple-700 border-purple-200 dark:bg-purple-900/30 dark:text-purple-400 dark:border-purple-800",external:"bg-orange-100 text-orange-700 border-orange-200 dark:bg-orange-900/30 dark:text-orange-400 dark:border-orange-800",lsp:"bg-cyan-100 text-cyan-700 border-cyan-200 dark:bg-cyan-900/30 dark:text-cyan-400 dark:border-cyan-800",default:"bg-gray-100 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-700"};function fW(){var ae,ne,Z,le,Ce,Le,Ge;const[e,t]=_.useState(!0),[s,n]=_.useState({allPlugins:[],categories:[],marketplaces:[],enabledPlugins:null}),[o,c]=_.useState(""),[u,l]=_.useState([]),[d,f]=_.useState([]),[m,h]=_.useState(!0),[x,w]=_.useState(!0),[j,C]=_.useState(!0),[v,y]=_.useState(!0),[g,b]=_.useState("name"),[k,E]=_.useState(null),[P,A]=_.useState({open:!1,repo:""}),[N,M]=_.useState(!1),[I,L]=_.useState({open:!1,plugin:null}),[B,z]=_.useState(!1),Y=async()=>{t(!0);try{const me=await ue.getPlugins();n(me)}catch(me){K.error("Failed to load plugins: "+me.message)}finally{t(!1)}};_.useEffect(()=>{Y()},[]);const H=_.useMemo(()=>{let me=s.allPlugins||[];if(o){const be=o.toLowerCase();me=me.filter(Be=>{var Ke,Qe,je;return((Ke=Be.name)==null?void 0:Ke.toLowerCase().includes(be))||((Qe=Be.description)==null?void 0:Qe.toLowerCase().includes(be))||((je=Be.category)==null?void 0:je.toLowerCase().includes(be))})}return me=me.filter(be=>!(be.sourceType==="external"&&!x||be.sourceType==="internal"&&!m)),me=me.filter(be=>!(be.installed&&!j||!be.installed&&!v)),u.length>0&&(me=me.filter(be=>u.includes(be.category))),d.length>0&&(me=me.filter(be=>d.includes(be.marketplace))),me.sort((be,Be)=>{if(g==="installed"){if(be.installed&&!Be.installed)return-1;if(!be.installed&&Be.installed)return 1}if(g==="category"){const Ke=(be.category||"zzz").localeCompare(Be.category||"zzz");if(Ke!==0)return Ke}return be.name.localeCompare(Be.name)}),me},[s.allPlugins,o,x,m,j,v,u,d,g]),U=me=>{l(be=>be.includes(me)?be.filter(Be=>Be!==me):[...be,me])},X=me=>{f(be=>be.includes(me)?be.filter(Be=>Be!==me):[...be,me])},q=async me=>{E(me);try{const be=await ue.refreshMarketplace(me);be.success?(K.success(`Refreshed ${me}`),await Y()):K.error(be.error||"Failed to refresh marketplace")}catch(be){K.error("Failed to refresh: "+be.message)}finally{E(null)}},O=async()=>{if(!P.repo.trim()){K.error("Please enter a repository URL");return}try{const me=await ue.addMarketplace("",P.repo.trim());me.success?(K.success("Marketplace added"),A({open:!1,repo:""}),await Y()):K.error(me.error||"Failed to add marketplace")}catch(me){K.error("Failed to add marketplace: "+me.message)}},R=async(me,be,Be)=>{z(!0);try{const Ke=Be!==!0,Qe=await ue.setPluginEnabled(me,be,Ke);Qe.success?(K.success(`Plugin ${Ke?"enabled":"disabled"} for ${me===hW.HOME?"~":me}`),await Y()):K.error(Qe.error||"Failed to update plugin state")}catch(Ke){K.error("Failed to update plugin: "+Ke.message)}finally{z(!1)}},$=async(me,be)=>{z(!0);try{const Be=await ue.setPluginEnabled(me,be,null);Be.success?(K.success("Plugin override removed"),await Y()):K.error(Be.error||"Failed to remove override")}catch(Be){K.error("Failed to update plugin: "+Be.message)}finally{z(!1)}},G=me=>{L({open:!0,plugin:me})},F=(s.allPlugins||[]).filter(me=>me.installed).length,te=(s.allPlugins||[]).filter(me=>!me.installed).length,ce=(s.allPlugins||[]).filter(me=>me.sourceType==="internal").length,fe=(s.allPlugins||[]).filter(me=>me.sourceType==="external").length,J=s.marketplaces||[],W=s.categories||[];return e?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-indigo-50 dark:bg-indigo-950/30 border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 flex items-start gap-3",children:[r.jsx(Yu,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-indigo-800 dark:text-indigo-300",children:[r.jsx("p",{className:"font-medium",children:"Install plugins from Project Explorer"}),r.jsxs("p",{className:"text-indigo-600 dark:text-indigo-400 mt-1",children:["Use the ",r.jsx("kbd",{className:"px-1.5 py-0.5 bg-indigo-100 dark:bg-indigo-900 rounded text-xs",children:"+"}),' menu on any project and select "Install Plugins" to add plugins with project-level scope control.']})]})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsxs("div",{className:"p-5 border-b border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[r.jsx(Do,{className:"w-5 h-5 text-indigo-600"}),"Plugin Directory",r.jsxs(tt,{variant:"outline",className:"ml-2 font-normal",children:[H.length," of ",((ae=s.allPlugins)==null?void 0:ae.length)||0]})]}),r.jsx(re,{variant:"ghost",size:"sm",onClick:Y,disabled:e,children:r.jsx(Tr,{className:`w-4 h-4 ${e?"animate-spin":""}`})})]}),r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ec,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),r.jsx(lt,{value:o,onChange:me=>c(me.target.value),placeholder:"Search plugins...",className:"pl-9 bg-white dark:bg-slate-900 border-gray-300 dark:border-slate-700"})]}),r.jsxs(Br,{value:g,onValueChange:b,children:[r.jsx(Pr,{className:"w-40",children:r.jsx($r,{placeholder:"Sort by"})}),r.jsxs(Ar,{children:[r.jsx(Ft,{value:"name",children:"Name"}),r.jsx(Ft,{value:"installed",children:"Installed first"}),r.jsx(Ft,{value:"category",children:"Category"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1",children:[r.jsx(Jd,{className:"w-3 h-3"}),"Marketplace",d.length>0&&r.jsx(tt,{variant:"secondary",className:"ml-1 h-4 px-1 text-[10px]",children:d.length}),r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"start",className:"w-56",children:[r.jsx(xc,{className:"text-xs",children:"Filter by marketplace"}),r.jsx(gs,{}),J.length>0?J.map(me=>r.jsx(gc,{checked:d.includes(me.name),onCheckedChange:()=>X(me.name),children:me.name},me.name)):r.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No marketplaces"}),r.jsx(gs,{}),r.jsxs(Nt,{onClick:()=>M(!0),children:[r.jsx(un,{className:"w-3 h-3 mr-2"}),"Manage Marketplaces"]}),d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(gs,{}),r.jsx(Nt,{onClick:()=>f([]),children:"Clear filters"})]})]})]}),r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1",children:[r.jsx(Rg,{className:"w-3 h-3"}),"Category",u.length>0&&r.jsx(tt,{variant:"secondary",className:"ml-1 h-4 px-1 text-[10px]",children:u.length}),r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"start",className:"w-48",children:[r.jsx(xc,{className:"text-xs",children:"Filter by category"}),r.jsx(gs,{}),W.map(me=>r.jsx(gc,{checked:u.includes(me),onCheckedChange:()=>U(me),children:me},me)),u.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(gs,{}),r.jsx(Nt,{onClick:()=>l([]),children:"Clear filters"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(vt,{checked:j,onCheckedChange:C,className:"h-4 w-7 data-[state=checked]:bg-green-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400",children:["Installed (",F,")"]})]}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(vt,{checked:v,onCheckedChange:y,className:"h-4 w-7 data-[state=checked]:bg-blue-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400",children:["Available (",te,")"]})]}),r.jsx("span",{className:"text-gray-300 dark:text-slate-600",children:"|"}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(vt,{checked:m,onCheckedChange:h,className:"h-4 w-7 data-[state=checked]:bg-indigo-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400 flex items-center gap-1",children:[r.jsx(eS,{className:"w-3 h-3"})," Anthropic (",ce,")"]})]}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(vt,{checked:x,onCheckedChange:w,className:"h-4 w-7 data-[state=checked]:bg-orange-600"}),r.jsxs("span",{className:"text-gray-600 dark:text-slate-400 flex items-center gap-1",children:[r.jsx(Yi,{className:"w-3 h-3"})," Community (",fe,")"]})]})]})]})]}),r.jsxs("div",{className:"p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[H.map((me,be)=>{const Be=p_[me.category]||p_.default,Ke=me.mcpServers?Object.keys(me.mcpServers).length:0,Qe=me.lspServers?Object.keys(me.lspServers).length:0,je=`${me.name}@${me.marketplace}`,we=me.enabledState,ve=(we==null?void 0:we.merged)===!0;return(we==null?void 0:we.merged)!==null&&(we==null||we.merged),r.jsxs(Ra.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:Math.min(be*.02,.3)},className:`rounded-lg border p-4 transition-all hover:shadow-md ${ve?"bg-emerald-50 border-emerald-200 dark:bg-emerald-950/20 dark:border-emerald-800":me.installed?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-white border-gray-200 dark:bg-slate-900 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:me.name}),me.sourceType==="external"&&r.jsx(Yi,{className:"w-3.5 h-3.5 text-orange-500 flex-shrink-0",title:"Community plugin"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[me.installed&&r.jsxs(tt,{variant:"outline",className:"text-green-600 border-green-300 dark:text-green-400 dark:border-green-700 text-[10px]",children:[r.jsx(It,{className:"w-2.5 h-2.5 mr-0.5"}),"Installed"]}),ve&&r.jsxs(tt,{variant:"outline",className:"text-emerald-600 border-emerald-300 dark:text-emerald-400 dark:border-emerald-700 text-[10px]",children:[r.jsx(Db,{className:"w-2.5 h-2.5 mr-0.5"}),"Enabled"]})]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[me.installed&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-60 hover:opacity-100",onClick:()=>G(me),children:r.jsx(un,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:r.jsx("p",{children:"Configure per-directory"})})]})}),me.homepage&&r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-60 hover:opacity-100",onClick:()=>window.open(me.homepage,"_blank"),children:r.jsx(hu,{className:"w-4 h-4"})})]})]}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-3 line-clamp-2",children:me.description||"No description available"}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:[me.category&&r.jsx(tt,{variant:"outline",className:`text-[10px] px-1.5 py-0 ${Be}`,children:me.category}),me.version&&r.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-slate-500",children:["v",me.version]})]}),(Ke>0||Qe>0||me.commands)&&r.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-gray-500 dark:text-slate-500 pt-2 border-t border-gray-100 dark:border-slate-800",children:[Qe>0&&r.jsxs("span",{className:"flex items-center gap-1 bg-cyan-50 dark:bg-cyan-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(Gn,{className:"w-3 h-3 text-cyan-600"}),Qe," LSP"]}),Ke>0&&r.jsxs("span",{className:"flex items-center gap-1 bg-blue-50 dark:bg-blue-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(vs,{className:"w-3 h-3 text-blue-600"}),Ke," MCP"]}),me.commands&&r.jsxs("span",{className:"flex items-center gap-1 bg-green-50 dark:bg-green-900/20 px-1.5 py-0.5 rounded",children:[r.jsx(Kt,{className:"w-3 h-3 text-green-600"}),"Commands"]})]})]},je)}),H.length===0&&r.jsxs("div",{className:"col-span-full text-center py-12 text-gray-500 dark:text-slate-400",children:[r.jsx(Do,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{className:"font-medium",children:"No plugins found"}),r.jsx("p",{className:"text-sm mt-1",children:"Try adjusting your filters or search query"}),(u.length>0||d.length>0||o)&&r.jsx(re,{variant:"link",size:"sm",onClick:()=>{l([]),f([]),c("")},className:"mt-2",children:"Clear all filters"})]})]})]}),r.jsx(yt,{open:P.open,onOpenChange:me=>A({...P,open:me}),children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Jd,{className:"w-5 h-5 text-purple-600"}),"Add Plugin Marketplace"]}),r.jsx(tr,{children:"Add a marketplace from a GitHub repository URL or local path."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Repository URL or Path"}),r.jsx(lt,{value:P.repo,onChange:me=>A({...P,repo:me.target.value}),placeholder:"owner/repo or full GitHub URL",className:"mt-1"}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-2",children:"Supported formats:"}),r.jsxs("ul",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 space-y-1 ml-2",children:[r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"owner/repo"})," — GitHub shorthand"]}),r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"https://github.com/owner/repo"})," — Full URL"]}),r.jsxs("li",{children:[r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"/local/path"})," — Local directory"]})]}),r.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-2",children:["Search GitHub for ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-700 px-1 rounded",children:"claude-plugins"})," to find community marketplaces."]})]})}),r.jsxs(St,{children:[r.jsx(re,{variant:"ghost",onClick:()=>A({open:!1,repo:""}),children:"Cancel"}),r.jsxs(re,{onClick:O,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Marketplace"]})]})]})}),r.jsx(yt,{open:N,onOpenChange:M,children:r.jsxs(ht,{className:"max-w-2xl",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Jd,{className:"w-5 h-5 text-purple-600"}),"Plugin Marketplaces",r.jsx(tt,{variant:"outline",className:"ml-2 font-normal",children:J.length})]}),r.jsx(tr,{children:"Manage your plugin marketplaces. Add external marketplaces to discover more plugins."})]}),r.jsx("div",{className:"py-4",children:J.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:J.map(me=>{var Be,Ke,Qe;const be=(((Be=me.plugins)==null?void 0:Be.length)||0)+(((Ke=me.externalPlugins)==null?void 0:Ke.length)||0);return r.jsxs("div",{className:"bg-purple-50 dark:bg-purple-950/20 rounded-lg border border-purple-200 dark:border-purple-800 p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h3",{className:"font-semibold text-purple-900 dark:text-purple-200",children:me.name}),r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>q(me.name),disabled:k===me.name,className:"h-7 w-7 p-0",children:r.jsx(Tr,{className:`w-4 h-4 text-purple-600 dark:text-purple-400 ${k===me.name?"animate-spin":""}`})})]}),r.jsx("p",{className:"text-sm text-purple-700 dark:text-purple-300 mb-2 truncate",children:typeof me.source=="string"?me.source:((Qe=me.source)==null?void 0:Qe.repo)||"Unknown source"}),r.jsxs("div",{className:"flex items-center justify-between text-xs text-purple-600 dark:text-purple-400",children:[r.jsxs("span",{children:[be," plugins"]}),me.lastUpdated&&r.jsxs("span",{children:["Updated: ",new Date(me.lastUpdated).toLocaleDateString()]})]})]},me.name)})}):r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-slate-400",children:[r.jsx(Jd,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No marketplaces configured."}),r.jsx("p",{className:"text-sm mt-1",children:"Add a marketplace to discover plugins."})]})}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>M(!1),children:"Close"}),r.jsxs(re,{onClick:()=>{M(!1),A({open:!0,repo:""})},className:"bg-purple-600 hover:bg-purple-700 text-white",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Marketplace"]})]})]})}),r.jsx(yt,{open:I.open,onOpenChange:me=>L({...I,open:me}),children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsxs(ft,{children:[r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Rb,{className:"w-5 h-5 text-emerald-600"}),"Configure Plugin: ",(ne=I.plugin)==null?void 0:ne.name]}),r.jsx(tr,{children:"Enable or disable this plugin for specific directories. Child directories inherit parent settings unless overridden."})]}),r.jsxs("div",{className:"space-y-3 py-4 max-h-[400px] overflow-y-auto",children:[(Ce=(le=(Z=I.plugin)==null?void 0:Z.enabledState)==null?void 0:le.perDir)==null?void 0:Ce.map((me,be)=>{const Be=`${I.plugin.name}@${I.plugin.marketplace}`,Ke=me.enabled!==null&&me.enabled!==void 0,Qe=me.enabled===!0,je=me.enabled===!1;let we=null;if(!Ke&&be>0)for(let ve=be-1;ve>=0;ve--){const _e=I.plugin.enabledState.perDir[ve];if(_e.enabled!==null&&_e.enabled!==void 0){we=_e.enabled;break}}return r.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg border ${Qe?"bg-emerald-50 border-emerald-200 dark:bg-emerald-950/30 dark:border-emerald-800":je?"bg-red-50 border-red-200 dark:bg-red-950/30 dark:border-red-800":"bg-gray-50 border-gray-200 dark:bg-slate-800/50 dark:border-slate-700"}`,children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:me.label}),!Ke&&we!==null&&r.jsxs(tt,{variant:"outline",className:"text-[10px] text-gray-500",children:["inherited: ",we?"on":"off"]})]}),Ke&&r.jsx("p",{className:"text-[10px] text-gray-500 dark:text-slate-400 mt-0.5",children:Qe?"Explicitly enabled":"Explicitly disabled"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[Ke&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-gray-400 hover:text-gray-600",onClick:()=>$(me.dir,Be),disabled:B,children:r.jsx(jM,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:r.jsx("p",{children:"Remove override (inherit from parent)"})})]})}),r.jsxs("div",{className:"flex items-center gap-1 border rounded-lg overflow-hidden",children:[r.jsx(re,{variant:Qe?"default":"ghost",size:"sm",className:`h-7 px-2 rounded-none ${Qe?"bg-emerald-600 hover:bg-emerald-700 text-white":""}`,onClick:()=>R(me.dir,Be,!1),disabled:B||Qe,children:r.jsx(Db,{className:"w-3 h-3"})}),r.jsx(re,{variant:je?"default":"ghost",size:"sm",className:`h-7 px-2 rounded-none ${je?"bg-red-600 hover:bg-red-700 text-white":""}`,onClick:()=>R(me.dir,Be,!0),disabled:B||je,children:r.jsx(WM,{className:"w-3 h-3"})})]})]})]},me.dir)}),(!((Ge=(Le=I.plugin)==null?void 0:Le.enabledState)!=null&&Ge.perDir)||I.plugin.enabledState.perDir.length===0)&&r.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-slate-400",children:[r.jsx(Rb,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No config hierarchy found."}),r.jsx("p",{className:"text-sm mt-1",children:"Create a .claude/mcps.json in your project first."})]})]}),r.jsx(St,{children:r.jsx(re,{variant:"ghost",onClick:()=>L({open:!1,plugin:null}),children:"Done"})})]})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands (Claude Code)"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{className:"text-gray-400 dark:text-slate-500",children:"# Add marketplace (one-time)"}),r.jsx("p",{children:"claude plugin marketplace add regression-io/coder-config-plugins"}),r.jsx("p",{className:"text-gray-400 dark:text-slate-500 mt-2",children:"# Install plugins from marketplace"}),r.jsx("p",{children:"claude plugin install <name>@coder-config-plugins"}),r.jsx("p",{className:"text-gray-400 dark:text-slate-500 mt-2",children:"# Manage plugins"}),r.jsx("p",{children:"claude plugin list # List installed"}),r.jsx("p",{children:"claude plugin uninstall <name> # Remove plugin"})]})]})]})}function mW({onWorkstreamChange:e}){var io,Tn,Ko,oo,Zn,fs,ao,Mr;const{projects:t,fetch:s}=Ex(),{workstreams:n,loading:o,fetch:c,create:u,update:l,delete:d,addProject:f,removeProject:m,countWorkstreamsForProject:h}=vN(),[x,w]=_.useState(null),[j,C]=_.useState(!1),[v,y]=_.useState(null),[g,b]=_.useState(!1),[k,E]=_.useState(null),[P,A]=_.useState(new Set),[N,M]=_.useState(""),[I,L]=_.useState(""),[B,z]=_.useState([]),[Y,H]=_.useState(!1),[U,X]=_.useState(!1),[q,O]=_.useState({}),[R,$]=_.useState({}),[G,F]=_.useState({}),[te,ce]=_.useState({isInstalled:!1,loading:!0}),[fe,J]=_.useState(!1),[W,ae]=_.useState(null),[ne,Z]=_.useState([]),[le,Ce]=_.useState(!1),[Le,Ge]=_.useState(()=>{try{return JSON.parse(localStorage.getItem("dismissedWorkstreamSuggestions")||"[]")}catch{return[]}}),[me,be]=_.useState(!1),[Be,Ke]=_.useState(""),[Qe,je]=_.useState([]),[we,ve]=_.useState("llama3.2"),[_e,Oe]=_.useState(null),[de,ye]=_.useState(""),[Re,ze]=_.useState(!1),[Je,Et]=_.useState({installed:!1,loading:!0}),[at,ur]=_.useState({workstreamAutoActivate:!0}),[Rr,Wr]=_.useState(!1),[Jt,Cr]=_.useState(!1),[Wt,yr]=_.useState(null),[us,Xr]=_.useState("");_.useEffect(()=>{c(),s(),zt(),rr(),Os(),it(),Ls()},[c,s]);const Ls=async()=>{try{const Q=await ue.getAvailableAITools();Q.success&&Q.tools&&(je(Q.tools),Q.tools.find(qe=>qe.id==="claude"&&qe.available)&&Ke("claude"))}catch(Q){console.error("Failed to load AI tools:",Q)}},Os=async()=>{try{const Q=await ue.getCdHookStatus();Et({...Q,loading:!1})}catch(Q){Et({installed:!1,loading:!1,error:Q.message})}},it=async()=>{try{const Q=await ue.getWorkstreamSettings();ur(Q.settings||{workstreamAutoActivate:!0})}catch(Q){console.error("Failed to load global settings:",Q)}},zt=async()=>{try{const Q=await ue.getWorkstreamHookStatus();ce({...Q,loading:!1})}catch(Q){ce({isInstalled:!1,loading:!1,error:Q.message})}},rr=async()=>{try{Ce(!0);const[Q,Ie]=await Promise.all([ue.getActivitySummary(),ue.getWorkstreamSuggestions()]);ae(Q),Z(Ie.suggestions||[])}catch(Q){console.log("Activity data not available:",Q.message)}finally{Ce(!1)}},ar=Q=>{M(Q.name),z([...Q.projects]),L(`# Auto-generated workstream based on activity patterns
3000
3000
 
3001
3001
  These projects are frequently worked on together.`),C(!0)},ws=Q=>{z(Ie=>Ie.filter(qe=>qe!==Q))},Vt=Q=>{B.includes(Q)||z(Ie=>[...Ie,Q])},Ut=async Q=>{const Ie=q[Q];if(!Ie&&!R[Q]){F(qe=>({...qe,[Q]:!0}));try{const qe=await ue.getSubprojects(Q);$(kt=>({...kt,[Q]:qe.subprojects||[]}))}catch(qe){console.error("Failed to load subprojects:",qe),$(kt=>({...kt,[Q]:[]}))}finally{F(qe=>({...qe,[Q]:!1}))}}O(qe=>({...qe,[Q]:!Ie}))},Vr=Q=>{const Ie=Q.projects.sort().join("|"),qe=[...Le,Ie];Ge(qe),localStorage.setItem("dismissedWorkstreamSuggestions",JSON.stringify(qe)),Z(kt=>kt.filter($t=>$t.projects.sort().join("|")!==Ie)),K.success("Suggestion dismissed")},ut=ne.filter(Q=>{const Ie=Q.projects.sort().join("|");return!Le.includes(Ie)}),hr=async()=>{if(confirm("Clear activity data older than 30 days?"))try{const Q=await ue.clearActivity(30);Q.success&&(K.success(`Cleared ${Q.cleared} old entries`),rr())}catch(Q){K.error("Failed to clear activity: "+Q.message)}},hs=async(Q,Ie)=>{var qe;if(!Q||Q.length===0){K.error("Add projects first to generate rules");return}be(!0);try{const kt=Be==="ollama"?{model:we}:{},$t=await ue.generateWorkstreamRules(Q,Be||!1,kt);if($t.success&&$t.rules){Ie($t.rules);const jt=((qe=Qe.find(sr=>sr.id===Be))==null?void 0:qe.name)||"AI";K.success(Be?`Generated rules with ${jt}`:"Generated rules from repos")}else K.error($t.error||"Failed to generate rules")}catch(kt){K.error("Failed to generate rules: "+kt.message)}finally{be(!1)}},Qr=async()=>{J(!0);try{const Q=await ue.installWorkstreamHook();Q.success?(K.success(Q.message),ce(Ie=>({...Ie,isInstalled:!0}))):K.error(Q.error||"Failed to install hook")}catch(Q){K.error("Failed to install hook: "+Q.message)}finally{J(!1)}},Ze=async()=>{Wr(!0);try{const Q=await ue.installCdHook();Q.success?(K.success("CD hook installed. Restart your shell to activate."),Et(Ie=>({...Ie,installed:!0}))):K.error(Q.error||"Failed to install CD hook")}catch(Q){K.error("Failed to install CD hook: "+Q.message)}finally{Wr(!1)}},fn=async()=>{Wr(!0);try{const Q=await ue.uninstallCdHook();Q.success?(K.success("CD hook uninstalled. Restart your shell to apply."),Et(Ie=>({...Ie,installed:!1}))):K.error(Q.error||"Failed to uninstall CD hook")}catch(Q){K.error("Failed to uninstall CD hook: "+Q.message)}finally{Wr(!1)}},al=async()=>{const Q=!at.workstreamAutoActivate;try{await ue.setGlobalAutoActivate(Q),ur(Ie=>({...Ie,workstreamAutoActivate:Q})),K.success(`Auto-activation ${Q?"enabled":"disabled"}`)}catch(Ie){K.error("Failed to update setting: "+Ie.message)}},Zr=async(Q,Ie)=>{try{(await ue.setWorkstreamAutoActivate(Q.id,Ie)).success&&(await c(),K.success(`Auto-activate ${Ie} for ${Q.name}`))}catch(qe){K.error("Failed to update: "+qe.message)}},wi=async()=>{if(!(!Wt||!us.trim()))try{(await ue.addTriggerFolder(Wt.id,us.trim())).success&&(await c(),K.success("Trigger folder added"),Cr(!1),Xr(""),yr(null))}catch(Q){K.error("Failed to add trigger folder: "+Q.message)}},mn=async(Q,Ie)=>{try{(await ue.removeTriggerFolder(Q.id,Ie)).success&&(await c(),K.success("Trigger folder removed"))}catch(qe){K.error("Failed to remove trigger folder: "+qe.message)}},Sr=()=>c(),so=async()=>{if(!N.trim()){K.error("Name is required");return}H(!0);const Q=await u(N.trim(),B,I);Q.success?(K.success(`Created workstream: ${N}`),C(!1),M(""),L(""),z([]),Z(Ie=>Ie.filter(qe=>qe.name!==N.trim()))):K.error(Q.error||"Failed to create workstream"),H(!1)},Wo=async Q=>{if(!confirm(`Delete workstream "${Q.name}"?
3002
3002
 
3003
- This cannot be undone.`))return;const Ie=await d(Q.id);Ie.success?K.success(`Deleted workstream: ${Q.name}`):K.error(Ie.error||"Failed to delete workstream")},Vo=async()=>{if(!v)return;H(!0);const Q=await l(v.id,{name:v.name,rules:v.rules,projects:v.projects||[]});Q.success?(K.success("Workstream updated"),y(null)):K.error(Q.error||"Failed to update workstream"),H(!1)},_i=Q=>{Oe(Q.id),ye(Q.rules||"")},Uo=()=>{Oe(null),ye("")},Go=async Q=>{ze(!0);try{const Ie=await ue.updateWorkstream(Q.id,{name:Q.name,rules:de,projects:Q.projects||[]});Ie.success?(await c(),K.success("Rules updated"),Oe(null),ye("")):K.error(Ie.error||"Failed to update rules")}catch(Ie){K.error("Failed to update rules: "+Ie.message)}finally{ze(!1)}},qo=Q=>{A(Ie=>{const qe=new Set(Ie);return qe.has(Q)?qe.delete(Q):qe.add(Q),qe})},no=async()=>{if(!k||P.size===0)return;H(!0);let Q=0,Ie=null;for(const qe of P)try{const kt=await ue.addProjectToWorkstream(k.id,qe);kt.success&&(Ie=kt.workstream,Q++)}catch(kt){console.error("Failed to add project:",qe,kt)}Q>0?(await c(),K.success(`Added ${Q} project${Q>1?"s":""} to ${k.name}`)):K.error("Failed to add projects"),H(!1),b(!1),E(null),A(new Set)},Xt=async(Q,Ie)=>{const qe=await m(Q.id,Ie);qe.success?K.success(`Removed project from ${Q.name}`):K.error(qe.error||"Failed to remove project")},ll=Q=>Q.split("/").pop()||Q,Js=(Q,Ie=null)=>{var $t,jt;const qe=h(Q),kt=Ie?(jt=($t=n.find(sr=>sr.id===Ie))==null?void 0:$t.projects)==null?void 0:jt.includes(Q):!1;return qe===0?null:qe===1?kt?null:"in use":"shared"};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center",children:r.jsx(Bn,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Workstreams"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Context sets for multi-project workflows"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(re,{variant:"outline",onClick:Sr,size:"sm",children:[r.jsx(Tr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),r.jsxs(re,{onClick:()=>C(!0),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"New Workstream"]})]})]}),r.jsx("div",{className:"bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 rounded-lg p-4 text-sm text-purple-700 dark:text-purple-400",children:r.jsxs("p",{children:[r.jsx("strong",{children:"Workstreams"})," let you group related repos together so Claude sees them as one cohesive project. Perfect for microservices, monorepos, or any multi-repo setup where context matters. Your custom rules and context persist across sessions, and Claude stays scoped to only the directories you specify."]})}),r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:n.length===0?r.jsxs("div",{className:"p-12 text-center",children:[r.jsx(Bn,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Workstreams Yet"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Create your first workstream to organize multi-project contexts."}),r.jsxs(re,{onClick:()=>C(!0),children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Create Your First Workstream"]})]}):r.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:n.map(Q=>{var Ie,qe,kt,$t;return r.jsxs("div",{className:"group",children:[r.jsxs("div",{className:"p-4 flex items-center gap-4 transition-colors cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-900",onClick:()=>w(x===Q.id?null:Q.id),children:[r.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-400",children:x===Q.id?r.jsx(vr,{className:"w-4 h-4"}):r.jsx(xs,{className:"w-4 h-4"})}),r.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-gray-100 dark:bg-slate-800",children:r.jsx(Bn,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-medium truncate text-gray-900 dark:text-white",children:Q.name}),((Ie=Q.projects)==null?void 0:Ie.length)>0&&r.jsxs("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-1.5 py-0.5 rounded",children:[Q.projects.length," project",Q.projects.length!==1?"s":""]}),Q.rules&&r.jsxs("span",{className:"text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded",children:[r.jsx(zr,{className:"w-3 h-3 inline mr-0.5"}),"Rules"]})]}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 truncate",children:((qe=Q.projects)==null?void 0:qe.length)>0?Q.projects.map(jt=>ll(jt)).join(", "):"No projects added"})]}),r.jsxs("div",{className:"flex items-center gap-2",onClick:jt=>jt.stopPropagation(),children:[r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>y({...Q}),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400",title:"Edit workstream",children:r.jsx(wm,{className:"w-4 h-4"})}),r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>Wo(Q),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Delete workstream",children:r.jsx(ys,{className:"w-4 h-4"})})]})]}),x===Q.id&&r.jsxs("div",{className:"px-4 pb-4 pl-16 space-y-4 bg-gray-50/50 dark:bg-slate-900/50",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(re,{size:"sm",variant:"outline",onClick:()=>{E(Q),b(!0)},children:[r.jsx(ui,{className:"w-4 h-4 mr-1"}),"Add Project"]})]}),((kt=Q.projects)==null?void 0:kt.length)>0?r.jsx("div",{className:"space-y-1",children:Q.projects.map(jt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:jt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>Xt(Q,jt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(Tb,{className:"w-4 h-4"})})]},jt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No projects added yet. Add projects to help organize your workstream."})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Trigger Folders"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(Ma,{className:"w-3.5 h-3.5 text-gray-400"})}),r.jsx(Dt,{children:r.jsx("p",{className:"max-w-xs text-xs",children:"Additional folders that activate this workstream when you cd into them. Projects are always trigger folders automatically."})})]})})]}),r.jsxs(re,{size:"sm",variant:"outline",onClick:()=>{yr(Q),Cr(!0)},children:[r.jsx(ui,{className:"w-4 h-4 mr-1"}),"Add Folder"]})]}),(($t=Q.triggerFolders)==null?void 0:$t.length)>0?r.jsx("div",{className:"space-y-1",children:Q.triggerFolders.map(jt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:jt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>mn(Q,jt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(Tb,{className:"w-4 h-4"})})]},jt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No extra trigger folders. Projects auto-trigger this workstream."})]}),r.jsxs("div",{className:"flex items-center justify-between py-2 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Auto-Activate on cd"})]}),r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",children:[Q.autoActivate===!0?"On":Q.autoActivate===!1?"Off":"Default",r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"end",children:[r.jsxs(Nt,{onClick:()=>Zr(Q,"on"),children:[r.jsx(It,{className:`w-4 h-4 mr-2 ${Q.autoActivate===!0?"opacity-100":"opacity-0"}`}),"On"]}),r.jsxs(Nt,{onClick:()=>Zr(Q,"off"),children:[r.jsx(It,{className:`w-4 h-4 mr-2 ${Q.autoActivate===!1?"opacity-100":"opacity-0"}`}),"Off"]}),r.jsxs(Nt,{onClick:()=>Zr(Q,"default"),children:[r.jsx(It,{className:`w-4 h-4 mr-2 ${Q.autoActivate===void 0?"opacity-100":"opacity-0"}`}),"Default (",at.workstreamAutoActivate?"On":"Off",")"]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),_e===Q.id?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(re,{size:"sm",variant:"ghost",onClick:Uo,disabled:De,className:"text-gray-500 dark:text-slate-400 h-7",children:[r.jsx(hi,{className:"w-4 h-4 mr-1"}),"Cancel"]}),r.jsxs(re,{size:"sm",onClick:()=>Go(Q),disabled:De,className:"bg-purple-600 hover:bg-purple-700 h-7",children:[De?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):r.jsx(Ms,{className:"w-4 h-4 mr-1"}),"Save"]})]}):r.jsxs(re,{size:"sm",variant:"ghost",onClick:()=>_i(Q),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400 h-7",children:[r.jsx(wm,{className:"w-4 h-4 mr-1"}),"Edit"]})]}),_e===Q.id?r.jsx(_t,{value:de,onChange:jt=>ye(jt.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:8,className:"font-mono text-sm",autoFocus:!0}):Q.rules?r.jsx("pre",{className:"text-sm text-gray-600 dark:text-slate-400 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700 p-3 overflow-auto max-h-40 whitespace-pre-wrap cursor-pointer hover:border-purple-300 dark:hover:border-purple-700 transition-colors",onClick:()=>_i(Q),title:"Click to edit",children:Q.rules}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic cursor-pointer hover:text-purple-600 dark:hover:text-purple-400 transition-colors",onClick:()=>_i(Q),children:"No rules defined. Click to add context rules for this workstream."})]})]})]},Q.id)})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Hook Integration"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx("button",{className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:r.jsx(Ma,{className:"w-4 h-4"})})}),r.jsx(Dt,{side:"right",className:"max-w-xs",children:r.jsxs("p",{className:"text-sm",children:[r.jsx("strong",{children:"What are hooks?"}),r.jsx("br",{}),r.jsx("br",{}),"Hooks are scripts that run automatically at specific points in Claude Code sessions. The workstream hook runs before each prompt and injects your active workstream's rules into the context.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{children:"How it works:"}),r.jsx("br",{}),"1. You activate a workstream",r.jsx("br",{}),"2. Hook detects the active workstream",r.jsx("br",{}),"3. Rules are prepended to Claude's context",r.jsx("br",{}),"4. Claude understands your project context"]})})]})})]}),te.isInstalled?r.jsx("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-4 text-sm text-green-700 dark:text-green-400",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Mo,{className:"w-5 h-5 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Hook Installed"}),r.jsx("p",{className:"text-green-600 dark:text-green-500",children:"Workstream rules will be automatically injected into every Claude session."})]})]})}):r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4 text-sm text-amber-700 dark:text-amber-400",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ts,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium mb-1",children:"Hook Not Installed"}),r.jsx("p",{className:"mb-3",children:"Install the pre-prompt hook to automatically inject workstream rules into every Claude session."}),r.jsxs(re,{onClick:Qr,disabled:fe||te.loading,size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white",children:[fe?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(xi,{className:"w-4 h-4 mr-2"}),"Install Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Creates ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.claude/hooks/pre-prompt.sh"})]})]})]})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Folder Auto-Activation"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(Ma,{className:"w-4 h-4 text-gray-400"})}),r.jsxs(Dt,{className:"max-w-sm",children:[r.jsx("p",{className:"text-sm mb-2",children:r.jsx("strong",{children:"How it works:"})}),r.jsxs("ol",{className:"text-xs space-y-1 list-decimal list-inside",children:[r.jsx("li",{children:"Install the CD hook to your shell"}),r.jsxs("li",{children:["When you ",r.jsx("code",{className:"bg-slate-700 px-1 rounded",children:"cd"})," into a folder matching a workstream, it auto-activates"]}),r.jsx("li",{children:"If multiple workstreams match, you'll be prompted to choose"})]})]})]})})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 pb-4 border-b border-gray-200 dark:border-slate-800",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Global Auto-Activate"}),r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"(default for all workstreams)"})]}),r.jsx(re,{variant:at.workstreamAutoActivate?"default":"outline",size:"sm",onClick:al,children:at.workstreamAutoActivate?"Enabled":"Disabled"})]}),Je.installed?r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-200 dark:border-green-800",children:[r.jsx(Mo,{className:"w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium text-green-800 dark:text-green-300",children:"CD Hook Installed"}),r.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:["Shell: ",Je.shell," • RC file: ",r.jsx("code",{className:"bg-green-100 dark:bg-green-900/50 px-1 rounded",children:(io=Je.rcFile)==null?void 0:io.replace(/^\/Users\/[^/]+/,"~")})]}),r.jsxs(re,{variant:"outline",size:"sm",className:"mt-2",onClick:fn,disabled:Rr,children:[Rr?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):null,"Uninstall"]})]})]}):r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg border border-amber-200 dark:border-amber-800",children:[r.jsx(Ts,{className:"w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-amber-800 dark:text-amber-300 mb-1",children:"CD Hook Not Installed"}),r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mb-2",children:"Install the hook to auto-activate workstreams when you cd into matching folders."}),r.jsxs(re,{variant:"default",size:"sm",onClick:Ze,disabled:Rr||Je.loading,className:"bg-amber-600 hover:bg-amber-700 text-white",children:[Rr?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(xi,{className:"w-4 h-4 mr-2"}),"Install CD Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Adds function to ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.zshrc"})," or ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.bashrc"})]})]})]})]})]}),W&&W.totalSessions>0&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(u5,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Activity Insights"})]}),r.jsxs(re,{variant:"ghost",size:"sm",onClick:hr,className:"text-gray-500 dark:text-slate-400 hover:text-red-500",children:[r.jsx(ys,{className:"w-4 h-4 mr-1"}),"Clear Old"]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(tS,{className:"w-3 h-3"}),"Sessions"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:W.totalSessions})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(zr,{className:"w-3 h-3"}),"Files Tracked"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:W.totalFiles})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(Bn,{className:"w-3 h-3"}),"Projects Active"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:W.projectCount})]})]}),((Tn=W.topProjects)==null?void 0:Tn.length)>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Most Active Projects"}),r.jsx("div",{className:"space-y-1",children:W.topProjects.slice(0,5).map((Q,Ie)=>r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-600 dark:text-slate-400 truncate",title:Q.path,children:Q.path.split("/").pop()}),r.jsxs("span",{className:"text-gray-400 dark:text-slate-500 text-xs",children:[Q.fileCount," files"]})]},Q.path))})]})]}),ut.length>0&&r.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 dark:from-indigo-950/30 dark:to-purple-950/30 rounded-xl border border-indigo-200 dark:border-indigo-800 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Ht,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-indigo-900 dark:text-indigo-300",children:"Suggested Workstreams"}),r.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Based on activity patterns"})]}),r.jsx("p",{className:"text-sm text-indigo-700 dark:text-indigo-400 mb-4",children:"These projects are frequently worked on together. Create a workstream to group them?"}),r.jsx("div",{className:"space-y-3",children:ut.map(Q=>r.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-lg border border-indigo-200 dark:border-indigo-800 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Q.name}),Q.coActivityScore&&r.jsxs("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:[Q.coActivityScore,"% co-activity"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>Vr(Q),className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",title:"Dismiss suggestion",children:r.jsx(hi,{className:"w-4 h-4"})}),r.jsxs(re,{size:"sm",onClick:()=>ar(Q),className:"bg-indigo-600 hover:bg-indigo-700",children:[r.jsx(Tt,{className:"w-4 h-4 mr-1"}),"Create"]})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:Q.projects.map(Ie=>r.jsx("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-2 py-0.5 rounded",children:Ie.split("/").pop()},Ie))})]},Q.name))})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config workstream # List workstreams"}),r.jsx("p",{children:'coder-config workstream use "Name" # Set workstream for this tab'}),r.jsx("p",{children:'coder-config workstream create "Name" # Create workstream'})]})]}),r.jsx(yt,{open:j,onOpenChange:Q=>{Q||(C(!1),M(""),L(""),z([]),X(!1),O({}))},children:r.jsxs(ht,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"w-5 h-5 text-purple-600"}),"Create Workstream"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(lt,{value:N,onChange:Q=>M(Q.target.value),placeholder:"e.g., User Auth, Admin Dashboard",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(re,{type:"button",size:"sm",variant:"outline",onClick:()=>X(!U),children:[r.jsx(ui,{className:"w-4 h-4 mr-1"}),"Add"]})]}),B.length>0?r.jsx("div",{className:"space-y-1 mb-2",children:B.map(Q=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Q.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>ws(Q),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(hi,{className:"w-4 h-4"})})]},Q))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects added. Add projects to help organize your workstream."}),U&&t.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-64 overflow-y-auto bg-white dark:bg-slate-900",children:t.map(Q=>{const Ie=Js(Q.path),qe=q[Q.path],kt=G[Q.path],$t=R[Q.path]||[],jt=B.includes(Q.path);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>Ut(Q.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:kt?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):qe?r.jsx(vr,{className:"w-4 h-4 text-gray-400"}):r.jsx(xs,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>Vt(Q.path),disabled:jt,className:`flex-1 text-left p-2 rounded transition-colors ${jt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Q.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ie&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ie==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ie}),jt&&r.jsx(It,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:Q.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),qe&&$t.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:$t.map(sr=>{const br=B.includes(sr.dir),pr=Js(sr.dir);return r.jsxs("button",{type:"button",onClick:()=>Vt(sr.dir),disabled:br,className:`w-full text-left p-2 rounded transition-colors ${br?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:sr.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[pr&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${pr==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:pr}),br&&r.jsx(It,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono",children:sr.relativePath})]},sr.dir)})}),qe&&$t.length===0&&!kt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Q.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Context (optional)"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",children:[r.jsx(Ht,{className:"w-3 h-3"}),Be?((Ko=Qe.find(Q=>Q.id===Be))==null?void 0:Ko.name)||Be:"Basic",r.jsx(vr,{className:"w-3 h-3"})]})}),r.jsxs(dn,{align:"end",children:[r.jsx(Nt,{onClick:()=>Ke(""),children:r.jsx("span",{className:"text-xs",children:"Basic (no AI)"})}),Qe.filter(Q=>Q.available).map(Q=>r.jsxs(Nt,{onClick:()=>Ke(Q.id),children:[r.jsx("span",{className:"text-xs",children:Q.name}),Q.id===Be&&r.jsx(It,{className:"w-3 h-3 ml-2"})]},Q.id)),Qe.filter(Q=>!Q.available).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2 py-1 text-xs text-gray-400",children:"Not installed:"}),Qe.filter(Q=>!Q.available).map(Q=>r.jsx(Nt,{disabled:!0,className:"text-gray-400",children:r.jsx("span",{className:"text-xs",children:Q.name})},Q.id))]})]})]}),Be==="ollama"&&r.jsx(lt,{value:we,onChange:Q=>ve(Q.target.value),placeholder:"Model",className:"h-7 w-24 text-xs"}),r.jsxs(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>hs(B,L),disabled:me||B.length===0,className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:Be?`Generate with ${(oo=Qe.find(Q=>Q.id===Be))==null?void 0:oo.name}`:"Extract from README, package.json, etc.",children:[me?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(cs,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(_t,{value:I,onChange:Q=>L(Q.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:6}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:'Example: "Focus on user authentication. Use JWT tokens. React Query for state management."'})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>{C(!1),M(""),L(""),z([]),X(!1),O({})},children:"Cancel"}),r.jsxs(re,{onClick:so,disabled:Y||!N.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[Y?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Create"]})]})]})}),r.jsx(yt,{open:!!v,onOpenChange:Q=>!Q&&y(null),children:r.jsxs(ht,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(wm,{className:"w-5 h-5 text-purple-600"}),"Edit Workstream"]})}),v&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(lt,{value:v.name,onChange:Q=>y(Ie=>({...Ie,name:Q.target.value}))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(re,{type:"button",size:"sm",variant:"outline",onClick:()=>y(Q=>({...Q,showPicker:!Q.showPicker})),children:[r.jsx(ui,{className:"w-4 h-4 mr-1"}),"Add"]})]}),((Zn=v.projects)==null?void 0:Zn.length)>0?r.jsx("div",{className:"space-y-1 mb-2",children:v.projects.map(Q=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Q.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>y(Ie=>({...Ie,projects:Ie.projects.filter(qe=>qe!==Q)})),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(hi,{className:"w-4 h-4"})})]},Q))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects in this workstream."}),v.showPicker&&t.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-48 overflow-y-auto bg-white dark:bg-slate-900",children:t.map(Q=>{var sr;const Ie=(sr=v.projects)==null?void 0:sr.includes(Q.path),qe=Js(Q.path,v.id),kt=q[Q.path],$t=G[Q.path],jt=R[Q.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>Ut(Q.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:$t?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):kt?r.jsx(vr,{className:"w-4 h-4 text-gray-400"}):r.jsx(xs,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!Ie&&y(br=>({...br,projects:[...br.projects||[],Q.path]})),disabled:Ie,className:`flex-1 text-left p-2 rounded transition-colors ${Ie?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Q.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[qe&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${qe==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:qe}),Ie&&r.jsx(It,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:Q.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),kt&&jt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:jt.map(br=>{var _s;const pr=(_s=v.projects)==null?void 0:_s.includes(br.dir),es=Js(br.dir,v.id);return r.jsxs("button",{type:"button",onClick:()=>!pr&&y(Xs=>({...Xs,projects:[...Xs.projects||[],br.dir]})),disabled:pr,className:`w-full text-left p-2 rounded transition-colors ${pr?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:br.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[es&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${es==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:es}),pr&&r.jsx(It,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:br.relativePath})]},br.dir)})}),kt&&jt.length===0&&!$t&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Q.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",children:[r.jsx(Ht,{className:"w-3 h-3"}),Be?((fs=Qe.find(Q=>Q.id===Be))==null?void 0:fs.name)||Be:"Basic",r.jsx(vr,{className:"w-3 h-3"})]})}),r.jsxs(dn,{align:"end",children:[r.jsx(Nt,{onClick:()=>Ke(""),children:r.jsx("span",{className:"text-xs",children:"Basic (no AI)"})}),Qe.filter(Q=>Q.available).map(Q=>r.jsxs(Nt,{onClick:()=>Ke(Q.id),children:[r.jsx("span",{className:"text-xs",children:Q.name}),Q.id===Be&&r.jsx(It,{className:"w-3 h-3 ml-2"})]},Q.id)),Qe.filter(Q=>!Q.available).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2 py-1 text-xs text-gray-400",children:"Not installed:"}),Qe.filter(Q=>!Q.available).map(Q=>r.jsx(Nt,{disabled:!0,className:"text-gray-400",children:r.jsx("span",{className:"text-xs",children:Q.name})},Q.id))]})]})]}),Be==="ollama"&&r.jsx(lt,{value:we,onChange:Q=>ve(Q.target.value),placeholder:"Model",className:"h-7 w-24 text-xs"}),r.jsxs(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>hs(v.projects,Q=>y(Ie=>({...Ie,rules:Q}))),disabled:me||!((ao=v.projects)!=null&&ao.length),className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:Be?`Generate with ${(Mr=Qe.find(Q=>Q.id===Be))==null?void 0:Mr.name}`:"Extract from README, package.json, etc.",children:[me?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(cs,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(_t,{value:v.rules||"",onChange:Q=>y(Ie=>({...Ie,rules:Q.target.value})),placeholder:"Context rules for this workstream...",rows:8})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>y(null),children:"Cancel"}),r.jsxs(re,{onClick:Vo,disabled:Y,className:"bg-purple-600 hover:bg-purple-700",children:[Y?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Ms,{className:"w-4 h-4 mr-2"}),"Save Changes"]})]})]})}),r.jsx(yt,{open:g,onOpenChange:Q=>{b(Q),Q||(O({}),A(new Set))},children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"w-5 h-5 text-purple-600"}),"Add Project to ",k==null?void 0:k.name]})}),r.jsxs("div",{className:"py-4",children:[r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Select projects to add to this workstream (multi-select enabled):"}),t.length>0?r.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto border border-gray-200 dark:border-slate-700 rounded-lg p-2 bg-white dark:bg-slate-900",children:t.map(Q=>{var br;const Ie=(br=k==null?void 0:k.projects)==null?void 0:br.includes(Q.path),qe=P.has(Q.path),kt=Js(Q.path,k==null?void 0:k.id),$t=q[Q.path],jt=G[Q.path],sr=R[Q.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>Ut(Q.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:jt?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):$t?r.jsx(vr,{className:"w-4 h-4 text-gray-400"}):r.jsx(xs,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!Ie&&qo(Q.path),disabled:Ie,className:`flex-1 text-left p-2 rounded transition-colors ${Ie?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":qe?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${Ie?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":qe?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(Ie||qe)&&r.jsx(It,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Q.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[kt&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${kt==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:kt}),Ie&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:Q.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),$t&&sr.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:sr.map(pr=>{var Rn;const es=(Rn=k==null?void 0:k.projects)==null?void 0:Rn.includes(pr.dir),_s=P.has(pr.dir),Xs=Js(pr.dir,k==null?void 0:k.id);return r.jsxs("button",{type:"button",onClick:()=>!es&&qo(pr.dir),disabled:es,className:`w-full text-left p-2 rounded transition-colors ${es?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":_s?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${es?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":_s?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(es||_s)&&r.jsx(It,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:pr.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[Xs&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Xs==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Xs}),es&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:pr.relativePath})]},pr.dir)})}),$t&&sr.length===0&&!jt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Q.id)})}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 text-center py-4",children:"No projects registered. Add projects in the Projects view first."})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>{b(!1),A(new Set)},children:"Cancel"}),r.jsxs(re,{onClick:no,disabled:P.size===0||Y,className:"bg-purple-600 hover:bg-purple-700",children:[Y?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Selected (",P.size,")"]})]})]})}),r.jsx(yt,{open:Jt,onOpenChange:Q=>{Q||(Cr(!1),Xr(""),yr(null))},children:r.jsxs(ht,{children:[r.jsx(ft,{children:r.jsx(mt,{children:"Add Trigger Folder"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:["Add a folder that will trigger the workstream ",r.jsx("strong",{children:Wt==null?void 0:Wt.name})," when you cd into it."]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Folder Path"}),r.jsx(lt,{value:us,onChange:Q=>Xr(Q.target.value),placeholder:"~/path/to/folder",className:"font-mono"}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:"Use absolute path or ~ for home directory"})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>{Cr(!1),Xr(""),yr(null)},children:"Cancel"}),r.jsxs(re,{onClick:wi,disabled:!us.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(ui,{className:"w-4 h-4 mr-2"}),"Add Folder"]})]})]})})]})}const g_={clarify:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",plan:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",execute:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},ja={pending:r.jsx(sc,{className:"w-4 h-4 text-gray-500"}),running:r.jsx(aS,{className:"w-4 h-4 text-green-500"}),paused:r.jsx(xp,{className:"w-4 h-4 text-yellow-500"}),completed:r.jsx(Mo,{className:"w-4 h-4 text-green-600"}),failed:r.jsx(Da,{className:"w-4 h-4 text-red-500"}),cancelled:r.jsx(Da,{className:"w-4 h-4 text-gray-500"})};function pW({activeProject:e=null}){var cl,dl,Jo,ul,hl,fl,Xo,lo,pn,gn,xn;const[t,s]=_.useState([]),[n,o]=_.useState(!0),[c,u]=_.useState(null),[l,d]=_.useState({}),{workstreams:f,activeId:m,fetch:h}=vN(),[x,w]=_.useState(""),[j,C]=_.useState(!1),[v,y]=_.useState(!1),[g,b]=_.useState(!1),[k,E]=_.useState(!1),[P,A]=_.useState(null),[N,M]=_.useState(!1),[I,L]=_.useState(null),[B,z]=_.useState(""),[Y,H]=_.useState(""),[U,X]=_.useState(50),[q,O]=_.useState("DONE"),[R,$]=_.useState(!1),[G,F]=_.useState(!1),[te,ce]=_.useState(!1),[fe,J]=_.useState(""),[W,ae]=_.useState(""),[ne,Z]=_.useState(!1),[le,Ce]=_.useState(!1),[Le,Ge]=_.useState(null),[me,be]=_.useState("create"),[Be,Ke]=_.useState(""),[Qe,je]=_.useState(""),[we,ve]=_.useState(50),[_e,Oe]=_.useState("DONE"),[de,ye]=_.useState(""),[De,ze]=_.useState(50),[Je,Et]=_.useState(!1),[at,ur]=_.useState("DONE"),[Rr,Wr]=_.useState([]),[Jt,Cr]=_.useState({stopHook:{},prepromptHook:{}}),[Wt,yr]=_.useState(!1),[us,Xr]=_.useState({needsInstall:!0}),[Ls,Os]=_.useState(!1),[it,zt]=_.useState(null),[rr,ar]=_.useState(null),[ws,Vt]=_.useState(!1),[Ut,Vr]=_.useState(!1),[ut,hr]=_.useState(null),[hs,Qr]=_.useState(!0),[Ze,fn]=_.useState(null),[al,Zr]=_.useState(!1);_.useEffect(()=>{Sr(),so(),Wo(),h(),mn()},[h]);const wi=_.useRef(null);_.useEffect(()=>{if(!Ut||!ut){wi.current=null;return}wi.current=ut.status;const se=setInterval(async()=>{var Me,Rt,kr;try{const bt=(await ue.getLoop(ut.id)).loop,Dr=wi.current!==bt.status,Ir=["completed","paused","failed","cancelled"].includes(bt.status);if(Dr&&Ir){clearInterval(se);const rs={id:bt.id,name:bt.name,task:(Me=bt.task)==null?void 0:Me.original,status:bt.status,pauseReason:bt.pauseReason,iterations:((Rt=bt.iterations)==null?void 0:Rt.current)||0,maxIterations:((kr=bt.iterations)==null?void 0:kr.max)||50,phase:bt.phase,startedAt:bt.startedAt,completedAt:bt.completedAt||new Date().toISOString(),duration:bt.startedAt?Math.round((Date.now()-new Date(bt.startedAt).getTime())/1e3):null};fn(rs),bt.status==="completed"?K.success("Loop completed successfully!"):bt.status==="paused"?K.info(`Loop paused: ${bt.pauseReason||"unknown reason"}`):bt.status==="failed"?K.error("Loop failed"):bt.status==="cancelled"&&K.warning("Loop cancelled"),Sr(),hs&&bt.status==="completed"?setTimeout(()=>{Vr(!1),hr(null),Zr(!0)},1500):Zr(!0)}wi.current=bt.status}catch(ts){console.error("Failed to poll loop status:",ts)}},3e3);return()=>clearInterval(se)},[Ut,ut,hs]);const mn=async()=>{try{const se=await ue.getRalphLoopPluginStatus();Xr(se)}catch(se){console.error("Failed to load plugin status:",se)}};_.useEffect(()=>{j&&m&&H(m)},[j,m]);const Sr=async()=>{try{o(!0);const se=await ue.getLoops();s(se.loops||[]),d(se.config||{})}catch{K.error("Failed to load loops")}finally{o(!1)}},so=async()=>{try{const Me=(await ue.getLoopConfig()).config||{};d(Me),ze(Me.maxIterations||50),Et(Me.autoApprovePlan||!1),ur(Me.completionPromise||"DONE"),X(Me.maxIterations||50),O(Me.completionPromise||"DONE")}catch(se){console.error("Failed to load config:",se)}},Wo=async()=>{try{const se=await ue.getLoopHookStatus();Cr(se)}catch(se){console.error("Failed to load hook status:",se)}},Vo=async()=>{try{const se=await ue.getLoopHistory();Wr(se.completed||[])}catch{K.error("Failed to load history")}},_i=async()=>{if(!B.trim()){K.error("Task description is required");return}await Js(B)},Uo=async()=>{if(!B.trim()){K.error("Enter a task description first");return}try{F(!0),ae(B),be("create");const se=await ue.tuneLoopPrompt(B,(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null);se.success?(J(se.tunedPrompt),ce(!0)):K.error(se.error||"Failed to tune prompt")}catch(se){K.error(se.message)}finally{F(!1)}},Go=()=>{me==="edit"?je(fe):(z(fe),Z(!0)),ce(!1),K.success("Tuned prompt applied")},qo=()=>{ce(!1)},no=se=>{se.status==="failed"||se.status==="paused"||se.status==="cancelled"?(Ge(se),Ce(!0)):ao(se.id)},Xt=async()=>{var se,Me,Rt,kr;if(Le)try{F(!0);const ts=((se=Le.task)==null?void 0:se.original)||"",bt=await ue.getLoop(Le.id),Dr=bt.loop||Le,Ir={status:Dr.status,pauseReason:Dr.pauseReason,iterations:((Me=Dr.iterations)==null?void 0:Me.current)||0,maxIterations:((Rt=Dr.iterations)==null?void 0:Rt.max)||50,phase:Dr.phase,clarifications:bt.clarifications||"",plan:bt.plan||"",iterationHistory:(((kr=Dr.iterations)==null?void 0:kr.history)||[]).slice(-5).map(co=>`Iteration ${co.n}: ${co.summary||"no summary"}`).join(`
3003
+ This cannot be undone.`))return;const Ie=await d(Q.id);Ie.success?K.success(`Deleted workstream: ${Q.name}`):K.error(Ie.error||"Failed to delete workstream")},Vo=async()=>{if(!v)return;H(!0);const Q=await l(v.id,{name:v.name,rules:v.rules,projects:v.projects||[]});Q.success?(K.success("Workstream updated"),y(null)):K.error(Q.error||"Failed to update workstream"),H(!1)},_i=Q=>{Oe(Q.id),ye(Q.rules||"")},Uo=()=>{Oe(null),ye("")},Go=async Q=>{ze(!0);try{const Ie=await ue.updateWorkstream(Q.id,{name:Q.name,rules:de,projects:Q.projects||[]});Ie.success?(await c(),K.success("Rules updated"),Oe(null),ye("")):K.error(Ie.error||"Failed to update rules")}catch(Ie){K.error("Failed to update rules: "+Ie.message)}finally{ze(!1)}},qo=Q=>{A(Ie=>{const qe=new Set(Ie);return qe.has(Q)?qe.delete(Q):qe.add(Q),qe})},no=async()=>{if(!k||P.size===0)return;H(!0);let Q=0,Ie=null;for(const qe of P)try{const kt=await ue.addProjectToWorkstream(k.id,qe);kt.success&&(Ie=kt.workstream,Q++)}catch(kt){console.error("Failed to add project:",qe,kt)}Q>0?(await c(),K.success(`Added ${Q} project${Q>1?"s":""} to ${k.name}`)):K.error("Failed to add projects"),H(!1),b(!1),E(null),A(new Set)},Xt=async(Q,Ie)=>{const qe=await m(Q.id,Ie);qe.success?K.success(`Removed project from ${Q.name}`):K.error(qe.error||"Failed to remove project")},ll=Q=>Q.split("/").pop()||Q,Js=(Q,Ie=null)=>{var $t,jt;const qe=h(Q),kt=Ie?(jt=($t=n.find(sr=>sr.id===Ie))==null?void 0:$t.projects)==null?void 0:jt.includes(Q):!1;return qe===0?null:qe===1?kt?null:"in use":"shared"};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center",children:r.jsx(Bn,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Workstreams"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Context sets for multi-project workflows"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(re,{variant:"outline",onClick:Sr,size:"sm",children:[r.jsx(Tr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),r.jsxs(re,{onClick:()=>C(!0),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"New Workstream"]})]})]}),r.jsx("div",{className:"bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 rounded-lg p-4 text-sm text-purple-700 dark:text-purple-400",children:r.jsxs("p",{children:[r.jsx("strong",{children:"Workstreams"})," let you group related repos together so Claude sees them as one cohesive project. Perfect for microservices, monorepos, or any multi-repo setup where context matters. Your custom rules and context persist across sessions, and Claude stays scoped to only the directories you specify."]})}),r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:n.length===0?r.jsxs("div",{className:"p-12 text-center",children:[r.jsx(Bn,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Workstreams Yet"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Create your first workstream to organize multi-project contexts."}),r.jsxs(re,{onClick:()=>C(!0),children:[r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Create Your First Workstream"]})]}):r.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:n.map(Q=>{var Ie,qe,kt,$t;return r.jsxs("div",{className:"group",children:[r.jsxs("div",{className:"p-4 flex items-center gap-4 transition-colors cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-900",onClick:()=>w(x===Q.id?null:Q.id),children:[r.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-400",children:x===Q.id?r.jsx(vr,{className:"w-4 h-4"}):r.jsx(xs,{className:"w-4 h-4"})}),r.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-gray-100 dark:bg-slate-800",children:r.jsx(Bn,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-medium truncate text-gray-900 dark:text-white",children:Q.name}),((Ie=Q.projects)==null?void 0:Ie.length)>0&&r.jsxs("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-1.5 py-0.5 rounded",children:[Q.projects.length," project",Q.projects.length!==1?"s":""]}),Q.rules&&r.jsxs("span",{className:"text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded",children:[r.jsx(zr,{className:"w-3 h-3 inline mr-0.5"}),"Rules"]})]}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 truncate",children:((qe=Q.projects)==null?void 0:qe.length)>0?Q.projects.map(jt=>ll(jt)).join(", "):"No projects added"})]}),r.jsxs("div",{className:"flex items-center gap-2",onClick:jt=>jt.stopPropagation(),children:[r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>y({...Q}),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400",title:"Edit workstream",children:r.jsx(wm,{className:"w-4 h-4"})}),r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>Wo(Q),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Delete workstream",children:r.jsx(ys,{className:"w-4 h-4"})})]})]}),x===Q.id&&r.jsxs("div",{className:"px-4 pb-4 pl-16 space-y-4 bg-gray-50/50 dark:bg-slate-900/50",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(re,{size:"sm",variant:"outline",onClick:()=>{E(Q),b(!0)},children:[r.jsx(ui,{className:"w-4 h-4 mr-1"}),"Add Project"]})]}),((kt=Q.projects)==null?void 0:kt.length)>0?r.jsx("div",{className:"space-y-1",children:Q.projects.map(jt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:jt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>Xt(Q,jt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(Tb,{className:"w-4 h-4"})})]},jt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No projects added yet. Add projects to help organize your workstream."})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Trigger Folders"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(Ma,{className:"w-3.5 h-3.5 text-gray-400"})}),r.jsx(Dt,{children:r.jsx("p",{className:"max-w-xs text-xs",children:"Additional folders that activate this workstream when you cd into them. Projects are always trigger folders automatically."})})]})})]}),r.jsxs(re,{size:"sm",variant:"outline",onClick:()=>{yr(Q),Cr(!0)},children:[r.jsx(ui,{className:"w-4 h-4 mr-1"}),"Add Folder"]})]}),(($t=Q.triggerFolders)==null?void 0:$t.length)>0?r.jsx("div",{className:"space-y-1",children:Q.triggerFolders.map(jt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:jt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>mn(Q,jt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(Tb,{className:"w-4 h-4"})})]},jt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No extra trigger folders. Projects auto-trigger this workstream."})]}),r.jsxs("div",{className:"flex items-center justify-between py-2 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Auto-Activate on cd"})]}),r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",children:[Q.autoActivate===!0?"On":Q.autoActivate===!1?"Off":"Default",r.jsx(vr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(dn,{align:"end",children:[r.jsxs(Nt,{onClick:()=>Zr(Q,"on"),children:[r.jsx(It,{className:`w-4 h-4 mr-2 ${Q.autoActivate===!0?"opacity-100":"opacity-0"}`}),"On"]}),r.jsxs(Nt,{onClick:()=>Zr(Q,"off"),children:[r.jsx(It,{className:`w-4 h-4 mr-2 ${Q.autoActivate===!1?"opacity-100":"opacity-0"}`}),"Off"]}),r.jsxs(Nt,{onClick:()=>Zr(Q,"default"),children:[r.jsx(It,{className:`w-4 h-4 mr-2 ${Q.autoActivate===void 0?"opacity-100":"opacity-0"}`}),"Default (",at.workstreamAutoActivate?"On":"Off",")"]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),_e===Q.id?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(re,{size:"sm",variant:"ghost",onClick:Uo,disabled:Re,className:"text-gray-500 dark:text-slate-400 h-7",children:[r.jsx(hi,{className:"w-4 h-4 mr-1"}),"Cancel"]}),r.jsxs(re,{size:"sm",onClick:()=>Go(Q),disabled:Re,className:"bg-purple-600 hover:bg-purple-700 h-7",children:[Re?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):r.jsx(Ms,{className:"w-4 h-4 mr-1"}),"Save"]})]}):r.jsxs(re,{size:"sm",variant:"ghost",onClick:()=>_i(Q),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400 h-7",children:[r.jsx(wm,{className:"w-4 h-4 mr-1"}),"Edit"]})]}),_e===Q.id?r.jsx(_t,{value:de,onChange:jt=>ye(jt.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:8,className:"font-mono text-sm",autoFocus:!0}):Q.rules?r.jsx("pre",{className:"text-sm text-gray-600 dark:text-slate-400 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700 p-3 overflow-auto max-h-40 whitespace-pre-wrap cursor-pointer hover:border-purple-300 dark:hover:border-purple-700 transition-colors",onClick:()=>_i(Q),title:"Click to edit",children:Q.rules}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic cursor-pointer hover:text-purple-600 dark:hover:text-purple-400 transition-colors",onClick:()=>_i(Q),children:"No rules defined. Click to add context rules for this workstream."})]})]})]},Q.id)})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Hook Integration"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx("button",{className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:r.jsx(Ma,{className:"w-4 h-4"})})}),r.jsx(Dt,{side:"right",className:"max-w-xs",children:r.jsxs("p",{className:"text-sm",children:[r.jsx("strong",{children:"What are hooks?"}),r.jsx("br",{}),r.jsx("br",{}),"Hooks are scripts that run automatically at specific points in Claude Code sessions. The workstream hook runs before each prompt and injects your active workstream's rules into the context.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{children:"How it works:"}),r.jsx("br",{}),"1. You activate a workstream",r.jsx("br",{}),"2. Hook detects the active workstream",r.jsx("br",{}),"3. Rules are prepended to Claude's context",r.jsx("br",{}),"4. Claude understands your project context"]})})]})})]}),te.isInstalled?r.jsx("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-4 text-sm text-green-700 dark:text-green-400",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Mo,{className:"w-5 h-5 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Hook Installed"}),r.jsx("p",{className:"text-green-600 dark:text-green-500",children:"Workstream rules will be automatically injected into every Claude session."})]})]})}):r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4 text-sm text-amber-700 dark:text-amber-400",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ts,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium mb-1",children:"Hook Not Installed"}),r.jsx("p",{className:"mb-3",children:"Install the pre-prompt hook to automatically inject workstream rules into every Claude session."}),r.jsxs(re,{onClick:Qr,disabled:fe||te.loading,size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white",children:[fe?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(xi,{className:"w-4 h-4 mr-2"}),"Install Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Creates ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.claude/hooks/pre-prompt.sh"})]})]})]})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Folder Auto-Activation"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(Ma,{className:"w-4 h-4 text-gray-400"})}),r.jsxs(Dt,{className:"max-w-sm",children:[r.jsx("p",{className:"text-sm mb-2",children:r.jsx("strong",{children:"How it works:"})}),r.jsxs("ol",{className:"text-xs space-y-1 list-decimal list-inside",children:[r.jsx("li",{children:"Install the CD hook to your shell"}),r.jsxs("li",{children:["When you ",r.jsx("code",{className:"bg-slate-700 px-1 rounded",children:"cd"})," into a folder matching a workstream, it auto-activates"]}),r.jsx("li",{children:"If multiple workstreams match, you'll be prompted to choose"})]})]})]})})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 pb-4 border-b border-gray-200 dark:border-slate-800",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Global Auto-Activate"}),r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"(default for all workstreams)"})]}),r.jsx(re,{variant:at.workstreamAutoActivate?"default":"outline",size:"sm",onClick:al,children:at.workstreamAutoActivate?"Enabled":"Disabled"})]}),Je.installed?r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-200 dark:border-green-800",children:[r.jsx(Mo,{className:"w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium text-green-800 dark:text-green-300",children:"CD Hook Installed"}),r.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:["Shell: ",Je.shell," • RC file: ",r.jsx("code",{className:"bg-green-100 dark:bg-green-900/50 px-1 rounded",children:(io=Je.rcFile)==null?void 0:io.replace(/^\/Users\/[^/]+/,"~")})]}),r.jsxs(re,{variant:"outline",size:"sm",className:"mt-2",onClick:fn,disabled:Rr,children:[Rr?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):null,"Uninstall"]})]})]}):r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg border border-amber-200 dark:border-amber-800",children:[r.jsx(Ts,{className:"w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-amber-800 dark:text-amber-300 mb-1",children:"CD Hook Not Installed"}),r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mb-2",children:"Install the hook to auto-activate workstreams when you cd into matching folders."}),r.jsxs(re,{variant:"default",size:"sm",onClick:Ze,disabled:Rr||Je.loading,className:"bg-amber-600 hover:bg-amber-700 text-white",children:[Rr?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(xi,{className:"w-4 h-4 mr-2"}),"Install CD Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Adds function to ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.zshrc"})," or ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.bashrc"})]})]})]})]})]}),W&&W.totalSessions>0&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(u5,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Activity Insights"})]}),r.jsxs(re,{variant:"ghost",size:"sm",onClick:hr,className:"text-gray-500 dark:text-slate-400 hover:text-red-500",children:[r.jsx(ys,{className:"w-4 h-4 mr-1"}),"Clear Old"]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(tS,{className:"w-3 h-3"}),"Sessions"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:W.totalSessions})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(zr,{className:"w-3 h-3"}),"Files Tracked"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:W.totalFiles})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(Bn,{className:"w-3 h-3"}),"Projects Active"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:W.projectCount})]})]}),((Tn=W.topProjects)==null?void 0:Tn.length)>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Most Active Projects"}),r.jsx("div",{className:"space-y-1",children:W.topProjects.slice(0,5).map((Q,Ie)=>r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-600 dark:text-slate-400 truncate",title:Q.path,children:Q.path.split("/").pop()}),r.jsxs("span",{className:"text-gray-400 dark:text-slate-500 text-xs",children:[Q.fileCount," files"]})]},Q.path))})]})]}),ut.length>0&&r.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 dark:from-indigo-950/30 dark:to-purple-950/30 rounded-xl border border-indigo-200 dark:border-indigo-800 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Ht,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-indigo-900 dark:text-indigo-300",children:"Suggested Workstreams"}),r.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Based on activity patterns"})]}),r.jsx("p",{className:"text-sm text-indigo-700 dark:text-indigo-400 mb-4",children:"These projects are frequently worked on together. Create a workstream to group them?"}),r.jsx("div",{className:"space-y-3",children:ut.map(Q=>r.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-lg border border-indigo-200 dark:border-indigo-800 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Q.name}),Q.coActivityScore&&r.jsxs("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:[Q.coActivityScore,"% co-activity"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(re,{size:"sm",variant:"ghost",onClick:()=>Vr(Q),className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",title:"Dismiss suggestion",children:r.jsx(hi,{className:"w-4 h-4"})}),r.jsxs(re,{size:"sm",onClick:()=>ar(Q),className:"bg-indigo-600 hover:bg-indigo-700",children:[r.jsx(Tt,{className:"w-4 h-4 mr-1"}),"Create"]})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:Q.projects.map(Ie=>r.jsx("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-2 py-0.5 rounded",children:Ie.split("/").pop()},Ie))})]},Q.name))})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config workstream # List workstreams"}),r.jsx("p",{children:'coder-config workstream use "Name" # Set workstream for this tab'}),r.jsx("p",{children:'coder-config workstream create "Name" # Create workstream'})]})]}),r.jsx(yt,{open:j,onOpenChange:Q=>{Q||(C(!1),M(""),L(""),z([]),X(!1),O({}))},children:r.jsxs(ht,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"w-5 h-5 text-purple-600"}),"Create Workstream"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(lt,{value:N,onChange:Q=>M(Q.target.value),placeholder:"e.g., User Auth, Admin Dashboard",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(re,{type:"button",size:"sm",variant:"outline",onClick:()=>X(!U),children:[r.jsx(ui,{className:"w-4 h-4 mr-1"}),"Add"]})]}),B.length>0?r.jsx("div",{className:"space-y-1 mb-2",children:B.map(Q=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Q.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>ws(Q),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(hi,{className:"w-4 h-4"})})]},Q))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects added. Add projects to help organize your workstream."}),U&&t.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-64 overflow-y-auto bg-white dark:bg-slate-900",children:t.map(Q=>{const Ie=Js(Q.path),qe=q[Q.path],kt=G[Q.path],$t=R[Q.path]||[],jt=B.includes(Q.path);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>Ut(Q.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:kt?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):qe?r.jsx(vr,{className:"w-4 h-4 text-gray-400"}):r.jsx(xs,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>Vt(Q.path),disabled:jt,className:`flex-1 text-left p-2 rounded transition-colors ${jt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Q.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ie&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ie==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ie}),jt&&r.jsx(It,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:Q.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),qe&&$t.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:$t.map(sr=>{const br=B.includes(sr.dir),pr=Js(sr.dir);return r.jsxs("button",{type:"button",onClick:()=>Vt(sr.dir),disabled:br,className:`w-full text-left p-2 rounded transition-colors ${br?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:sr.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[pr&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${pr==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:pr}),br&&r.jsx(It,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono",children:sr.relativePath})]},sr.dir)})}),qe&&$t.length===0&&!kt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Q.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Context (optional)"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",children:[r.jsx(Ht,{className:"w-3 h-3"}),Be?((Ko=Qe.find(Q=>Q.id===Be))==null?void 0:Ko.name)||Be:"Basic",r.jsx(vr,{className:"w-3 h-3"})]})}),r.jsxs(dn,{align:"end",children:[r.jsx(Nt,{onClick:()=>Ke(""),children:r.jsx("span",{className:"text-xs",children:"Basic (no AI)"})}),Qe.filter(Q=>Q.available).map(Q=>r.jsxs(Nt,{onClick:()=>Ke(Q.id),children:[r.jsx("span",{className:"text-xs",children:Q.name}),Q.id===Be&&r.jsx(It,{className:"w-3 h-3 ml-2"})]},Q.id)),Qe.filter(Q=>!Q.available).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2 py-1 text-xs text-gray-400",children:"Not installed:"}),Qe.filter(Q=>!Q.available).map(Q=>r.jsx(Nt,{disabled:!0,className:"text-gray-400",children:r.jsx("span",{className:"text-xs",children:Q.name})},Q.id))]})]})]}),Be==="ollama"&&r.jsx(lt,{value:we,onChange:Q=>ve(Q.target.value),placeholder:"Model",className:"h-7 w-24 text-xs"}),r.jsxs(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>hs(B,L),disabled:me||B.length===0,className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:Be?`Generate with ${(oo=Qe.find(Q=>Q.id===Be))==null?void 0:oo.name}`:"Extract from README, package.json, etc.",children:[me?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(cs,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(_t,{value:I,onChange:Q=>L(Q.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:6}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:'Example: "Focus on user authentication. Use JWT tokens. React Query for state management."'})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>{C(!1),M(""),L(""),z([]),X(!1),O({})},children:"Cancel"}),r.jsxs(re,{onClick:so,disabled:Y||!N.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[Y?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Create"]})]})]})}),r.jsx(yt,{open:!!v,onOpenChange:Q=>!Q&&y(null),children:r.jsxs(ht,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(wm,{className:"w-5 h-5 text-purple-600"}),"Edit Workstream"]})}),v&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(lt,{value:v.name,onChange:Q=>y(Ie=>({...Ie,name:Q.target.value}))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(re,{type:"button",size:"sm",variant:"outline",onClick:()=>y(Q=>({...Q,showPicker:!Q.showPicker})),children:[r.jsx(ui,{className:"w-4 h-4 mr-1"}),"Add"]})]}),((Zn=v.projects)==null?void 0:Zn.length)>0?r.jsx("div",{className:"space-y-1 mb-2",children:v.projects.map(Q=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Q.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>y(Ie=>({...Ie,projects:Ie.projects.filter(qe=>qe!==Q)})),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(hi,{className:"w-4 h-4"})})]},Q))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects in this workstream."}),v.showPicker&&t.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-48 overflow-y-auto bg-white dark:bg-slate-900",children:t.map(Q=>{var sr;const Ie=(sr=v.projects)==null?void 0:sr.includes(Q.path),qe=Js(Q.path,v.id),kt=q[Q.path],$t=G[Q.path],jt=R[Q.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>Ut(Q.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:$t?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):kt?r.jsx(vr,{className:"w-4 h-4 text-gray-400"}):r.jsx(xs,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!Ie&&y(br=>({...br,projects:[...br.projects||[],Q.path]})),disabled:Ie,className:`flex-1 text-left p-2 rounded transition-colors ${Ie?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Q.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[qe&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${qe==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:qe}),Ie&&r.jsx(It,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:Q.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),kt&&jt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:jt.map(br=>{var _s;const pr=(_s=v.projects)==null?void 0:_s.includes(br.dir),es=Js(br.dir,v.id);return r.jsxs("button",{type:"button",onClick:()=>!pr&&y(Xs=>({...Xs,projects:[...Xs.projects||[],br.dir]})),disabled:pr,className:`w-full text-left p-2 rounded transition-colors ${pr?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:br.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[es&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${es==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:es}),pr&&r.jsx(It,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:br.relativePath})]},br.dir)})}),kt&&jt.length===0&&!$t&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Q.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(jn,{children:[r.jsx(Nn,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",children:[r.jsx(Ht,{className:"w-3 h-3"}),Be?((fs=Qe.find(Q=>Q.id===Be))==null?void 0:fs.name)||Be:"Basic",r.jsx(vr,{className:"w-3 h-3"})]})}),r.jsxs(dn,{align:"end",children:[r.jsx(Nt,{onClick:()=>Ke(""),children:r.jsx("span",{className:"text-xs",children:"Basic (no AI)"})}),Qe.filter(Q=>Q.available).map(Q=>r.jsxs(Nt,{onClick:()=>Ke(Q.id),children:[r.jsx("span",{className:"text-xs",children:Q.name}),Q.id===Be&&r.jsx(It,{className:"w-3 h-3 ml-2"})]},Q.id)),Qe.filter(Q=>!Q.available).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2 py-1 text-xs text-gray-400",children:"Not installed:"}),Qe.filter(Q=>!Q.available).map(Q=>r.jsx(Nt,{disabled:!0,className:"text-gray-400",children:r.jsx("span",{className:"text-xs",children:Q.name})},Q.id))]})]})]}),Be==="ollama"&&r.jsx(lt,{value:we,onChange:Q=>ve(Q.target.value),placeholder:"Model",className:"h-7 w-24 text-xs"}),r.jsxs(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>hs(v.projects,Q=>y(Ie=>({...Ie,rules:Q}))),disabled:me||!((ao=v.projects)!=null&&ao.length),className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:Be?`Generate with ${(Mr=Qe.find(Q=>Q.id===Be))==null?void 0:Mr.name}`:"Extract from README, package.json, etc.",children:[me?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(cs,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(_t,{value:v.rules||"",onChange:Q=>y(Ie=>({...Ie,rules:Q.target.value})),placeholder:"Context rules for this workstream...",rows:8})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>y(null),children:"Cancel"}),r.jsxs(re,{onClick:Vo,disabled:Y,className:"bg-purple-600 hover:bg-purple-700",children:[Y?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Ms,{className:"w-4 h-4 mr-2"}),"Save Changes"]})]})]})}),r.jsx(yt,{open:g,onOpenChange:Q=>{b(Q),Q||(O({}),A(new Set))},children:r.jsxs(ht,{className:"max-w-lg",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"w-5 h-5 text-purple-600"}),"Add Project to ",k==null?void 0:k.name]})}),r.jsxs("div",{className:"py-4",children:[r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Select projects to add to this workstream (multi-select enabled):"}),t.length>0?r.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto border border-gray-200 dark:border-slate-700 rounded-lg p-2 bg-white dark:bg-slate-900",children:t.map(Q=>{var br;const Ie=(br=k==null?void 0:k.projects)==null?void 0:br.includes(Q.path),qe=P.has(Q.path),kt=Js(Q.path,k==null?void 0:k.id),$t=q[Q.path],jt=G[Q.path],sr=R[Q.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>Ut(Q.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:jt?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):$t?r.jsx(vr,{className:"w-4 h-4 text-gray-400"}):r.jsx(xs,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!Ie&&qo(Q.path),disabled:Ie,className:`flex-1 text-left p-2 rounded transition-colors ${Ie?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":qe?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${Ie?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":qe?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(Ie||qe)&&r.jsx(It,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Q.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[kt&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${kt==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:kt}),Ie&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:Q.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),$t&&sr.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:sr.map(pr=>{var Rn;const es=(Rn=k==null?void 0:k.projects)==null?void 0:Rn.includes(pr.dir),_s=P.has(pr.dir),Xs=Js(pr.dir,k==null?void 0:k.id);return r.jsxs("button",{type:"button",onClick:()=>!es&&qo(pr.dir),disabled:es,className:`w-full text-left p-2 rounded transition-colors ${es?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":_s?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${es?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":_s?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(es||_s)&&r.jsx(It,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:pr.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[Xs&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Xs==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Xs}),es&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:pr.relativePath})]},pr.dir)})}),$t&&sr.length===0&&!jt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Q.id)})}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 text-center py-4",children:"No projects registered. Add projects in the Projects view first."})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>{b(!1),A(new Set)},children:"Cancel"}),r.jsxs(re,{onClick:no,disabled:P.size===0||Y,className:"bg-purple-600 hover:bg-purple-700",children:[Y?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Tt,{className:"w-4 h-4 mr-2"}),"Add Selected (",P.size,")"]})]})]})}),r.jsx(yt,{open:Jt,onOpenChange:Q=>{Q||(Cr(!1),Xr(""),yr(null))},children:r.jsxs(ht,{children:[r.jsx(ft,{children:r.jsx(mt,{children:"Add Trigger Folder"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:["Add a folder that will trigger the workstream ",r.jsx("strong",{children:Wt==null?void 0:Wt.name})," when you cd into it."]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Folder Path"}),r.jsx(lt,{value:us,onChange:Q=>Xr(Q.target.value),placeholder:"~/path/to/folder",className:"font-mono"}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:"Use absolute path or ~ for home directory"})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>{Cr(!1),Xr(""),yr(null)},children:"Cancel"}),r.jsxs(re,{onClick:wi,disabled:!us.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(ui,{className:"w-4 h-4 mr-2"}),"Add Folder"]})]})]})})]})}const g_={clarify:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",plan:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",execute:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},ja={pending:r.jsx(sc,{className:"w-4 h-4 text-gray-500"}),running:r.jsx(aS,{className:"w-4 h-4 text-green-500"}),paused:r.jsx(xp,{className:"w-4 h-4 text-yellow-500"}),completed:r.jsx(Mo,{className:"w-4 h-4 text-green-600"}),failed:r.jsx(Da,{className:"w-4 h-4 text-red-500"}),cancelled:r.jsx(Da,{className:"w-4 h-4 text-gray-500"})};function pW({activeProject:e=null}){var cl,dl,Jo,ul,hl,fl,Xo,lo,pn,gn,xn;const[t,s]=_.useState([]),[n,o]=_.useState(!0),[c,u]=_.useState(null),[l,d]=_.useState({}),{workstreams:f,activeId:m,fetch:h}=vN(),[x,w]=_.useState(""),[j,C]=_.useState(!1),[v,y]=_.useState(!1),[g,b]=_.useState(!1),[k,E]=_.useState(!1),[P,A]=_.useState(null),[N,M]=_.useState(!1),[I,L]=_.useState(null),[B,z]=_.useState(""),[Y,H]=_.useState(""),[U,X]=_.useState(50),[q,O]=_.useState("DONE"),[R,$]=_.useState(!1),[G,F]=_.useState(!1),[te,ce]=_.useState(!1),[fe,J]=_.useState(""),[W,ae]=_.useState(""),[ne,Z]=_.useState(!1),[le,Ce]=_.useState(!1),[Le,Ge]=_.useState(null),[me,be]=_.useState("create"),[Be,Ke]=_.useState(""),[Qe,je]=_.useState(""),[we,ve]=_.useState(50),[_e,Oe]=_.useState("DONE"),[de,ye]=_.useState(""),[Re,ze]=_.useState(50),[Je,Et]=_.useState(!1),[at,ur]=_.useState("DONE"),[Rr,Wr]=_.useState([]),[Jt,Cr]=_.useState({stopHook:{},prepromptHook:{}}),[Wt,yr]=_.useState(!1),[us,Xr]=_.useState({needsInstall:!0}),[Ls,Os]=_.useState(!1),[it,zt]=_.useState(null),[rr,ar]=_.useState(null),[ws,Vt]=_.useState(!1),[Ut,Vr]=_.useState(!1),[ut,hr]=_.useState(null),[hs,Qr]=_.useState(!0),[Ze,fn]=_.useState(null),[al,Zr]=_.useState(!1);_.useEffect(()=>{Sr(),so(),Wo(),h(),mn()},[h]);const wi=_.useRef(null);_.useEffect(()=>{if(!Ut||!ut){wi.current=null;return}wi.current=ut.status;const se=setInterval(async()=>{var De,Rt,kr;try{const bt=(await ue.getLoop(ut.id)).loop,Dr=wi.current!==bt.status,Ir=["completed","paused","failed","cancelled"].includes(bt.status);if(Dr&&Ir){clearInterval(se);const rs={id:bt.id,name:bt.name,task:(De=bt.task)==null?void 0:De.original,status:bt.status,pauseReason:bt.pauseReason,iterations:((Rt=bt.iterations)==null?void 0:Rt.current)||0,maxIterations:((kr=bt.iterations)==null?void 0:kr.max)||50,phase:bt.phase,startedAt:bt.startedAt,completedAt:bt.completedAt||new Date().toISOString(),duration:bt.startedAt?Math.round((Date.now()-new Date(bt.startedAt).getTime())/1e3):null};fn(rs),bt.status==="completed"?K.success("Loop completed successfully!"):bt.status==="paused"?K.info(`Loop paused: ${bt.pauseReason||"unknown reason"}`):bt.status==="failed"?K.error("Loop failed"):bt.status==="cancelled"&&K.warning("Loop cancelled"),Sr(),hs&&bt.status==="completed"?setTimeout(()=>{Vr(!1),hr(null),Zr(!0)},1500):Zr(!0)}wi.current=bt.status}catch(ts){console.error("Failed to poll loop status:",ts)}},3e3);return()=>clearInterval(se)},[Ut,ut,hs]);const mn=async()=>{try{const se=await ue.getRalphLoopPluginStatus();Xr(se)}catch(se){console.error("Failed to load plugin status:",se)}};_.useEffect(()=>{j&&m&&H(m)},[j,m]);const Sr=async()=>{try{o(!0);const se=await ue.getLoops();s(se.loops||[]),d(se.config||{})}catch{K.error("Failed to load loops")}finally{o(!1)}},so=async()=>{try{const De=(await ue.getLoopConfig()).config||{};d(De),ze(De.maxIterations||50),Et(De.autoApprovePlan||!1),ur(De.completionPromise||"DONE"),X(De.maxIterations||50),O(De.completionPromise||"DONE")}catch(se){console.error("Failed to load config:",se)}},Wo=async()=>{try{const se=await ue.getLoopHookStatus();Cr(se)}catch(se){console.error("Failed to load hook status:",se)}},Vo=async()=>{try{const se=await ue.getLoopHistory();Wr(se.completed||[])}catch{K.error("Failed to load history")}},_i=async()=>{if(!B.trim()){K.error("Task description is required");return}await Js(B)},Uo=async()=>{if(!B.trim()){K.error("Enter a task description first");return}try{F(!0),ae(B),be("create");const se=await ue.tuneLoopPrompt(B,(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null);se.success?(J(se.tunedPrompt),ce(!0)):K.error(se.error||"Failed to tune prompt")}catch(se){K.error(se.message)}finally{F(!1)}},Go=()=>{me==="edit"?je(fe):(z(fe),Z(!0)),ce(!1),K.success("Tuned prompt applied")},qo=()=>{ce(!1)},no=se=>{se.status==="failed"||se.status==="paused"||se.status==="cancelled"?(Ge(se),Ce(!0)):ao(se.id)},Xt=async()=>{var se,De,Rt,kr;if(Le)try{F(!0);const ts=((se=Le.task)==null?void 0:se.original)||"",bt=await ue.getLoop(Le.id),Dr=bt.loop||Le,Ir={status:Dr.status,pauseReason:Dr.pauseReason,iterations:((De=Dr.iterations)==null?void 0:De.current)||0,maxIterations:((Rt=Dr.iterations)==null?void 0:Rt.max)||50,phase:Dr.phase,clarifications:bt.clarifications||"",plan:bt.plan||"",iterationHistory:(((kr=Dr.iterations)==null?void 0:kr.history)||[]).slice(-5).map(co=>`Iteration ${co.n}: ${co.summary||"no summary"}`).join(`
3004
3004
  `)};let rs="";Ir.clarifications&&(rs+=`=== Clarifications ===
3005
3005
  ${Ir.clarifications}
3006
3006
 
@@ -3009,7 +3009,7 @@ ${Ir.plan}
3009
3009
 
3010
3010
  `),Ir.iterationHistory&&(rs+=`=== Recent Iterations ===
3011
3011
  ${Ir.iterationHistory}
3012
- `),Ir.transcript=rs;const ei=await ue.tuneLoopPrompt(ts,Le.projectPath||(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,Ir);ei.success?(await ue.updateLoop(Le.id,{task:{original:ei.tunedPrompt}}),K.success("Prompt tuned and loop updated"),Ce(!1),await Mr(Le.id),Sr()):K.error(ei.error||"Failed to tune prompt")}catch(ts){K.error(ts.message)}finally{F(!1),Ge(null)}},ll=async()=>{Le&&(Ce(!1),await ao(Le.id),Ge(null))},Js=async se=>{try{$(!0);const Me=await ue.createLoop(se,{workstreamId:Y||null,projectPath:(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,maxIterations:parseInt(U,10)||50,completionPromise:q||"DONE"});Me.success?(K.success("Loop created"),C(!1),z(""),H(""),X(De),O(at),Z(!1),Sr()):K.error(Me.error||"Failed to create loop")}catch(Me){K.error(Me.message)}finally{$(!1)}},io=async se=>{if(us.needsInstall){zt(se),ar("start"),Os(!0);return}await Tn(se)},Tn=async se=>{try{const Me=await ue.startLoop(se);Me.success&&Me.loop?(K.success("Loop started - launching Claude Code"),hr(Me.loop),Vr(!0),Sr()):K.error(Me.error||"Failed to start loop")}catch(Me){K.error(Me.message)}},Ko=async()=>{try{Vt(!0);const se=await ue.installRalphLoopPlugin();se.success?(K.success("ralph-loop plugin installed"),Xr({installed:!0,scope:"user",needsInstall:!1}),Os(!1),it&&(rr==="resume"?await Mr(it):await Tn(it),zt(null),ar(null))):K.error(se.error||"Failed to install plugin")}catch(se){K.error(se.message)}finally{Vt(!1)}},oo=()=>{Os(!1),zt(null),ar(null)},Zn=_.useCallback(async(se,Me)=>{var Rt,kr,ts,bt,Dr,Ir,rs,ei,co,Ci,Si,ti,uo,Uc;if(ut)try{const gt=(await ue.getLoop(ut.id)).loop;if(gt.taskComplete||gt.status==="completed")K.success("Loop completed successfully!"),fn({id:gt.id,name:gt.name,task:(Rt=gt.task)==null?void 0:Rt.original,status:"completed",iterations:((kr=gt.iterations)==null?void 0:kr.current)||0,maxIterations:((ts=gt.iterations)==null?void 0:ts.max)||50,phase:gt.phase,startedAt:gt.startedAt,completedAt:gt.completedAt||new Date().toISOString()}),Zr(!0),Vr(!1),hr(null);else if(gt.status==="paused")K.info(`Loop paused: ${gt.pauseReason||"user requested"}`),fn({id:gt.id,name:gt.name,task:(bt=gt.task)==null?void 0:bt.original,status:"paused",pauseReason:gt.pauseReason,iterations:((Dr=gt.iterations)==null?void 0:Dr.current)||0,maxIterations:((Ir=gt.iterations)==null?void 0:Ir.max)||50,phase:gt.phase,startedAt:gt.startedAt,completedAt:new Date().toISOString()}),Zr(!0);else if(se===0&&!Me)await ue.completeLoop(gt.id),K.success("Loop completed successfully!"),fn({id:gt.id,name:gt.name,task:(rs=gt.task)==null?void 0:rs.original,status:"completed",iterations:((ei=gt.iterations)==null?void 0:ei.current)||0,maxIterations:((co=gt.iterations)==null?void 0:co.max)||50,phase:"execute",startedAt:gt.startedAt,completedAt:new Date().toISOString()}),Zr(!0),Vr(!1),hr(null);else if(((Ci=gt.iterations)==null?void 0:Ci.current)>=((Si=gt.iterations)==null?void 0:Si.max))K.warning("Loop reached max iterations"),await ue.pauseLoop(gt.id);else{const Qo=Me?`Signal: ${Me}`:`Exit code: ${se}`;fn({id:gt.id,name:gt.name,task:(ti=gt.task)==null?void 0:ti.original,status:"paused",pauseReason:Qo,iterations:((uo=gt.iterations)==null?void 0:uo.current)||0,maxIterations:((Uc=gt.iterations)==null?void 0:Uc.max)||50,phase:gt.phase,startedAt:gt.startedAt,completedAt:new Date().toISOString()}),Zr(!0)}Sr()}catch(Gc){console.error("Failed to check loop status:",Gc)}},[ut]),fs=async se=>{try{const Me=await ue.pauseLoop(se);Me.success?(K.success("Loop paused"),Sr()):K.error(Me.error||"Failed to pause loop")}catch(Me){K.error(Me.message)}},ao=async se=>{if(us.needsInstall){zt(se),ar("resume"),Os(!0);return}await Mr(se)},Mr=async se=>{try{const Me=await ue.resumeLoop(se);Me.success&&Me.loop?(K.success("Loop resumed - launching Claude Code"),hr(Me.loop),Vr(!0),Sr()):K.error(Me.error||"Failed to resume loop")}catch(Me){K.error(Me.message)}},Q=async se=>{if(confirm("Cancel this loop?"))try{const Me=await ue.cancelLoop(se);Me.success?(K.success("Loop cancelled"),Sr()):K.error(Me.error||"Failed to cancel loop")}catch(Me){K.error(Me.message)}},Ie=async se=>{if(confirm("Delete this loop and all its data?"))try{const Me=await ue.deleteLoop(se);Me.success?(K.success("Loop deleted"),Sr()):K.error(Me.error||"Failed to delete loop")}catch(Me){K.error(Me.message)}},qe=se=>{var Me,Rt;L(se),Ke(se.name||""),je(((Me=se.task)==null?void 0:Me.original)||""),ve(((Rt=se.iterations)==null?void 0:Rt.max)||50),Oe(se.completionPromise||"DONE"),ye(se.workstreamId||""),M(!0)},kt=async()=>{if(I)try{$(!0);const se={name:Be,task:{original:Qe},iterations:{max:parseInt(we,10)},completionPromise:_e,workstreamId:de||null},Me=await ue.updateLoop(I.id,se);Me.success?(K.success("Loop updated"),M(!1),L(null),Sr()):K.error(Me.error||"Failed to update loop")}catch(se){K.error(se.message)}finally{$(!1)}},$t=async se=>{var Me,Rt;try{$(!0);const kr=await ue.createLoop(((Me=se.task)==null?void 0:Me.original)||"",{name:`${se.name} (copy)`,workstreamId:se.workstreamId||null,projectPath:se.projectPath||(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,maxIterations:((Rt=se.iterations)==null?void 0:Rt.max)||50,completionPromise:se.completionPromise||"DONE"});kr.success?(K.success("Loop copied"),Sr()):K.error(kr.error||"Failed to copy loop")}catch(kr){K.error(kr.message)}finally{$(!1)}},jt=async se=>{try{const Me=await ue.approveLoop(se);Me.success?(K.success("Plan approved"),Sr()):K.error(Me.error||"Failed to approve plan")}catch(Me){K.error(Me.message)}},sr=async()=>{try{$(!0);const se=await ue.updateLoopConfig({maxIterations:parseInt(De,10),autoApprovePlan:Je,completionPromise:at});se.success?(K.success("Configuration saved"),y(!1),so()):K.error(se.error||"Failed to save configuration")}catch(se){K.error(se.message)}finally{$(!1)}},br=async()=>{try{yr(!0);const se=await ue.installLoopHooks();se.success?(K.success("Hooks installed successfully"),Wo()):K.error(se.error||"Failed to install hooks")}catch(se){K.error(se.message)}finally{yr(!1)}},pr=async se=>{try{const Me=await ue.getLoop(se.id);A({...Me.loop,clarifications:Me.clarifications,plan:Me.plan}),E(!0)}catch{K.error("Failed to load loop details")}},es=se=>{navigator.clipboard.writeText(se),K.success("Copied to clipboard")},_s=se=>se?new Date(se).toLocaleString():"-",Xs=se=>se.iterations?Math.min(100,se.iterations.current/se.iterations.max*100):0,Rn=((cl=Jt.stopHook)==null?void 0:cl.registered)&&((dl=Jt.prepromptHook)==null?void 0:dl.registered),Vc=se=>{if(!se)return null;const Me=f.find(Rt=>Rt.id===se);return(Me==null?void 0:Me.name)||se},Yo=x?t.filter(se=>se.workstreamId===x):t,Pt=(se,Me=!1)=>{var bt,Dr;const Rt=((bt=se.task)==null?void 0:bt.original)||"";if((Dr=se.iterations)!=null&&Dr.max,se.completionPromise,Me){const Ir=Rt.replace(/\n+/g," ").substring(0,100),rs=Rt.length>100?"...":"";return`claude --dangerously-skip-permissions "${Ir.replace(/"/g,'\\"')}${rs}"`}return{startCmd:"claude --dangerously-skip-permissions",skillCmd:Rt}};return r.jsxs("div",{className:"p-6 space-y-6 max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(hc,{className:"w-6 h-6"}),"Ralph Loops"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Autonomous development loops with iteration tracking and safety controls"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[f.length>0&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Rg,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("select",{className:"text-sm border rounded px-2 py-1 bg-background",value:x,onChange:se=>w(se.target.value),children:[r.jsx("option",{value:"",children:"All workstreams"}),f.map(se=>r.jsx("option",{value:se.id,children:se.name},se.id))]})]}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>{Vo(),b(!0)},children:[r.jsx(ju,{className:"w-4 h-4 mr-1"}),"History"]})}),r.jsx(Dt,{children:"View completed loops"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>y(!0),children:[r.jsx(un,{className:"w-4 h-4 mr-1"}),"Config"]})}),r.jsx(Dt,{children:"Configure loop defaults"})]})}),r.jsxs(re,{onClick:()=>C(!0),children:[r.jsx(Tt,{className:"w-4 h-4 mr-1"}),"New Loop"]})]})]}),!Rn&&r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ts,{className:"w-5 h-5 text-yellow-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:"Hooks not installed"}),r.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"Install the Ralph Loop hooks to enable automatic loop continuation"})]})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:br,disabled:Wt,children:[Wt?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Install Hooks"]})]}),n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(et,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):Yo.length===0?r.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[r.jsx(hc,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"text-lg font-medium",children:x?"No loops in this workstream":"No loops yet"}),r.jsx("p",{className:"text-sm mt-1",children:"Create a loop to start autonomous development"})]}):r.jsx("div",{className:"space-y-3",children:Yo.map(se=>{var Me,Rt,kr,ts,bt;return r.jsxs("div",{className:"border rounded-lg bg-card overflow-hidden",children:[r.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>u(c===se.id?null:se.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[c===se.id?r.jsx(vr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(xs,{className:"w-4 h-4 text-muted-foreground"}),ja[se.status]||ja.pending,r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium",children:se.name}),r.jsx("p",{className:"text-sm text-muted-foreground truncate max-w-md",children:((Me=se.task)==null?void 0:Me.original)||"No task"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[se.workstreamId&&r.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200 flex items-center gap-1",children:[r.jsx(Bn,{className:"w-3 h-3"}),Vc(se.workstreamId)]}),r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${g_[se.phase]||"bg-gray-100 dark:bg-gray-800"}`,children:se.phase}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[((Rt=se.iterations)==null?void 0:Rt.current)||0,"/",((kr=se.iterations)==null?void 0:kr.max)||50]}),r.jsxs("div",{className:"flex items-center gap-1",onClick:Dr=>Dr.stopPropagation(),children:[se.status==="pending"&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>io(se.id),children:r.jsx(aS,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Start loop"})]})}),se.status==="running"&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>fs(se.id),children:r.jsx(xp,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Pause loop"})]})}),se.status==="paused"&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>no(se),children:r.jsx(Yd,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Resume loop"})]})}),(se.status==="cancelled"||se.status==="failed")&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>no(se),children:r.jsx(Yd,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Restart loop"})]})}),se.phase==="plan"&&se.status==="running"&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>jt(se.id),children:r.jsx(It,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Approve plan"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>qe(se),children:r.jsx(Ju,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Edit loop"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>$t(se),children:r.jsx(Wa,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Duplicate loop"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>pr(se),children:r.jsx(Ag,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"View details"})]})}),(se.status==="running"||se.status==="paused")&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Q(se.id),children:r.jsx(Da,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Cancel loop"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Ie(se.id),children:r.jsx(ys,{className:"w-4 h-4 text-red-500"})})}),r.jsx(Dt,{children:"Delete loop"})]})})]})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Iterations"}),r.jsxs("span",{children:[((ts=se.iterations)==null?void 0:ts.current)||0," / ",((bt=se.iterations)==null?void 0:bt.max)||50]})]}),r.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-blue-500 transition-all",style:{width:`${Xs(se)}%`}})})]})]}),c===se.id&&r.jsxs("div",{className:"border-t p-4 bg-muted/30 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"ID:"}),r.jsx("span",{className:"ml-2 font-mono",children:se.id}),r.jsx(re,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 ml-1",onClick:()=>es(se.id),children:r.jsx(Wa,{className:"w-3 h-3"})})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Status:"}),r.jsxs("span",{className:"ml-2",children:[se.status,se.pauseReason?` (${se.pauseReason})`:""]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Created:"}),r.jsx("span",{className:"ml-2",children:_s(se.createdAt)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Updated:"}),r.jsx("span",{className:"ml-2",children:_s(se.updatedAt)})]}),se.workstreamId&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Workstream:"}),r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1",children:[r.jsx(Bn,{className:"w-3 h-3 text-purple-500"}),Vc(se.workstreamId)]})]})]}),r.jsxs("div",{className:"bg-muted p-3 rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Kt,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Run this loop (uses official ralph-loop plugin):"})]}),r.jsx("code",{className:"text-xs bg-background p-2 rounded block whitespace-pre-wrap",children:Pt(se,!0)})]})]})]},se.id)})}),r.jsx(yt,{open:j,onOpenChange:C,children:r.jsxs(ht,{className:"sm:max-w-lg",children:[r.jsx(ft,{children:r.jsx(mt,{children:"Create New Loop"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium",children:"Task Description"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",onClick:Uo,disabled:G||!B.trim(),className:"h-7 text-xs",children:[G?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(cs,{className:"w-3 h-3 mr-1"}),"Tune with AI"]})}),r.jsx(Dt,{children:r.jsx("p",{className:"max-w-xs",children:"Use Claude to optimize your prompt for Ralph Loop execution - adds clear completion signals, verification steps, and acceptance criteria."})})]})})]}),r.jsx(_t,{placeholder:"Describe what you want Claude to accomplish...",value:B,onChange:se=>{z(se.target.value),Z(!1)},rows:4}),r.jsxs("div",{className:"flex items-center justify-between mt-1",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Be specific about the goal. The loop will continue until this task is completed."}),ne&&r.jsxs("span",{className:"text-xs text-green-600 dark:text-green-400 flex items-center gap-1",children:[r.jsx(Ht,{className:"w-3 h-3"}),"AI-tuned"]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Project"}),r.jsx("div",{className:"text-sm p-2 bg-muted rounded-md",children:e?r.jsx("span",{className:"font-mono",children:e.name||e.path||e.dir}):r.jsx("span",{className:"text-muted-foreground",children:"No project selected - loop will run in server directory"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:U,onChange:se=>X(se.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Safety limit for the loop"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Completion Promise"}),r.jsx(lt,{value:q,onChange:se=>O(se.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Text that signals completion"})]})]}),f.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Workstream (optional)"}),r.jsxs("select",{className:"w-full border rounded-md p-2 bg-background",value:Y,onChange:se=>H(se.target.value),children:[r.jsx("option",{value:"",children:"No workstream"}),f.map(se=>r.jsx("option",{value:se.id,children:se.name},se.id))]})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsxs(re,{onClick:_i,disabled:R||!B.trim(),children:[R?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Create Loop"]})]})]})}),r.jsx(yt,{open:N,onOpenChange:M,children:r.jsxs(ht,{className:"sm:max-w-lg",children:[r.jsx(ft,{children:r.jsx(mt,{children:"Edit Loop"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Name"}),r.jsx(lt,{placeholder:"Loop name",value:Be,onChange:se=>Ke(se.target.value)})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium",children:"Task Description"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",onClick:async()=>{if(!Qe.trim()){K.error("Enter a task description first");return}try{F(!0),ae(Qe),be("edit");const se=await ue.tuneLoopPrompt(Qe,(I==null?void 0:I.projectPath)||(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null);se.success?(J(se.tunedPrompt),ce(!0)):K.error(se.error||"Failed to tune prompt")}catch(se){K.error(se.message)}finally{F(!1)}},disabled:G||!Qe.trim(),className:"h-7 text-xs",children:[G?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(cs,{className:"w-3 h-3 mr-1"}),"Tune with AI"]})}),r.jsx(Dt,{children:r.jsx("p",{className:"max-w-xs",children:"Use Claude to optimize your prompt for Ralph Loop execution."})})]})})]}),r.jsx(_t,{placeholder:"Describe what you want Claude to accomplish...",value:Qe,onChange:se=>je(se.target.value),rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:we,onChange:se=>ve(se.target.value),min:1,max:1e3})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Completion Promise"}),r.jsx(lt,{value:_e,onChange:se=>Oe(se.target.value),placeholder:"DONE"})]})]}),f.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Workstream"}),r.jsxs("select",{className:"w-full border rounded-md p-2 bg-background",value:de,onChange:se=>ye(se.target.value),children:[r.jsx("option",{value:"",children:"No workstream"}),f.map(se=>r.jsx("option",{value:se.id,children:se.name},se.id))]})]}),I&&r.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.jsxs("span",{children:["ID: ",I.id]}),r.jsx("span",{className:"mx-2",children:"|"}),r.jsxs("span",{children:["Status: ",I.status]}),r.jsx("span",{className:"mx-2",children:"|"}),r.jsxs("span",{children:["Phase: ",I.phase]})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),r.jsxs(re,{onClick:kt,disabled:R||!Qe.trim(),children:[R?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Save Changes"]})]})]})}),r.jsx(yt,{open:v,onOpenChange:y,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsx(mt,{children:"Loop Configuration"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:De,onChange:se=>ze(se.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Loop will pause after this many iterations"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Default Completion Promise"}),r.jsx(lt,{value:at,onChange:se=>ur(se.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Default text that signals loop completion (used with official ralph-loop plugin)"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"checkbox",id:"autoApprovePlan",checked:Je,onChange:se=>Et(se.target.checked),className:"rounded"}),r.jsx("label",{htmlFor:"autoApprovePlan",className:"text-sm",children:"Auto-approve plans (skip manual plan approval)"})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsxs(re,{onClick:sr,disabled:R,children:[R?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Save"]})]})]})}),r.jsx(yt,{open:g,onOpenChange:b,children:r.jsxs(ht,{className:"sm:max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsx(mt,{children:"Loop History"})}),r.jsx("div",{className:"space-y-3 py-4",children:Rr.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No completed loops yet"}):Rr.slice().reverse().map(se=>r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[ja[se.status]||ja.completed,r.jsx("span",{className:"font-medium",children:se.name})]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:_s(se.completedAt)})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:se.task}),r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:r.jsxs("span",{children:["Iterations: ",se.totalIterations]})})]},se.id))})]})}),r.jsx(yt,{open:k,onOpenChange:E,children:r.jsxs(ht,{className:"sm:max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsx(mt,{children:(P==null?void 0:P.name)||"Loop Details"})}),P&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Phase"}),r.jsx("span",{className:`text-sm px-2 py-0.5 rounded-full ${g_[P.phase]||""}`,children:P.phase})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Status"}),r.jsxs("div",{className:"flex items-center gap-1",children:[ja[P.status],r.jsx("span",{children:P.status})]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Progress"}),r.jsxs("span",{children:[((Jo=P.iterations)==null?void 0:Jo.current)||0," / ",((ul=P.iterations)==null?void 0:ul.max)||50]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Task"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm",children:(hl=P.task)==null?void 0:hl.original})]}),P.clarifications&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Clarifications"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-40 overflow-y-auto",children:P.clarifications})]}),P.plan&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Plan"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-60 overflow-y-auto font-mono",children:P.plan})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Max Iterations"}),r.jsx("div",{className:"bg-muted p-2 rounded text-sm",children:((fl=P.iterations)==null?void 0:fl.max)||50})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Completion Promise"}),r.jsxs("div",{className:"bg-muted p-2 rounded text-sm font-mono",children:["<promise>",P.completionPromise||"DONE","</promise>"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Run Command (uses official ralph-loop plugin)"}),r.jsx("code",{className:"text-xs bg-muted p-3 rounded block whitespace-pre-wrap",children:Pt(P,!0)})]})]})]})}),r.jsx(yt,{open:Ls,onOpenChange:Os,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(xi,{className:"w-5 h-5"}),"Install ralph-loop Plugin"]})}),r.jsxs("div",{className:"py-4",children:[r.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["The ",r.jsx("code",{className:"bg-muted px-1 rounded",children:"ralph-loop"})," plugin is required to run loops. This plugin provides the ",r.jsx("code",{className:"bg-muted px-1 rounded",children:"/ralph-loop"})," command that enables autonomous iteration."]}),us.scope==="project"&&r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded p-3 mb-4",children:r.jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:["Plugin is currently installed only for project: ",r.jsx("br",{}),r.jsx("code",{className:"text-xs",children:us.projectPath})]})}),r.jsx("p",{className:"text-sm",children:"Install the plugin globally (user scope) to use loops from any project?"})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:oo,disabled:ws,children:"Cancel"}),r.jsx(re,{onClick:Ko,disabled:ws,children:ws?r.jsxs(r.Fragment,{children:[r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}),"Installing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(xi,{className:"w-4 h-4 mr-1"}),"Install Plugin"]})})]})]})}),r.jsx(Lj,{open:Ut,onOpenChange:se=>{Vr(se),se||(hr(null),Sr())},title:ut?`Loop: ${ut.name}`:"Running Loop",description:ut?((lo=(Xo=ut.task)==null?void 0:Xo.original)==null?void 0:lo.substring(0,100))+(((gn=(pn=ut.task)==null?void 0:pn.original)==null?void 0:gn.length)>100?"...":""):"",cwd:ut==null?void 0:ut.projectPath,initialCommand:ut?Pt(ut).startCmd:"",delayedCommand:ut?Pt(ut).skillCmd:"",delayedCommandDelay:5e3,env:ut?{CODER_LOOP_ID:ut.id,...ut.workstreamId&&{CODER_WORKSTREAM:ut.workstreamId}}:{},onExit:Zn,headerExtra:r.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[r.jsx("input",{type:"checkbox",checked:hs,onChange:se=>Qr(se.target.checked),className:"rounded"}),"Auto-close when done"]})}),r.jsx(yt,{open:te,onOpenChange:ce,children:r.jsxs(ht,{className:"sm:max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(cs,{className:"w-5 h-5 text-purple-500"}),"AI-Tuned Prompt"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2 text-muted-foreground",children:"Original Prompt"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-32 overflow-y-auto",children:W})]}),r.jsxs("div",{children:[r.jsxs("h4",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(Ht,{className:"w-4 h-4 text-purple-500"}),"Tuned Prompt"]}),r.jsx(_t,{value:fe,onChange:se=>J(se.target.value),rows:10,className:"font-mono text-sm"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"You can edit the tuned prompt before accepting it."})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:qo,children:"Keep Original"}),r.jsxs(re,{onClick:Go,children:[r.jsx(It,{className:"w-4 h-4 mr-1"}),"Use Tuned Prompt"]})]})]})}),r.jsx(yt,{open:le,onOpenChange:Ce,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Yd,{className:"w-5 h-5"}),"Resume Loop"]})}),r.jsx("div",{className:"py-4",children:Le&&r.jsxs(r.Fragment,{children:[r.jsxs("p",{className:"text-sm mb-4",children:["This loop ",Le.status==="failed"?"failed":Le.status==="cancelled"?"was cancelled":"was paused",Le.pauseReason&&`: ${Le.pauseReason}`]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Would you like to tune the prompt with AI before resuming? This can help add guardrails based on what went wrong."}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm max-h-32 overflow-y-auto",children:(xn=Le.task)==null?void 0:xn.original})]})}),r.jsxs(St,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(re,{variant:"outline",onClick:()=>{Ce(!1),Ge(null)},children:"Cancel"}),r.jsx(re,{variant:"secondary",onClick:ll,children:"Resume As-Is"}),r.jsxs(re,{onClick:Xt,disabled:G,children:[G?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):r.jsx(cs,{className:"w-4 h-4 mr-1"}),"Tune & Resume"]})]})]})}),r.jsx(yt,{open:al,onOpenChange:Zr,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[(Ze==null?void 0:Ze.status)==="completed"&&r.jsxs(r.Fragment,{children:[r.jsx(Mo,{className:"w-5 h-5 text-green-600"})," Loop Completed"]}),(Ze==null?void 0:Ze.status)==="paused"&&r.jsxs(r.Fragment,{children:[r.jsx(xp,{className:"w-5 h-5 text-yellow-500"})," Loop Paused"]}),(Ze==null?void 0:Ze.status)==="failed"&&r.jsxs(r.Fragment,{children:[r.jsx(Da,{className:"w-5 h-5 text-red-500"})," Loop Failed"]}),(Ze==null?void 0:Ze.status)==="cancelled"&&r.jsxs(r.Fragment,{children:[r.jsx(Da,{className:"w-5 h-5 text-gray-500"})," Loop Cancelled"]})]})}),Ze&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-1",children:"Task"}),r.jsx("p",{className:"text-sm text-muted-foreground bg-muted p-2 rounded",children:Ze.task})]}),Ze.pauseReason&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-1",children:"Reason"}),r.jsx("p",{className:"text-sm text-muted-foreground bg-muted p-2 rounded",children:Ze.pauseReason})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Status"}),r.jsxs("div",{className:"font-medium flex items-center gap-1",children:[ja[Ze.status],r.jsx("span",{className:"capitalize",children:Ze.status})]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Iterations"}),r.jsxs("div",{className:"font-medium",children:[Ze.iterations," / ",Ze.maxIterations]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Duration"}),r.jsx("div",{className:"font-medium",children:Ze.duration!=null?Ze.duration<60?`${Ze.duration}s`:Ze.duration<3600?`${Math.floor(Ze.duration/60)}m ${Ze.duration%60}s`:`${Math.floor(Ze.duration/3600)}h ${Math.floor(Ze.duration%3600/60)}m`:"-"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[Ze.status==="completed"?"Completed":"Stopped"," at ",_s(Ze.completedAt)]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>Zr(!1),children:"Close"}),((Ze==null?void 0:Ze.status)==="paused"||(Ze==null?void 0:Ze.status)==="failed"||(Ze==null?void 0:Ze.status)==="cancelled")&&r.jsxs(re,{onClick:()=>{if(Zr(!1),Ze!=null&&Ze.id){const se=t.find(Me=>Me.id===Ze.id);se&&no(se)}},children:[r.jsx(Yd,{className:"w-4 h-4 mr-1"}),(Ze==null?void 0:Ze.status)==="paused"?"Resume":"Restart"]}),r.jsx(re,{variant:"secondary",onClick:()=>{if(Zr(!1),Ze!=null&&Ze.id){const se=t.find(Me=>Me.id===Ze.id);se&&pr(se)}},children:"View Details"})]})]})})]})}function gW(e,t=[]){let s=[];function n(c,u){const l=_.createContext(u);l.displayName=c+"Context";const d=s.length;s=[...s,u];const f=h=>{var y;const{scope:x,children:w,...j}=h,C=((y=x==null?void 0:x[e])==null?void 0:y[d])||l,v=_.useMemo(()=>j,Object.values(j));return r.jsx(C.Provider,{value:v,children:w})};f.displayName=c+"Provider";function m(h,x){var C;const w=((C=x==null?void 0:x[e])==null?void 0:C[d])||l,j=_.useContext(w);if(j)return j;if(u!==void 0)return u;throw new Error(`\`${h}\` must be used within \`${c}\``)}return[f,m]}const o=()=>{const c=s.map(u=>_.createContext(u));return function(l){const d=(l==null?void 0:l[e])||c;return _.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return o.scopeName=e,[n,xW(o,...t)]}function xW(...e){const t=e[0];if(e.length===1)return t;const s=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(c){const u=n.reduce((l,{useScope:d,scopeName:f})=>{const h=d(c)[`__scope${f}`];return{...l,...h}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return s.scopeName=t.scopeName,s}var vW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],v2=vW.reduce((e,t)=>{const s=Xu(`Primitive.${t}`),n=_.forwardRef((o,c)=>{const{asChild:u,...l}=o,d=u?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...l,ref:c})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Wx="Progress",Vx=100,[yW]=gW(Wx),[bW,wW]=yW(Wx),y2=_.forwardRef((e,t)=>{const{__scopeProgress:s,value:n=null,max:o,getValueLabel:c=_W,...u}=e;(o||o===0)&&!x_(o)&&console.error(CW(`${o}`,"Progress"));const l=x_(o)?o:Vx;n!==null&&!v_(n,l)&&console.error(SW(`${n}`,"Progress"));const d=v_(n,l)?n:null,f=zu(d)?c(d,l):void 0;return r.jsx(bW,{scope:s,value:d,max:l,children:r.jsx(v2.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":zu(d)?d:void 0,"aria-valuetext":f,role:"progressbar","data-state":_2(d,l),"data-value":d??void 0,"data-max":l,...u,ref:t})})});y2.displayName=Wx;var b2="ProgressIndicator",w2=_.forwardRef((e,t)=>{const{__scopeProgress:s,...n}=e,o=wW(b2,s);return r.jsx(v2.div,{"data-state":_2(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...n,ref:t})});w2.displayName=b2;function _W(e,t){return`${Math.round(e/t*100)}%`}function _2(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function zu(e){return typeof e=="number"}function x_(e){return zu(e)&&!isNaN(e)&&e>0}function v_(e,t){return zu(e)&&!isNaN(e)&&e<=t&&e>=0}function CW(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Vx}\`.`}function SW(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
3012
+ `),Ir.transcript=rs;const ei=await ue.tuneLoopPrompt(ts,Le.projectPath||(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,Ir);ei.success?(await ue.updateLoop(Le.id,{task:{original:ei.tunedPrompt}}),K.success("Prompt tuned and loop updated"),Ce(!1),await Mr(Le.id),Sr()):K.error(ei.error||"Failed to tune prompt")}catch(ts){K.error(ts.message)}finally{F(!1),Ge(null)}},ll=async()=>{Le&&(Ce(!1),await ao(Le.id),Ge(null))},Js=async se=>{try{$(!0);const De=await ue.createLoop(se,{workstreamId:Y||null,projectPath:(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,maxIterations:parseInt(U,10)||50,completionPromise:q||"DONE"});De.success?(K.success("Loop created"),C(!1),z(""),H(""),X(Re),O(at),Z(!1),Sr()):K.error(De.error||"Failed to create loop")}catch(De){K.error(De.message)}finally{$(!1)}},io=async se=>{if(us.needsInstall){zt(se),ar("start"),Os(!0);return}await Tn(se)},Tn=async se=>{try{const De=await ue.startLoop(se);De.success&&De.loop?(K.success("Loop started - launching Claude Code"),hr(De.loop),Vr(!0),Sr()):K.error(De.error||"Failed to start loop")}catch(De){K.error(De.message)}},Ko=async()=>{try{Vt(!0);const se=await ue.installRalphLoopPlugin();se.success?(K.success("ralph-loop plugin installed"),Xr({installed:!0,scope:"user",needsInstall:!1}),Os(!1),it&&(rr==="resume"?await Mr(it):await Tn(it),zt(null),ar(null))):K.error(se.error||"Failed to install plugin")}catch(se){K.error(se.message)}finally{Vt(!1)}},oo=()=>{Os(!1),zt(null),ar(null)},Zn=_.useCallback(async(se,De)=>{var Rt,kr,ts,bt,Dr,Ir,rs,ei,co,Ci,Si,ti,uo,Uc;if(ut)try{const gt=(await ue.getLoop(ut.id)).loop;if(gt.taskComplete||gt.status==="completed")K.success("Loop completed successfully!"),fn({id:gt.id,name:gt.name,task:(Rt=gt.task)==null?void 0:Rt.original,status:"completed",iterations:((kr=gt.iterations)==null?void 0:kr.current)||0,maxIterations:((ts=gt.iterations)==null?void 0:ts.max)||50,phase:gt.phase,startedAt:gt.startedAt,completedAt:gt.completedAt||new Date().toISOString()}),Zr(!0),Vr(!1),hr(null);else if(gt.status==="paused")K.info(`Loop paused: ${gt.pauseReason||"user requested"}`),fn({id:gt.id,name:gt.name,task:(bt=gt.task)==null?void 0:bt.original,status:"paused",pauseReason:gt.pauseReason,iterations:((Dr=gt.iterations)==null?void 0:Dr.current)||0,maxIterations:((Ir=gt.iterations)==null?void 0:Ir.max)||50,phase:gt.phase,startedAt:gt.startedAt,completedAt:new Date().toISOString()}),Zr(!0);else if(se===0&&!De)await ue.completeLoop(gt.id),K.success("Loop completed successfully!"),fn({id:gt.id,name:gt.name,task:(rs=gt.task)==null?void 0:rs.original,status:"completed",iterations:((ei=gt.iterations)==null?void 0:ei.current)||0,maxIterations:((co=gt.iterations)==null?void 0:co.max)||50,phase:"execute",startedAt:gt.startedAt,completedAt:new Date().toISOString()}),Zr(!0),Vr(!1),hr(null);else if(((Ci=gt.iterations)==null?void 0:Ci.current)>=((Si=gt.iterations)==null?void 0:Si.max))K.warning("Loop reached max iterations"),await ue.pauseLoop(gt.id);else{const Qo=De?`Signal: ${De}`:`Exit code: ${se}`;fn({id:gt.id,name:gt.name,task:(ti=gt.task)==null?void 0:ti.original,status:"paused",pauseReason:Qo,iterations:((uo=gt.iterations)==null?void 0:uo.current)||0,maxIterations:((Uc=gt.iterations)==null?void 0:Uc.max)||50,phase:gt.phase,startedAt:gt.startedAt,completedAt:new Date().toISOString()}),Zr(!0)}Sr()}catch(Gc){console.error("Failed to check loop status:",Gc)}},[ut]),fs=async se=>{try{const De=await ue.pauseLoop(se);De.success?(K.success("Loop paused"),Sr()):K.error(De.error||"Failed to pause loop")}catch(De){K.error(De.message)}},ao=async se=>{if(us.needsInstall){zt(se),ar("resume"),Os(!0);return}await Mr(se)},Mr=async se=>{try{const De=await ue.resumeLoop(se);De.success&&De.loop?(K.success("Loop resumed - launching Claude Code"),hr(De.loop),Vr(!0),Sr()):K.error(De.error||"Failed to resume loop")}catch(De){K.error(De.message)}},Q=async se=>{if(confirm("Cancel this loop?"))try{const De=await ue.cancelLoop(se);De.success?(K.success("Loop cancelled"),Sr()):K.error(De.error||"Failed to cancel loop")}catch(De){K.error(De.message)}},Ie=async se=>{if(confirm("Delete this loop and all its data?"))try{const De=await ue.deleteLoop(se);De.success?(K.success("Loop deleted"),Sr()):K.error(De.error||"Failed to delete loop")}catch(De){K.error(De.message)}},qe=se=>{var De,Rt;L(se),Ke(se.name||""),je(((De=se.task)==null?void 0:De.original)||""),ve(((Rt=se.iterations)==null?void 0:Rt.max)||50),Oe(se.completionPromise||"DONE"),ye(se.workstreamId||""),M(!0)},kt=async()=>{if(I)try{$(!0);const se={name:Be,task:{original:Qe},iterations:{max:parseInt(we,10)},completionPromise:_e,workstreamId:de||null},De=await ue.updateLoop(I.id,se);De.success?(K.success("Loop updated"),M(!1),L(null),Sr()):K.error(De.error||"Failed to update loop")}catch(se){K.error(se.message)}finally{$(!1)}},$t=async se=>{var De,Rt;try{$(!0);const kr=await ue.createLoop(((De=se.task)==null?void 0:De.original)||"",{name:`${se.name} (copy)`,workstreamId:se.workstreamId||null,projectPath:se.projectPath||(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,maxIterations:((Rt=se.iterations)==null?void 0:Rt.max)||50,completionPromise:se.completionPromise||"DONE"});kr.success?(K.success("Loop copied"),Sr()):K.error(kr.error||"Failed to copy loop")}catch(kr){K.error(kr.message)}finally{$(!1)}},jt=async se=>{try{const De=await ue.approveLoop(se);De.success?(K.success("Plan approved"),Sr()):K.error(De.error||"Failed to approve plan")}catch(De){K.error(De.message)}},sr=async()=>{try{$(!0);const se=await ue.updateLoopConfig({maxIterations:parseInt(Re,10),autoApprovePlan:Je,completionPromise:at});se.success?(K.success("Configuration saved"),y(!1),so()):K.error(se.error||"Failed to save configuration")}catch(se){K.error(se.message)}finally{$(!1)}},br=async()=>{try{yr(!0);const se=await ue.installLoopHooks();se.success?(K.success("Hooks installed successfully"),Wo()):K.error(se.error||"Failed to install hooks")}catch(se){K.error(se.message)}finally{yr(!1)}},pr=async se=>{try{const De=await ue.getLoop(se.id);A({...De.loop,clarifications:De.clarifications,plan:De.plan}),E(!0)}catch{K.error("Failed to load loop details")}},es=se=>{navigator.clipboard.writeText(se),K.success("Copied to clipboard")},_s=se=>se?new Date(se).toLocaleString():"-",Xs=se=>se.iterations?Math.min(100,se.iterations.current/se.iterations.max*100):0,Rn=((cl=Jt.stopHook)==null?void 0:cl.registered)&&((dl=Jt.prepromptHook)==null?void 0:dl.registered),Vc=se=>{if(!se)return null;const De=f.find(Rt=>Rt.id===se);return(De==null?void 0:De.name)||se},Yo=x?t.filter(se=>se.workstreamId===x):t,Pt=(se,De=!1)=>{var bt,Dr;const Rt=((bt=se.task)==null?void 0:bt.original)||"";if((Dr=se.iterations)!=null&&Dr.max,se.completionPromise,De){const Ir=Rt.replace(/\n+/g," ").substring(0,100),rs=Rt.length>100?"...":"";return`claude --dangerously-skip-permissions "${Ir.replace(/"/g,'\\"')}${rs}"`}return{startCmd:"claude --dangerously-skip-permissions",skillCmd:Rt}};return r.jsxs("div",{className:"p-6 space-y-6 max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(hc,{className:"w-6 h-6"}),"Ralph Loops"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Autonomous development loops with iteration tracking and safety controls"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[f.length>0&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Rg,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("select",{className:"text-sm border rounded px-2 py-1 bg-background",value:x,onChange:se=>w(se.target.value),children:[r.jsx("option",{value:"",children:"All workstreams"}),f.map(se=>r.jsx("option",{value:se.id,children:se.name},se.id))]})]}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>{Vo(),b(!0)},children:[r.jsx(ju,{className:"w-4 h-4 mr-1"}),"History"]})}),r.jsx(Dt,{children:"View completed loops"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>y(!0),children:[r.jsx(un,{className:"w-4 h-4 mr-1"}),"Config"]})}),r.jsx(Dt,{children:"Configure loop defaults"})]})}),r.jsxs(re,{onClick:()=>C(!0),children:[r.jsx(Tt,{className:"w-4 h-4 mr-1"}),"New Loop"]})]})]}),!Rn&&r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ts,{className:"w-5 h-5 text-yellow-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:"Hooks not installed"}),r.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"Install the Ralph Loop hooks to enable automatic loop continuation"})]})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:br,disabled:Wt,children:[Wt?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Install Hooks"]})]}),n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(et,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):Yo.length===0?r.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[r.jsx(hc,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"text-lg font-medium",children:x?"No loops in this workstream":"No loops yet"}),r.jsx("p",{className:"text-sm mt-1",children:"Create a loop to start autonomous development"})]}):r.jsx("div",{className:"space-y-3",children:Yo.map(se=>{var De,Rt,kr,ts,bt;return r.jsxs("div",{className:"border rounded-lg bg-card overflow-hidden",children:[r.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>u(c===se.id?null:se.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[c===se.id?r.jsx(vr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(xs,{className:"w-4 h-4 text-muted-foreground"}),ja[se.status]||ja.pending,r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium",children:se.name}),r.jsx("p",{className:"text-sm text-muted-foreground truncate max-w-md",children:((De=se.task)==null?void 0:De.original)||"No task"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[se.workstreamId&&r.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200 flex items-center gap-1",children:[r.jsx(Bn,{className:"w-3 h-3"}),Vc(se.workstreamId)]}),r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${g_[se.phase]||"bg-gray-100 dark:bg-gray-800"}`,children:se.phase}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[((Rt=se.iterations)==null?void 0:Rt.current)||0,"/",((kr=se.iterations)==null?void 0:kr.max)||50]}),r.jsxs("div",{className:"flex items-center gap-1",onClick:Dr=>Dr.stopPropagation(),children:[se.status==="pending"&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>io(se.id),children:r.jsx(aS,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Start loop"})]})}),se.status==="running"&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>fs(se.id),children:r.jsx(xp,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Pause loop"})]})}),se.status==="paused"&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>no(se),children:r.jsx(Yd,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Resume loop"})]})}),(se.status==="cancelled"||se.status==="failed")&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>no(se),children:r.jsx(Yd,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Restart loop"})]})}),se.phase==="plan"&&se.status==="running"&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>jt(se.id),children:r.jsx(It,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Approve plan"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>qe(se),children:r.jsx(Ju,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Edit loop"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>$t(se),children:r.jsx(Wa,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Duplicate loop"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>pr(se),children:r.jsx(Ag,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"View details"})]})}),(se.status==="running"||se.status==="paused")&&r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Q(se.id),children:r.jsx(Da,{className:"w-4 h-4"})})}),r.jsx(Dt,{children:"Cancel loop"})]})}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Ie(se.id),children:r.jsx(ys,{className:"w-4 h-4 text-red-500"})})}),r.jsx(Dt,{children:"Delete loop"})]})})]})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Iterations"}),r.jsxs("span",{children:[((ts=se.iterations)==null?void 0:ts.current)||0," / ",((bt=se.iterations)==null?void 0:bt.max)||50]})]}),r.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-blue-500 transition-all",style:{width:`${Xs(se)}%`}})})]})]}),c===se.id&&r.jsxs("div",{className:"border-t p-4 bg-muted/30 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"ID:"}),r.jsx("span",{className:"ml-2 font-mono",children:se.id}),r.jsx(re,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 ml-1",onClick:()=>es(se.id),children:r.jsx(Wa,{className:"w-3 h-3"})})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Status:"}),r.jsxs("span",{className:"ml-2",children:[se.status,se.pauseReason?` (${se.pauseReason})`:""]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Created:"}),r.jsx("span",{className:"ml-2",children:_s(se.createdAt)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Updated:"}),r.jsx("span",{className:"ml-2",children:_s(se.updatedAt)})]}),se.workstreamId&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Workstream:"}),r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1",children:[r.jsx(Bn,{className:"w-3 h-3 text-purple-500"}),Vc(se.workstreamId)]})]})]}),r.jsxs("div",{className:"bg-muted p-3 rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Kt,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Run this loop (uses official ralph-loop plugin):"})]}),r.jsx("code",{className:"text-xs bg-background p-2 rounded block whitespace-pre-wrap",children:Pt(se,!0)})]})]})]},se.id)})}),r.jsx(yt,{open:j,onOpenChange:C,children:r.jsxs(ht,{className:"sm:max-w-lg",children:[r.jsx(ft,{children:r.jsx(mt,{children:"Create New Loop"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium",children:"Task Description"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",onClick:Uo,disabled:G||!B.trim(),className:"h-7 text-xs",children:[G?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(cs,{className:"w-3 h-3 mr-1"}),"Tune with AI"]})}),r.jsx(Dt,{children:r.jsx("p",{className:"max-w-xs",children:"Use Claude to optimize your prompt for Ralph Loop execution - adds clear completion signals, verification steps, and acceptance criteria."})})]})})]}),r.jsx(_t,{placeholder:"Describe what you want Claude to accomplish...",value:B,onChange:se=>{z(se.target.value),Z(!1)},rows:4}),r.jsxs("div",{className:"flex items-center justify-between mt-1",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Be specific about the goal. The loop will continue until this task is completed."}),ne&&r.jsxs("span",{className:"text-xs text-green-600 dark:text-green-400 flex items-center gap-1",children:[r.jsx(Ht,{className:"w-3 h-3"}),"AI-tuned"]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Project"}),r.jsx("div",{className:"text-sm p-2 bg-muted rounded-md",children:e?r.jsx("span",{className:"font-mono",children:e.name||e.path||e.dir}):r.jsx("span",{className:"text-muted-foreground",children:"No project selected - loop will run in server directory"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:U,onChange:se=>X(se.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Safety limit for the loop"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Completion Promise"}),r.jsx(lt,{value:q,onChange:se=>O(se.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Text that signals completion"})]})]}),f.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Workstream (optional)"}),r.jsxs("select",{className:"w-full border rounded-md p-2 bg-background",value:Y,onChange:se=>H(se.target.value),children:[r.jsx("option",{value:"",children:"No workstream"}),f.map(se=>r.jsx("option",{value:se.id,children:se.name},se.id))]})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsxs(re,{onClick:_i,disabled:R||!B.trim(),children:[R?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Create Loop"]})]})]})}),r.jsx(yt,{open:N,onOpenChange:M,children:r.jsxs(ht,{className:"sm:max-w-lg",children:[r.jsx(ft,{children:r.jsx(mt,{children:"Edit Loop"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Name"}),r.jsx(lt,{placeholder:"Loop name",value:Be,onChange:se=>Ke(se.target.value)})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium",children:"Task Description"}),r.jsx(ir,{children:r.jsxs(Lt,{children:[r.jsx(Ot,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",onClick:async()=>{if(!Qe.trim()){K.error("Enter a task description first");return}try{F(!0),ae(Qe),be("edit");const se=await ue.tuneLoopPrompt(Qe,(I==null?void 0:I.projectPath)||(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null);se.success?(J(se.tunedPrompt),ce(!0)):K.error(se.error||"Failed to tune prompt")}catch(se){K.error(se.message)}finally{F(!1)}},disabled:G||!Qe.trim(),className:"h-7 text-xs",children:[G?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(cs,{className:"w-3 h-3 mr-1"}),"Tune with AI"]})}),r.jsx(Dt,{children:r.jsx("p",{className:"max-w-xs",children:"Use Claude to optimize your prompt for Ralph Loop execution."})})]})})]}),r.jsx(_t,{placeholder:"Describe what you want Claude to accomplish...",value:Qe,onChange:se=>je(se.target.value),rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:we,onChange:se=>ve(se.target.value),min:1,max:1e3})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Completion Promise"}),r.jsx(lt,{value:_e,onChange:se=>Oe(se.target.value),placeholder:"DONE"})]})]}),f.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Workstream"}),r.jsxs("select",{className:"w-full border rounded-md p-2 bg-background",value:de,onChange:se=>ye(se.target.value),children:[r.jsx("option",{value:"",children:"No workstream"}),f.map(se=>r.jsx("option",{value:se.id,children:se.name},se.id))]})]}),I&&r.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.jsxs("span",{children:["ID: ",I.id]}),r.jsx("span",{className:"mx-2",children:"|"}),r.jsxs("span",{children:["Status: ",I.status]}),r.jsx("span",{className:"mx-2",children:"|"}),r.jsxs("span",{children:["Phase: ",I.phase]})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),r.jsxs(re,{onClick:kt,disabled:R||!Qe.trim(),children:[R?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Save Changes"]})]})]})}),r.jsx(yt,{open:v,onOpenChange:y,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsx(mt,{children:"Loop Configuration"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:Re,onChange:se=>ze(se.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Loop will pause after this many iterations"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Default Completion Promise"}),r.jsx(lt,{value:at,onChange:se=>ur(se.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Default text that signals loop completion (used with official ralph-loop plugin)"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"checkbox",id:"autoApprovePlan",checked:Je,onChange:se=>Et(se.target.checked),className:"rounded"}),r.jsx("label",{htmlFor:"autoApprovePlan",className:"text-sm",children:"Auto-approve plans (skip manual plan approval)"})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsxs(re,{onClick:sr,disabled:R,children:[R?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Save"]})]})]})}),r.jsx(yt,{open:g,onOpenChange:b,children:r.jsxs(ht,{className:"sm:max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsx(mt,{children:"Loop History"})}),r.jsx("div",{className:"space-y-3 py-4",children:Rr.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No completed loops yet"}):Rr.slice().reverse().map(se=>r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[ja[se.status]||ja.completed,r.jsx("span",{className:"font-medium",children:se.name})]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:_s(se.completedAt)})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:se.task}),r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:r.jsxs("span",{children:["Iterations: ",se.totalIterations]})})]},se.id))})]})}),r.jsx(yt,{open:k,onOpenChange:E,children:r.jsxs(ht,{className:"sm:max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsx(mt,{children:(P==null?void 0:P.name)||"Loop Details"})}),P&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Phase"}),r.jsx("span",{className:`text-sm px-2 py-0.5 rounded-full ${g_[P.phase]||""}`,children:P.phase})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Status"}),r.jsxs("div",{className:"flex items-center gap-1",children:[ja[P.status],r.jsx("span",{children:P.status})]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Progress"}),r.jsxs("span",{children:[((Jo=P.iterations)==null?void 0:Jo.current)||0," / ",((ul=P.iterations)==null?void 0:ul.max)||50]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Task"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm",children:(hl=P.task)==null?void 0:hl.original})]}),P.clarifications&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Clarifications"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-40 overflow-y-auto",children:P.clarifications})]}),P.plan&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Plan"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-60 overflow-y-auto font-mono",children:P.plan})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Max Iterations"}),r.jsx("div",{className:"bg-muted p-2 rounded text-sm",children:((fl=P.iterations)==null?void 0:fl.max)||50})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Completion Promise"}),r.jsxs("div",{className:"bg-muted p-2 rounded text-sm font-mono",children:["<promise>",P.completionPromise||"DONE","</promise>"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Run Command (uses official ralph-loop plugin)"}),r.jsx("code",{className:"text-xs bg-muted p-3 rounded block whitespace-pre-wrap",children:Pt(P,!0)})]})]})]})}),r.jsx(yt,{open:Ls,onOpenChange:Os,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(xi,{className:"w-5 h-5"}),"Install ralph-loop Plugin"]})}),r.jsxs("div",{className:"py-4",children:[r.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["The ",r.jsx("code",{className:"bg-muted px-1 rounded",children:"ralph-loop"})," plugin is required to run loops. This plugin provides the ",r.jsx("code",{className:"bg-muted px-1 rounded",children:"/ralph-loop"})," command that enables autonomous iteration."]}),us.scope==="project"&&r.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded p-3 mb-4",children:r.jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:["Plugin is currently installed only for project: ",r.jsx("br",{}),r.jsx("code",{className:"text-xs",children:us.projectPath})]})}),r.jsx("p",{className:"text-sm",children:"Install the plugin globally (user scope) to use loops from any project?"})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:oo,disabled:ws,children:"Cancel"}),r.jsx(re,{onClick:Ko,disabled:ws,children:ws?r.jsxs(r.Fragment,{children:[r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}),"Installing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(xi,{className:"w-4 h-4 mr-1"}),"Install Plugin"]})})]})]})}),r.jsx(Lj,{open:Ut,onOpenChange:se=>{Vr(se),se||(hr(null),Sr())},title:ut?`Loop: ${ut.name}`:"Running Loop",description:ut?((lo=(Xo=ut.task)==null?void 0:Xo.original)==null?void 0:lo.substring(0,100))+(((gn=(pn=ut.task)==null?void 0:pn.original)==null?void 0:gn.length)>100?"...":""):"",cwd:ut==null?void 0:ut.projectPath,initialCommand:ut?Pt(ut).startCmd:"",delayedCommand:ut?Pt(ut).skillCmd:"",delayedCommandDelay:5e3,env:ut?{CODER_LOOP_ID:ut.id,...ut.workstreamId&&{CODER_WORKSTREAM:ut.workstreamId}}:{},onExit:Zn,headerExtra:r.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[r.jsx("input",{type:"checkbox",checked:hs,onChange:se=>Qr(se.target.checked),className:"rounded"}),"Auto-close when done"]})}),r.jsx(yt,{open:te,onOpenChange:ce,children:r.jsxs(ht,{className:"sm:max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(cs,{className:"w-5 h-5 text-purple-500"}),"AI-Tuned Prompt"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2 text-muted-foreground",children:"Original Prompt"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-32 overflow-y-auto",children:W})]}),r.jsxs("div",{children:[r.jsxs("h4",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(Ht,{className:"w-4 h-4 text-purple-500"}),"Tuned Prompt"]}),r.jsx(_t,{value:fe,onChange:se=>J(se.target.value),rows:10,className:"font-mono text-sm"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"You can edit the tuned prompt before accepting it."})]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:qo,children:"Keep Original"}),r.jsxs(re,{onClick:Go,children:[r.jsx(It,{className:"w-4 h-4 mr-1"}),"Use Tuned Prompt"]})]})]})}),r.jsx(yt,{open:le,onOpenChange:Ce,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[r.jsx(Yd,{className:"w-5 h-5"}),"Resume Loop"]})}),r.jsx("div",{className:"py-4",children:Le&&r.jsxs(r.Fragment,{children:[r.jsxs("p",{className:"text-sm mb-4",children:["This loop ",Le.status==="failed"?"failed":Le.status==="cancelled"?"was cancelled":"was paused",Le.pauseReason&&`: ${Le.pauseReason}`]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Would you like to tune the prompt with AI before resuming? This can help add guardrails based on what went wrong."}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm max-h-32 overflow-y-auto",children:(xn=Le.task)==null?void 0:xn.original})]})}),r.jsxs(St,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(re,{variant:"outline",onClick:()=>{Ce(!1),Ge(null)},children:"Cancel"}),r.jsx(re,{variant:"secondary",onClick:ll,children:"Resume As-Is"}),r.jsxs(re,{onClick:Xt,disabled:G,children:[G?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):r.jsx(cs,{className:"w-4 h-4 mr-1"}),"Tune & Resume"]})]})]})}),r.jsx(yt,{open:al,onOpenChange:Zr,children:r.jsxs(ht,{className:"sm:max-w-md",children:[r.jsx(ft,{children:r.jsxs(mt,{className:"flex items-center gap-2",children:[(Ze==null?void 0:Ze.status)==="completed"&&r.jsxs(r.Fragment,{children:[r.jsx(Mo,{className:"w-5 h-5 text-green-600"})," Loop Completed"]}),(Ze==null?void 0:Ze.status)==="paused"&&r.jsxs(r.Fragment,{children:[r.jsx(xp,{className:"w-5 h-5 text-yellow-500"})," Loop Paused"]}),(Ze==null?void 0:Ze.status)==="failed"&&r.jsxs(r.Fragment,{children:[r.jsx(Da,{className:"w-5 h-5 text-red-500"})," Loop Failed"]}),(Ze==null?void 0:Ze.status)==="cancelled"&&r.jsxs(r.Fragment,{children:[r.jsx(Da,{className:"w-5 h-5 text-gray-500"})," Loop Cancelled"]})]})}),Ze&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-1",children:"Task"}),r.jsx("p",{className:"text-sm text-muted-foreground bg-muted p-2 rounded",children:Ze.task})]}),Ze.pauseReason&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-1",children:"Reason"}),r.jsx("p",{className:"text-sm text-muted-foreground bg-muted p-2 rounded",children:Ze.pauseReason})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Status"}),r.jsxs("div",{className:"font-medium flex items-center gap-1",children:[ja[Ze.status],r.jsx("span",{className:"capitalize",children:Ze.status})]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Iterations"}),r.jsxs("div",{className:"font-medium",children:[Ze.iterations," / ",Ze.maxIterations]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Duration"}),r.jsx("div",{className:"font-medium",children:Ze.duration!=null?Ze.duration<60?`${Ze.duration}s`:Ze.duration<3600?`${Math.floor(Ze.duration/60)}m ${Ze.duration%60}s`:`${Math.floor(Ze.duration/3600)}h ${Math.floor(Ze.duration%3600/60)}m`:"-"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[Ze.status==="completed"?"Completed":"Stopped"," at ",_s(Ze.completedAt)]})]}),r.jsxs(St,{children:[r.jsx(re,{variant:"outline",onClick:()=>Zr(!1),children:"Close"}),((Ze==null?void 0:Ze.status)==="paused"||(Ze==null?void 0:Ze.status)==="failed"||(Ze==null?void 0:Ze.status)==="cancelled")&&r.jsxs(re,{onClick:()=>{if(Zr(!1),Ze!=null&&Ze.id){const se=t.find(De=>De.id===Ze.id);se&&no(se)}},children:[r.jsx(Yd,{className:"w-4 h-4 mr-1"}),(Ze==null?void 0:Ze.status)==="paused"?"Resume":"Restart"]}),r.jsx(re,{variant:"secondary",onClick:()=>{if(Zr(!1),Ze!=null&&Ze.id){const se=t.find(De=>De.id===Ze.id);se&&pr(se)}},children:"View Details"})]})]})})]})}function gW(e,t=[]){let s=[];function n(c,u){const l=_.createContext(u);l.displayName=c+"Context";const d=s.length;s=[...s,u];const f=h=>{var y;const{scope:x,children:w,...j}=h,C=((y=x==null?void 0:x[e])==null?void 0:y[d])||l,v=_.useMemo(()=>j,Object.values(j));return r.jsx(C.Provider,{value:v,children:w})};f.displayName=c+"Provider";function m(h,x){var C;const w=((C=x==null?void 0:x[e])==null?void 0:C[d])||l,j=_.useContext(w);if(j)return j;if(u!==void 0)return u;throw new Error(`\`${h}\` must be used within \`${c}\``)}return[f,m]}const o=()=>{const c=s.map(u=>_.createContext(u));return function(l){const d=(l==null?void 0:l[e])||c;return _.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return o.scopeName=e,[n,xW(o,...t)]}function xW(...e){const t=e[0];if(e.length===1)return t;const s=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(c){const u=n.reduce((l,{useScope:d,scopeName:f})=>{const h=d(c)[`__scope${f}`];return{...l,...h}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return s.scopeName=t.scopeName,s}var vW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],v2=vW.reduce((e,t)=>{const s=Xu(`Primitive.${t}`),n=_.forwardRef((o,c)=>{const{asChild:u,...l}=o,d=u?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...l,ref:c})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Wx="Progress",Vx=100,[yW]=gW(Wx),[bW,wW]=yW(Wx),y2=_.forwardRef((e,t)=>{const{__scopeProgress:s,value:n=null,max:o,getValueLabel:c=_W,...u}=e;(o||o===0)&&!x_(o)&&console.error(CW(`${o}`,"Progress"));const l=x_(o)?o:Vx;n!==null&&!v_(n,l)&&console.error(SW(`${n}`,"Progress"));const d=v_(n,l)?n:null,f=zu(d)?c(d,l):void 0;return r.jsx(bW,{scope:s,value:d,max:l,children:r.jsx(v2.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":zu(d)?d:void 0,"aria-valuetext":f,role:"progressbar","data-state":_2(d,l),"data-value":d??void 0,"data-max":l,...u,ref:t})})});y2.displayName=Wx;var b2="ProgressIndicator",w2=_.forwardRef((e,t)=>{const{__scopeProgress:s,...n}=e,o=wW(b2,s);return r.jsx(v2.div,{"data-state":_2(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...n,ref:t})});w2.displayName=b2;function _W(e,t){return`${Math.round(e/t*100)}%`}function _2(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function zu(e){return typeof e=="number"}function x_(e){return zu(e)&&!isNaN(e)&&e>0}function v_(e,t){return zu(e)&&!isNaN(e)&&e<=t&&e>=0}function CW(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Vx}\`.`}function SW(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
3013
3013
  - a positive number
3014
3014
  - less than the value passed to \`max\` (or ${Vx} if no \`max\` prop is set)
3015
3015
  - \`null\` or \`undefined\` if the progress is indeterminate.
@@ -3760,4 +3760,4 @@ Everything you can do in the UI, you can do from the command line. Some power us
3760
3760
  Thanks for using Coder Config. The goal is to make AI coding assistants work the way you want them to, without the friction of scattered configuration files and forgotten context. Hopefully this tool helps.
3761
3761
 
3762
3762
  Happy coding.
3763
- `}},OW={...jW,...NW,...EW,...PW,...AW,...TW,...RW,...MW,...DW,...IW,...LW},lu={welcome:{bg:"bg-violet-500",light:"bg-violet-100 dark:bg-violet-950",text:"text-violet-600 dark:text-violet-400"},"first-project":{bg:"bg-blue-500",light:"bg-blue-100 dark:bg-blue-950",text:"text-blue-600 dark:text-blue-400"},"rules-guide":{bg:"bg-emerald-500",light:"bg-emerald-100 dark:bg-emerald-950",text:"text-emerald-600 dark:text-emerald-400"},"mcp-guide":{bg:"bg-orange-500",light:"bg-orange-100 dark:bg-orange-950",text:"text-orange-600 dark:text-orange-400"},"permissions-guide":{bg:"bg-green-500",light:"bg-green-100 dark:bg-green-950",text:"text-green-600 dark:text-green-400"},"memory-guide":{bg:"bg-pink-500",light:"bg-pink-100 dark:bg-pink-950",text:"text-pink-600 dark:text-pink-400"},"plugins-guide":{bg:"bg-purple-500",light:"bg-purple-100 dark:bg-purple-950",text:"text-purple-600 dark:text-purple-400"},"workstreams-guide":{bg:"bg-cyan-500",light:"bg-cyan-100 dark:bg-cyan-950",text:"text-cyan-600 dark:text-cyan-400"},"loops-guide":{bg:"bg-teal-500",light:"bg-teal-100 dark:bg-teal-950",text:"text-teal-600 dark:text-teal-400"},"multi-tool-guide":{bg:"bg-amber-500",light:"bg-amber-100 dark:bg-amber-950",text:"text-amber-600 dark:text-amber-400"},"next-steps":{bg:"bg-rose-500",light:"bg-rose-100 dark:bg-rose-950",text:"text-rose-600 dark:text-rose-400"}},y_="claude-config-tutorial-visited";function FW(){const[e,t]=_.useState("intro"),[s,n]=_.useState({welcome:!0}),[o,c]=_.useState(()=>{try{return JSON.parse(localStorage.getItem(y_)||"[]")}catch{return[]}}),u=_.useRef(null);_.useEffect(()=>{if(u.current){const b=u.current.querySelector("[data-radix-scroll-area-viewport]");b&&(b.scrollTop=0)}},[e]),_.useEffect(()=>{if(e&&!o.includes(e)){const b=[...o,e];c(b),localStorage.setItem(y_,JSON.stringify(b))}},[e,o]);const l=b=>{n(k=>({...k,[b]:!k[b]}))},d=OW[e],f=ql.flatMap(b=>b.subsections.length>0?b.subsections.map(k=>k.id):[b.id]),m=f.indexOf(e),h=m>0?f[m-1]:null,x=m<f.length-1?f[m+1]:null,w=Math.round(o.length/f.length*100),C=(()=>{for(const b of ql)if(b.id===e||b.subsections.some(k=>k.id===e))return b;return ql[0]})(),v=lu[C.id]||lu.welcome,y=b=>{for(const k of ql){if(k.id===b)return k.title;const E=k.subsections.find(P=>P.id===b);if(E)return E.title}return""},g=b=>({__html:x2(b)});return r.jsxs("div",{className:"flex h-full",children:[r.jsxs("div",{className:"w-72 border-r border-border bg-muted/30 flex flex-col",children:[r.jsxs("div",{className:"p-4 border-b border-border bg-gradient-to-r from-indigo-500/10 to-purple-500/10",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg",children:r.jsx(ku,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-foreground",children:"Tutorial"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Step-by-step guide"})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Progress"}),r.jsxs("span",{children:[w,"% complete"]})]}),r.jsx(S2,{value:w,className:"h-2"})]})]}),r.jsx(Ys,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:ql.map((b,k)=>{const E=b.icon,P=lu[b.id]||lu.welcome,A=e===b.id||b.subsections.some(M=>M.id===e),N=b.subsections.length>0?b.subsections.every(M=>o.includes(M.id)):o.includes(b.id);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{className:Ee("w-full flex items-center gap-2 px-3 py-2.5 text-sm rounded-lg hover:bg-accent text-left transition-all",A&&"bg-accent"),onClick:()=>{b.subsections.length>0?(l(b.id),s[b.id]||t(b.subsections[0].id)):t(b.id)},children:[r.jsx("span",{className:Ee("w-7 h-7 rounded-lg flex items-center justify-center transition-colors",A?P.bg+" text-white":P.light),children:N?r.jsx(Mo,{className:"w-4 h-4"}):r.jsx(E,{className:Ee("w-4 h-4",!A&&P.text)})}),r.jsx("span",{className:Ee("flex-1",A&&"font-medium"),children:b.title}),b.subsections.length>0&&r.jsx(xs,{className:Ee("w-4 h-4 text-muted-foreground transition-transform",s[b.id]&&"rotate-90")})]}),b.subsections.length>0&&s[b.id]&&r.jsx("div",{className:"ml-4 mt-1 space-y-0.5 border-l-2 border-border pl-3",children:b.subsections.map(M=>{const I=e===M.id,L=o.includes(M.id);return r.jsxs("button",{className:Ee("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground flex items-center gap-2",I&&"bg-accent font-medium",I&&P.text),onClick:()=>t(M.id),children:[L&&!I&&r.jsx(Mo,{className:"w-3 h-3 text-green-500"}),r.jsx("span",{className:Ee(!L&&!I&&"ml-5"),children:M.title})]},M.id)})})]},b.id)})})})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[r.jsx("div",{className:Ee("px-8 py-4 border-b border-border",v.light),children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center gap-3",children:[r.jsx("div",{className:Ee("w-10 h-10 rounded-xl flex items-center justify-center",v.bg,"text-white"),children:r.jsx(C.icon,{className:"w-5 h-5"})}),r.jsxs("div",{children:[r.jsx("p",{className:Ee("text-sm font-medium",v.text),children:C.title}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:(d==null?void 0:d.title)||y(e)})]})]})}),r.jsx(Ys,{className:"flex-1",ref:u,children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:d?r.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert prose-headings:text-foreground prose-p:text-muted-foreground prose-strong:text-foreground prose-code:text-primary prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-pre:bg-muted prose-pre:border prose-pre:border-border",dangerouslySetInnerHTML:g(d.content)}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(ku,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a topic from the sidebar"})]})})}),r.jsx("div",{className:"border-t border-border p-4 bg-muted/30",children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center justify-between",children:[h?r.jsxs(re,{variant:"ghost",onClick:()=>t(h),className:"flex items-center gap-2",children:[r.jsx(S5,{className:"w-4 h-4"}),r.jsx("span",{className:"max-w-[150px] truncate",children:y(h)})]}):r.jsx("div",{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[m+1," of ",f.length]}),x?r.jsxs(re,{onClick:()=>t(x),className:Ee("flex items-center gap-2",v.bg,"hover:opacity-90"),children:[r.jsx("span",{className:"max-w-[150px] truncate",children:y(x)}),r.jsx(Pg,{className:"w-4 h-4"})]}):r.jsx(re,{variant:"outline",onClick:()=>t("intro"),className:"flex items-center gap-2",children:"Start Over"})]})})]})]})}function BW(){const[e,t]=_.useState(null),[s,n]=_.useState(!0),[o,c]=_.useState(!1),[u,l]=_.useState(!1),[d,f]=_.useState(!1),[m,h]=_.useState(null);_.useEffect(()=>{x()},[]);const x=async()=>{try{n(!0);const k=await ue.getSessionStatus();t(k)}catch{K.error("Failed to load session status")}finally{n(!1)}},w=async()=>{var k,E;c(!0);try{const P=await ue.installSessionAll();P.success?(K.success("Session persistence installed!"),x()):K.error(((k=P.hooks)==null?void 0:k.error)||((E=P.command)==null?void 0:E.error)||"Installation failed")}catch{K.error("Installation failed")}finally{c(!1)}},j=async()=>{c(!0);try{const k=await ue.installSessionHooks();k.success?(K.success("Session hooks installed!"),x()):K.error(k.error||"Failed to install hooks")}catch{K.error("Failed to install hooks")}finally{c(!1)}},C=async()=>{c(!0);try{const k=await ue.installFlushCommand();k.success?(K.success(k.alreadyInstalled?"/flush command already installed":"/flush command installed!"),x()):K.error(k.error||"Failed to install command")}catch{K.error("Failed to install command")}finally{c(!1)}},v=async()=>{l(!0);try{const k=await ue.clearSessionContext();k.success?(K.success(k.cleared?"Session context cleared":"No context to clear"),x()):K.error("Failed to clear context")}catch{K.error("Failed to clear context")}finally{l(!1)}},y=async()=>{try{const k=await ue.getSessionContext();h(k.content),f(!0)}catch{K.error("Failed to load context")}},g=k=>k===null?"Unknown":k<60?`${k} minutes ago`:k<1440?`${Math.floor(k/60)} hours ago`:`${Math.floor(k/1440)} days ago`;if(s)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})});const b=(e==null?void 0:e.hooksInstalled)&&(e==null?void 0:e.flushCommandInstalled)&&(e==null?void 0:e.permissionInstalled);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-5 shadow-sm",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-lg bg-indigo-100 dark:bg-indigo-950",children:r.jsx(Ms,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Session Persistence"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Save and restore Claude Code session context"})]})]}),r.jsx(re,{variant:"ghost",size:"sm",onClick:x,children:r.jsx(Tr,{className:"w-4 h-4"})})]}),r.jsxs("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:["Session persistence allows you to save your current Claude Code context using the ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1.5 py-0.5 rounded text-indigo-600 dark:text-indigo-400",children:"/flush"})," command, and automatically restore it when you start a new session."]})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Installation Status"})}),r.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:[r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.hooksInstalled?r.jsx(It,{className:"w-5 h-5 text-green-500"}):r.jsx(Ts,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Session Hooks"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Auto-restore context on session start, preserve on session end"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tt,{variant:e!=null&&e.hooksInstalled?"default":"secondary",children:e!=null&&e.hooksInstalled?"Installed":"Not Installed"}),!(e!=null&&e.hooksInstalled)&&r.jsx(re,{variant:"outline",size:"sm",onClick:j,disabled:o,children:o?r.jsx(et,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.flushCommandInstalled?r.jsx(It,{className:"w-5 h-5 text-green-500"}):r.jsx(Ts,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"/flush Command"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Adds the /flush command to save session context"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tt,{variant:e!=null&&e.flushCommandInstalled?"default":"secondary",children:e!=null&&e.flushCommandInstalled?"Installed":"Not Installed"}),!(e!=null&&e.flushCommandInstalled)&&r.jsx(re,{variant:"outline",size:"sm",onClick:C,disabled:o,children:o?r.jsx(et,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.permissionInstalled?r.jsx(It,{className:"w-5 h-5 text-green-500"}):r.jsx(Ts,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Write Permission"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Allows Claude to write session context without prompting"})]})]}),r.jsx(tt,{variant:e!=null&&e.permissionInstalled?"default":"secondary",children:e!=null&&e.permissionInstalled?"Granted":"Not Granted"})]})]}),!b&&r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-slate-900 border-t border-gray-200 dark:border-slate-800",children:r.jsxs(re,{onClick:w,disabled:o,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white",children:[o?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(xi,{className:"w-4 h-4 mr-2"}),"Install All"]})})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700 flex items-center justify-between",children:[r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Saved Context"}),(e==null?void 0:e.hasSavedContext)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(re,{variant:"outline",size:"sm",onClick:y,children:[r.jsx(zr,{className:"w-4 h-4 mr-2"}),"View"]}),r.jsx(re,{variant:"outline",size:"sm",onClick:v,disabled:u,className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950",children:u?r.jsx(et,{className:"w-4 h-4 animate-spin"}):r.jsx(ys,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"p-4",children:e!=null&&e.hasSavedContext?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(sc,{className:"w-4 h-4 text-gray-400"}),r.jsx("span",{className:"text-gray-600 dark:text-slate-400",children:"Last saved:"}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:g(e.contextAge)})]}),e.contextPreview&&r.jsx("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:r.jsx("pre",{className:"text-xs text-gray-600 dark:text-slate-400 whitespace-pre-wrap overflow-hidden",children:e.contextPreview})}),r.jsxs("div",{className:"text-xs text-gray-500 dark:text-slate-500",children:["Storage: ",e.sessionDir]})]}):r.jsxs("div",{className:"text-center py-6",children:[r.jsx(Ms,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:"No saved context"}),r.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-1",children:["Use ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded",children:"/flush"})," in Claude Code to save your session"]})]})})]}),(e==null?void 0:e.lastSession)&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Last Session"})}),r.jsxs("div",{className:"p-4 space-y-2",children:[e.lastSession.session_id&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"ID:"}),r.jsx("code",{className:"text-xs bg-gray-100 dark:bg-slate-800 px-2 py-0.5 rounded",children:e.lastSession.session_id})]}),e.lastSession.cwd&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Directory:"}),r.jsx("span",{className:"text-gray-900 dark:text-white font-mono text-xs",children:e.lastSession.cwd})]}),e.lastSession.timestamp&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Ended:"}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:e.lastSession.timestamp})]}),e.lastSession.reason&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Reason:"}),r.jsx(tt,{variant:"secondary",children:e.lastSession.reason})]})]})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"How to Use"}),r.jsxs("ol",{className:"space-y-2 text-sm text-gray-600 dark:text-slate-400",children:[r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"1."}),"Install session hooks and the /flush command above"]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"2."}),"Use ",r.jsx("code",{className:"bg-white dark:bg-slate-800 px-1.5 py-0.5 rounded",children:"/flush"})," in Claude Code before ending a session"]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"3."}),"Your context is automatically restored when you start a new session"]})]})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config session # Show session status"}),r.jsx("p",{children:"coder-config session install-hooks # Install session hooks"}),r.jsx("p",{children:"coder-config session clear # Clear saved context"})]})]}),r.jsx(yt,{open:d,onOpenChange:f,children:r.jsxs(ht,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(ft,{children:[r.jsx(mt,{children:"Saved Context"}),r.jsx(tr,{children:"This context will be restored on your next Claude Code session"})]}),r.jsx("div",{className:"flex-1 overflow-auto py-4",children:r.jsx("pre",{className:"text-sm text-gray-700 dark:text-slate-300 whitespace-pre-wrap bg-gray-50 dark:bg-slate-900 p-4 rounded-lg",children:m||"No content"})}),r.jsx(St,{children:r.jsx(re,{variant:"ghost",onClick:()=>f(!1),children:"Close"})})]})})]})}const $W=[{id:"projects",label:"All Projects",icon:Bn,section:"Projects"},{id:"explorer",label:"Project Explorer",icon:Ki,section:"Projects"},{id:"workstreams",label:"Workstreams",icon:lS,section:"Projects"},{id:"registry",label:"MCP Registry",icon:Gn,section:"Tools"},{id:"plugins",label:"Plugins",icon:Do,section:"Tools"},{id:"memory",label:"Memory",icon:Ro,section:"Tools"},{id:"claude-settings",label:"Claude Code",icon:Jn,section:"Configuration",tool:"claude"},{id:"gemini-settings",label:"Gemini CLI",icon:Kt,section:"Configuration",tool:"gemini"},{id:"codex-settings",label:"Codex CLI",icon:Kt,section:"Configuration",isNew:!0,tool:"codex"},{id:"antigravity-settings",label:"Antigravity",icon:Nc,section:"Configuration",tool:"antigravity"},{id:"create-mcp",label:"Create MCP",icon:cs,section:"Developer"},{id:"loops",label:"Ralph Loops",icon:hc,section:"Developer",isNew:!0},{id:"sessions",label:"Sessions",icon:Ms,section:"System"},{id:"preferences",label:"Preferences",icon:cS,section:"System"},{id:"tutorial",label:"Tutorial",icon:ku,section:"Help"},{id:"docs",label:"Docs & Help",icon:To,section:"Help"}],b_=(e,t)=>{try{const s=localStorage.getItem(`claude-config-${e}`);return s?JSON.parse(s):t}catch{return t}},zW=(e,t)=>{try{localStorage.setItem(`claude-config-${e}`,JSON.stringify(t))}catch{}};function HW(){const{projects:e,activeProject:t,fetch:s,setActive:n}=Ex(),{appConfig:o,version:c,fetch:u,checkVersion:l}=Nw(),[d,f]=_.useState(()=>b_("currentView","explorer")),[m,h]=_.useState(!0),[x,w]=_.useState({dir:"",subprojects:[],hierarchy:[]}),[j,C]=_.useState([]),[v,y]=_.useState({mcpServers:{}}),[g,b]=_.useState([]),[k,E]=_.useState([]),[P,A]=_.useState(null),[N,M]=_.useState(null),[I,L]=_.useState(!1),[B,z]=_.useState({title:"",type:""}),[Y,H]=_.useState(""),[U,X]=_.useState(""),q=_.useRef({}),[O,R]=_.useState(null),[$,G]=_.useState(!1),[F,te]=_.useState(!1),[ce,fe]=_.useState(null),[J,W]=_.useState(!1),ae=_.useRef(null);_.useEffect(()=>{zW("currentView",d)},[d]);const ne=_.useCallback(async()=>{try{const[ve,_e,Oe,de,ye]=await Promise.all([ue.getProject(),ue.getConfigs(),ue.getRegistry(),ue.getRules(),ue.getCommands()]);w(ve),C(_e),y(Oe),b(de),E(ye),_e.length>0&&!P&&A(_e[_e.length-1])}catch(ve){K.error("Failed to load data: "+ve.message)}finally{h(!1)}},[P]),Z=_.useCallback(async(ve=!1)=>{try{const _e=await s(),Oe=_e==null?void 0:_e.find(de=>de.isActive);if(ve&&Oe){const de=await ue.getSubprojects(Oe.path);fe({dir:Oe.path,subprojects:de.subprojects||[]})}ve&&!Oe&&(b_("currentView",null)||f("projects"))}catch{console.log("Projects API not available")}},[s]),le=async ve=>{try{const _e=await n(ve);_e.success?(w({dir:_e.dir,hierarchy:_e.hierarchy,subprojects:_e.subprojects}),fe({dir:_e.dir,subprojects:_e.subprojects}),await ne(),K.success(`Switched to ${_e.project.name}`)):K.error(_e.error||"Failed to switch project")}catch(_e){K.error("Failed to switch project: "+_e.message)}},Ce=()=>{s()};_.useEffect(()=>{ne(),Z(!0),(async()=>{try{const[_e]=await Promise.all([l(),u()]);!ae.current&&(_e!=null&&_e.installedVersion)&&(ae.current=_e.installedVersion);const Oe=Nw.getState().appConfig;if(_e!=null&&_e.updateAvailable&&(_e==null?void 0:_e.updateMethod)==="npm")if(Oe!=null&&Oe.autoUpdate){K.info(`Auto-updating to v${_e.latestVersion}...`),G(!0);const de=await ue.performUpdate({updateMethod:_e.updateMethod,targetVersion:_e.latestVersion});if(de.success){K.success(`Updated to v${de.newVersion}! Restarting server...`);try{await ue.restartServer()}catch{}let ye=0;const De=setInterval(async()=>{ye++;try{await ue.checkVersion(),clearInterval(De),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{ye>30&&(clearInterval(De),K.info("Server restarting. Please refresh the page."),G(!1))}},500)}else K.error("Auto-update failed: "+de.error),G(!1),R(_e)}else R(_e)}catch{}})()},[]),_.useEffect(()=>{const _e=setInterval(async()=>{if(ae.current)try{const Oe=await ue.checkVersion();Oe!=null&&Oe.installedVersion&&Oe.installedVersion!==ae.current&&(console.log(`[stale-ui] Server updated to v${Oe.installedVersion}, refreshing...`),window.location.reload())}catch{}},3e4);return()=>clearInterval(_e)},[]);const Le=(ve,_e)=>{if(!ve||!_e)return!1;const Oe=De=>De.split(".").map(ze=>parseInt(ze,10)||0),de=Oe(ve),ye=Oe(_e);for(let De=0;De<Math.max(de.length,ye.length);De++){if((de[De]||0)>(ye[De]||0))return!0;if((de[De]||0)<(ye[De]||0))return!1}return!1},Ge=async(ve,_e="npm")=>{G(!0);const Oe=await ue.performUpdate({updateMethod:_e,targetVersion:ve});if(Oe.success){K.success(`Updated to v${Oe.newVersion}! Restarting server...`),R(null);try{await ue.restartServer()}catch{}let de=0;const ye=setInterval(async()=>{de++;try{await ue.checkVersion(),clearInterval(ye),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{de>30&&(clearInterval(ye),K.info("Server restarting. Please refresh the page."),G(!1))}},500);return!0}else return K.error("Update failed: "+Oe.error),G(!1),!1},me=async()=>{W(!0);try{const ve=await ue.checkVersion(),_e=ve==null?void 0:ve.installedVersion,Oe=ve==null?void 0:ve.latestVersion;if(_e&&ae.current&&_e!==ae.current){K.info(`Refreshing to v${_e}...`),setTimeout(()=>window.location.reload(),500);return}Le(Oe,_e)&&(o!=null&&o.autoUpdate?(W(!1),K.info(`Auto-updating to v${Oe}...`),await Ge(Oe,(ve==null?void 0:ve.updateMethod)||"npm")):(R({...ve,updateAvailable:!0}),K.info(`Update available: v${Oe}`)))}catch{K.error("Failed to check for updates")}finally{W(!1)}},be=async()=>{if(O!=null&&O.updateAvailable){G(!0);try{const ve=await ue.performUpdate({updateMethod:O.updateMethod,sourcePath:O.sourcePath,targetVersion:O.latestVersion});if(ve.success){K.success(`Updated to v${ve.newVersion}! Restarting server...`),R(null),setVersion(ve.newVersion);try{await ue.restartServer()}catch{}let _e=0;const Oe=setInterval(async()=>{_e++;try{await ue.checkVersion(),clearInterval(Oe),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{_e>30&&(clearInterval(Oe),K.info("Server restarting. Please refresh the page."),G(!1))}},500)}else K.error("Update failed: "+ve.error),G(!1)}catch(ve){K.error("Update failed: "+ve.message),G(!1)}}};_.useEffect(()=>{const ve=async()=>{try{const{hashes:Oe}=await ue.getFileHashes(),de=q.current,ye=Object.keys(Oe).some(ze=>de[ze]!==Oe[ze])||Object.keys(de).some(ze=>!Oe[ze]),De=de.__subprojects__!==Oe.__subprojects__;if(ye&&Object.keys(de).length>0&&(await ne(),De&&ce))try{const ze=await ue.getSubprojects(ce.dir);fe(Je=>({...Je,subprojects:ze.subprojects||[]}))}catch{}q.current=Oe}catch{}},_e=setInterval(ve,2e3);return ve(),()=>clearInterval(_e)},[ne,ce]);const Be=new Set;j.forEach(ve=>{var _e,Oe;(((_e=ve.config)==null?void 0:_e.include)||[]).forEach(de=>Be.add(de)),Object.keys(((Oe=ve.config)==null?void 0:Oe.mcpServers)||{}).forEach(de=>Be.add(de))});const Ke={mcps:Be.size,rules:g.length,commands:k.length},Qe=async()=>{try{const ve=await ue.applyConfig(x.dir);if(ve.tools){const _e=Object.entries(ve.tools).filter(([,Oe])=>Oe).map(([Oe])=>Oe==="claude"?"Claude Code":"Antigravity");_e.length>0?K.success(`Config applied to: ${_e.join(", ")}`):K.warning("No tools were updated")}else K.success("Configuration applied successfully!")}catch(ve){K.error("Failed to apply config: "+ve.message)}},je=async()=>{h(!0),await ne(),K.success("Data refreshed")};if(m)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(et,{className:"w-8 h-8 animate-spin text-primary"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading configuration..."})]})});const we=()=>{switch(d){case"explorer":return r.jsx(b8,{project:x,onRefresh:ne});case"registry":return r.jsx(BH,{registry:v,searchQuery:Y,setSearchQuery:H,onUpdate:ne});case"plugins":return r.jsx(fW,{});case"memory":return r.jsx($H,{project:x,onUpdate:ne});case"create-mcp":return r.jsx(gH,{project:x});case"claude-settings":return r.jsx(tH,{});case"gemini-settings":return r.jsx(rH,{});case"codex-settings":return r.jsx(mH,{});case"antigravity-settings":return r.jsx(aH,{});case"sessions":return r.jsx(BW,{});case"preferences":return r.jsx(eH,{onConfigChange:()=>u()});case"projects":return r.jsx(UH,{onProjectSwitch:ve=>{w({dir:ve.dir,hierarchy:ve.hierarchy,subprojects:ve.subprojects}),fe({dir:ve.dir,subprojects:ve.subprojects}),ne(),Z()}});case"workstreams":return r.jsx(mW,{onWorkstreamChange:ve=>{K.success(`Switched to workstream: ${ve.name}`)}});case"loops":return r.jsx(pW,{activeProject:t});case"docs":return r.jsx(uW,{});case"tutorial":return r.jsx(FW,{});default:return null}};return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"h-16 bg-card border-b border-border sticky top-0 z-50 shadow-sm",children:r.jsxs("div",{className:"h-full px-6 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg shadow-indigo-500/20",children:r.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 128 128",children:[r.jsx("circle",{cx:"64",cy:"64",r:"52",fill:"none",stroke:"white",strokeWidth:"10",strokeDasharray:"24 12"}),r.jsx("circle",{cx:"64",cy:"64",r:"28",fill:"white"}),r.jsx("circle",{cx:"64",cy:"64",r:"12",fill:"#7c3aed"})]})}),r.jsx("div",{children:r.jsxs("h1",{className:"text-xl font-bold text-foreground",children:["Coder ",r.jsx("span",{className:"text-primary",children:"Config"})]})}),O&&r.jsxs("button",{onClick:be,disabled:$,className:"ml-3 px-2.5 py-1 text-xs font-medium bg-green-100 text-green-700 hover:bg-green-200 rounded-full flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[$?r.jsx(et,{className:"w-3 h-3 animate-spin"}):r.jsx(xi,{className:"w-3 h-3"}),$?"Updating...":`Update to v${O.latestVersion}`]})]}),r.jsx(xN,{orientation:"vertical",className:"h-6"}),r.jsx(w8,{projects:e,activeProject:t,onSwitch:le,onAddClick:()=>te(!0),onManageClick:()=>f("projects")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(k8,{}),r.jsx(re,{variant:"ghost",size:"sm",onClick:je,children:r.jsx(Tr,{className:"w-4 h-4"})}),r.jsxs(re,{onClick:Qe,variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",title:"Config auto-applies on save. Click to manually re-apply.",children:[r.jsx(Nc,{className:"w-4 h-4"}),"Re-apply"]})]})]})}),r.jsxs("div",{className:"flex",children:[r.jsxs("aside",{className:"w-64 h-[calc(100vh-64px)] border-r border-border bg-card sticky top-16 flex flex-col",children:[r.jsx(Ys,{className:"flex-1 py-4",children:["Projects","Tools","Configuration","Developer","System","Help"].map(ve=>r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"px-4 mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:ve}),r.jsx("div",{className:"space-y-0.5",children:$W.filter(_e=>_e.section===ve).filter(_e=>{var Oe;return _e.id!=="loops"||((Oe=o==null?void 0:o.experimental)==null?void 0:Oe.ralphLoops)}).filter(_e=>!_e.tool||((o==null?void 0:o.enabledTools)||["claude"]).includes(_e.tool)).map(_e=>{const Oe=_e.icon,de=d===_e.id;return r.jsxs("button",{onClick:()=>f(_e.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-all duration-200 border-l-2 ${de?"bg-accent border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:[r.jsx(Oe,{className:"w-4 h-4"}),r.jsx("span",{className:"flex-1 text-left",children:_e.label}),_e.badge&&r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${de?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:Ke[_e.badge]}),_e.isNew&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-green-500/20 text-green-600 dark:text-green-400",children:"new"})]},_e.id)})})]},ve))}),r.jsx("div",{className:"px-4 py-3 border-t border-border",children:r.jsxs("button",{onClick:me,disabled:J,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",title:"Check for updates",children:[J?r.jsx(et,{className:"w-3 h-3 animate-spin"}):null,c?`v${c}`:""]})})]}),r.jsx("main",{style:["explorer","docs","tutorial"].includes(d)?{}:{zoom:.9},className:Ee("flex-1 overflow-auto",["explorer","docs","tutorial"].includes(d)?"h-[calc(100vh-64px)]":"p-6"),children:r.jsx(k_,{mode:"wait",children:r.jsx(Ra.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:["explorer","docs","tutorial"].includes(d)?"h-full":"",children:we()},d)})})]}),r.jsx(fN,{open:F,onOpenChange:te,onAdded:Ce}),r.jsx(_8,{onStartTutorial:()=>f("tutorial")})]})}function WW(){const[e,t]=_.useState(!1),[s,n]=_.useState(!1),[o,c]=_.useState(!1),u=_.useCallback(async()=>{n(!0);try{await ue.restartServer(),K.info("Server restarting... page will reload."),setTimeout(()=>{window.location.reload()},2e3)}catch(d){K.error("Failed to restart: "+d.message),n(!1)}},[]),l=_.useCallback(()=>{c(!0),t(!1),K.dismiss("update-available")},[]);return _.useEffect(()=>{let d;const f=async()=>{try{const m=await ue.getVersion();console.log("[Update Check]",m),m.needsRestart&&!o&&t(!0)}catch{}};return f(),d=setInterval(f,3e4),()=>clearInterval(d)},[o]),r.jsx(C8,{children:r.jsxs("div",{className:"min-h-screen bg-background",children:[e&&!s&&r.jsxs("div",{className:"fixed top-0 left-0 right-0 z-50 bg-blue-600 text-white px-4 py-2 flex items-center justify-center gap-2 shadow-lg cursor-pointer hover:bg-blue-700 transition-colors",onClick:u,children:[r.jsx(Tr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Update available — click to restart"}),r.jsx("button",{onClick:d=>{d.stopPropagation(),l()},className:"absolute right-3 p-1 hover:bg-blue-500 rounded",children:r.jsx(hi,{className:"w-4 h-4"})})]}),s&&r.jsxs("div",{className:"fixed top-0 left-0 right-0 z-50 bg-amber-600 text-white px-4 py-2 flex items-center justify-center gap-2",children:[r.jsx(Tr,{className:"w-4 h-4 animate-spin"}),r.jsx("span",{className:"text-sm font-medium",children:"Restarting server..."})]}),r.jsx(HW,{}),r.jsx(DP,{position:"bottom-right",richColors:!0})]})})}aP.createRoot(document.getElementById("root")).render(r.jsx(WW,{}));
3763
+ `}},OW={...jW,...NW,...EW,...PW,...AW,...TW,...RW,...MW,...DW,...IW,...LW},lu={welcome:{bg:"bg-violet-500",light:"bg-violet-100 dark:bg-violet-950",text:"text-violet-600 dark:text-violet-400"},"first-project":{bg:"bg-blue-500",light:"bg-blue-100 dark:bg-blue-950",text:"text-blue-600 dark:text-blue-400"},"rules-guide":{bg:"bg-emerald-500",light:"bg-emerald-100 dark:bg-emerald-950",text:"text-emerald-600 dark:text-emerald-400"},"mcp-guide":{bg:"bg-orange-500",light:"bg-orange-100 dark:bg-orange-950",text:"text-orange-600 dark:text-orange-400"},"permissions-guide":{bg:"bg-green-500",light:"bg-green-100 dark:bg-green-950",text:"text-green-600 dark:text-green-400"},"memory-guide":{bg:"bg-pink-500",light:"bg-pink-100 dark:bg-pink-950",text:"text-pink-600 dark:text-pink-400"},"plugins-guide":{bg:"bg-purple-500",light:"bg-purple-100 dark:bg-purple-950",text:"text-purple-600 dark:text-purple-400"},"workstreams-guide":{bg:"bg-cyan-500",light:"bg-cyan-100 dark:bg-cyan-950",text:"text-cyan-600 dark:text-cyan-400"},"loops-guide":{bg:"bg-teal-500",light:"bg-teal-100 dark:bg-teal-950",text:"text-teal-600 dark:text-teal-400"},"multi-tool-guide":{bg:"bg-amber-500",light:"bg-amber-100 dark:bg-amber-950",text:"text-amber-600 dark:text-amber-400"},"next-steps":{bg:"bg-rose-500",light:"bg-rose-100 dark:bg-rose-950",text:"text-rose-600 dark:text-rose-400"}},y_="claude-config-tutorial-visited";function FW(){const[e,t]=_.useState("intro"),[s,n]=_.useState({welcome:!0}),[o,c]=_.useState(()=>{try{return JSON.parse(localStorage.getItem(y_)||"[]")}catch{return[]}}),u=_.useRef(null);_.useEffect(()=>{if(u.current){const b=u.current.querySelector("[data-radix-scroll-area-viewport]");b&&(b.scrollTop=0)}},[e]),_.useEffect(()=>{if(e&&!o.includes(e)){const b=[...o,e];c(b),localStorage.setItem(y_,JSON.stringify(b))}},[e,o]);const l=b=>{n(k=>({...k,[b]:!k[b]}))},d=OW[e],f=ql.flatMap(b=>b.subsections.length>0?b.subsections.map(k=>k.id):[b.id]),m=f.indexOf(e),h=m>0?f[m-1]:null,x=m<f.length-1?f[m+1]:null,w=Math.round(o.length/f.length*100),C=(()=>{for(const b of ql)if(b.id===e||b.subsections.some(k=>k.id===e))return b;return ql[0]})(),v=lu[C.id]||lu.welcome,y=b=>{for(const k of ql){if(k.id===b)return k.title;const E=k.subsections.find(P=>P.id===b);if(E)return E.title}return""},g=b=>({__html:x2(b)});return r.jsxs("div",{className:"flex h-full",children:[r.jsxs("div",{className:"w-72 border-r border-border bg-muted/30 flex flex-col",children:[r.jsxs("div",{className:"p-4 border-b border-border bg-gradient-to-r from-indigo-500/10 to-purple-500/10",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg",children:r.jsx(ku,{className:"w-5 h-5 text-white"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-foreground",children:"Tutorial"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Step-by-step guide"})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Progress"}),r.jsxs("span",{children:[w,"% complete"]})]}),r.jsx(S2,{value:w,className:"h-2"})]})]}),r.jsx(Ys,{className:"flex-1",children:r.jsx("div",{className:"p-2",children:ql.map((b,k)=>{const E=b.icon,P=lu[b.id]||lu.welcome,A=e===b.id||b.subsections.some(M=>M.id===e),N=b.subsections.length>0?b.subsections.every(M=>o.includes(M.id)):o.includes(b.id);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{className:Ee("w-full flex items-center gap-2 px-3 py-2.5 text-sm rounded-lg hover:bg-accent text-left transition-all",A&&"bg-accent"),onClick:()=>{b.subsections.length>0?(l(b.id),s[b.id]||t(b.subsections[0].id)):t(b.id)},children:[r.jsx("span",{className:Ee("w-7 h-7 rounded-lg flex items-center justify-center transition-colors",A?P.bg+" text-white":P.light),children:N?r.jsx(Mo,{className:"w-4 h-4"}):r.jsx(E,{className:Ee("w-4 h-4",!A&&P.text)})}),r.jsx("span",{className:Ee("flex-1",A&&"font-medium"),children:b.title}),b.subsections.length>0&&r.jsx(xs,{className:Ee("w-4 h-4 text-muted-foreground transition-transform",s[b.id]&&"rotate-90")})]}),b.subsections.length>0&&s[b.id]&&r.jsx("div",{className:"ml-4 mt-1 space-y-0.5 border-l-2 border-border pl-3",children:b.subsections.map(M=>{const I=e===M.id,L=o.includes(M.id);return r.jsxs("button",{className:Ee("w-full text-left px-3 py-1.5 text-sm rounded-md hover:bg-accent text-foreground flex items-center gap-2",I&&"bg-accent font-medium",I&&P.text),onClick:()=>t(M.id),children:[L&&!I&&r.jsx(Mo,{className:"w-3 h-3 text-green-500"}),r.jsx("span",{className:Ee(!L&&!I&&"ml-5"),children:M.title})]},M.id)})})]},b.id)})})})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[r.jsx("div",{className:Ee("px-8 py-4 border-b border-border",v.light),children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center gap-3",children:[r.jsx("div",{className:Ee("w-10 h-10 rounded-xl flex items-center justify-center",v.bg,"text-white"),children:r.jsx(C.icon,{className:"w-5 h-5"})}),r.jsxs("div",{children:[r.jsx("p",{className:Ee("text-sm font-medium",v.text),children:C.title}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:(d==null?void 0:d.title)||y(e)})]})]})}),r.jsx(Ys,{className:"flex-1",ref:u,children:r.jsx("div",{className:"max-w-3xl mx-auto p-8",children:d?r.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert prose-headings:text-foreground prose-p:text-muted-foreground prose-strong:text-foreground prose-code:text-primary prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-pre:bg-muted prose-pre:border prose-pre:border-border",dangerouslySetInnerHTML:g(d.content)}):r.jsxs("div",{className:"text-center text-muted-foreground py-12",children:[r.jsx(ku,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a topic from the sidebar"})]})})}),r.jsx("div",{className:"border-t border-border p-4 bg-muted/30",children:r.jsxs("div",{className:"max-w-3xl mx-auto flex items-center justify-between",children:[h?r.jsxs(re,{variant:"ghost",onClick:()=>t(h),className:"flex items-center gap-2",children:[r.jsx(S5,{className:"w-4 h-4"}),r.jsx("span",{className:"max-w-[150px] truncate",children:y(h)})]}):r.jsx("div",{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[m+1," of ",f.length]}),x?r.jsxs(re,{onClick:()=>t(x),className:Ee("flex items-center gap-2",v.bg,"hover:opacity-90"),children:[r.jsx("span",{className:"max-w-[150px] truncate",children:y(x)}),r.jsx(Pg,{className:"w-4 h-4"})]}):r.jsx(re,{variant:"outline",onClick:()=>t("intro"),className:"flex items-center gap-2",children:"Start Over"})]})})]})]})}function BW(){const[e,t]=_.useState(null),[s,n]=_.useState(!0),[o,c]=_.useState(!1),[u,l]=_.useState(!1),[d,f]=_.useState(!1),[m,h]=_.useState(null);_.useEffect(()=>{x()},[]);const x=async()=>{try{n(!0);const k=await ue.getSessionStatus();t(k)}catch{K.error("Failed to load session status")}finally{n(!1)}},w=async()=>{var k,E;c(!0);try{const P=await ue.installSessionAll();P.success?(K.success("Session persistence installed!"),x()):K.error(((k=P.hooks)==null?void 0:k.error)||((E=P.command)==null?void 0:E.error)||"Installation failed")}catch{K.error("Installation failed")}finally{c(!1)}},j=async()=>{c(!0);try{const k=await ue.installSessionHooks();k.success?(K.success("Session hooks installed!"),x()):K.error(k.error||"Failed to install hooks")}catch{K.error("Failed to install hooks")}finally{c(!1)}},C=async()=>{c(!0);try{const k=await ue.installFlushCommand();k.success?(K.success(k.alreadyInstalled?"/flush command already installed":"/flush command installed!"),x()):K.error(k.error||"Failed to install command")}catch{K.error("Failed to install command")}finally{c(!1)}},v=async()=>{l(!0);try{const k=await ue.clearSessionContext();k.success?(K.success(k.cleared?"Session context cleared":"No context to clear"),x()):K.error("Failed to clear context")}catch{K.error("Failed to clear context")}finally{l(!1)}},y=async()=>{try{const k=await ue.getSessionContext();h(k.content),f(!0)}catch{K.error("Failed to load context")}},g=k=>k===null?"Unknown":k<60?`${k} minutes ago`:k<1440?`${Math.floor(k/60)} hours ago`:`${Math.floor(k/1440)} days ago`;if(s)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})});const b=(e==null?void 0:e.hooksInstalled)&&(e==null?void 0:e.flushCommandInstalled)&&(e==null?void 0:e.permissionInstalled);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-5 shadow-sm",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-lg bg-indigo-100 dark:bg-indigo-950",children:r.jsx(Ms,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Session Persistence"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Save and restore Claude Code session context"})]})]}),r.jsx(re,{variant:"ghost",size:"sm",onClick:x,children:r.jsx(Tr,{className:"w-4 h-4"})})]}),r.jsxs("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:["Session persistence allows you to save your current Claude Code context using the ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1.5 py-0.5 rounded text-indigo-600 dark:text-indigo-400",children:"/flush"})," command, and automatically restore it when you start a new session."]})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Installation Status"})}),r.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:[r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.hooksInstalled?r.jsx(It,{className:"w-5 h-5 text-green-500"}):r.jsx(Ts,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Session Hooks"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Auto-restore context on session start, preserve on session end"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tt,{variant:e!=null&&e.hooksInstalled?"default":"secondary",children:e!=null&&e.hooksInstalled?"Installed":"Not Installed"}),!(e!=null&&e.hooksInstalled)&&r.jsx(re,{variant:"outline",size:"sm",onClick:j,disabled:o,children:o?r.jsx(et,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.flushCommandInstalled?r.jsx(It,{className:"w-5 h-5 text-green-500"}):r.jsx(Ts,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"/flush Command"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Adds the /flush command to save session context"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tt,{variant:e!=null&&e.flushCommandInstalled?"default":"secondary",children:e!=null&&e.flushCommandInstalled?"Installed":"Not Installed"}),!(e!=null&&e.flushCommandInstalled)&&r.jsx(re,{variant:"outline",size:"sm",onClick:C,disabled:o,children:o?r.jsx(et,{className:"w-4 h-4 animate-spin"}):"Install"})]})]}),r.jsxs("div",{className:"p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e!=null&&e.permissionInstalled?r.jsx(It,{className:"w-5 h-5 text-green-500"}):r.jsx(Ts,{className:"w-5 h-5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Write Permission"}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:"Allows Claude to write session context without prompting"})]})]}),r.jsx(tt,{variant:e!=null&&e.permissionInstalled?"default":"secondary",children:e!=null&&e.permissionInstalled?"Granted":"Not Granted"})]})]}),!b&&r.jsx("div",{className:"p-4 bg-gray-50 dark:bg-slate-900 border-t border-gray-200 dark:border-slate-800",children:r.jsxs(re,{onClick:w,disabled:o,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white",children:[o?r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(xi,{className:"w-4 h-4 mr-2"}),"Install All"]})})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700 flex items-center justify-between",children:[r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Saved Context"}),(e==null?void 0:e.hasSavedContext)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(re,{variant:"outline",size:"sm",onClick:y,children:[r.jsx(zr,{className:"w-4 h-4 mr-2"}),"View"]}),r.jsx(re,{variant:"outline",size:"sm",onClick:v,disabled:u,className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950",children:u?r.jsx(et,{className:"w-4 h-4 animate-spin"}):r.jsx(ys,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"p-4",children:e!=null&&e.hasSavedContext?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(sc,{className:"w-4 h-4 text-gray-400"}),r.jsx("span",{className:"text-gray-600 dark:text-slate-400",children:"Last saved:"}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:g(e.contextAge)})]}),e.contextPreview&&r.jsx("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:r.jsx("pre",{className:"text-xs text-gray-600 dark:text-slate-400 whitespace-pre-wrap overflow-hidden",children:e.contextPreview})}),r.jsxs("div",{className:"text-xs text-gray-500 dark:text-slate-500",children:["Storage: ",e.sessionDir]})]}):r.jsxs("div",{className:"text-center py-6",children:[r.jsx(Ms,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:"No saved context"}),r.jsxs("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-1",children:["Use ",r.jsx("code",{className:"bg-gray-100 dark:bg-slate-800 px-1 rounded",children:"/flush"})," in Claude Code to save your session"]})]})})]}),(e==null?void 0:e.lastSession)&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[r.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Last Session"})}),r.jsxs("div",{className:"p-4 space-y-2",children:[e.lastSession.session_id&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"ID:"}),r.jsx("code",{className:"text-xs bg-gray-100 dark:bg-slate-800 px-2 py-0.5 rounded",children:e.lastSession.session_id})]}),e.lastSession.cwd&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Directory:"}),r.jsx("span",{className:"text-gray-900 dark:text-white font-mono text-xs",children:e.lastSession.cwd})]}),e.lastSession.timestamp&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Ended:"}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:e.lastSession.timestamp})]}),e.lastSession.reason&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-500 dark:text-slate-400 w-20",children:"Reason:"}),r.jsx(tt,{variant:"secondary",children:e.lastSession.reason})]})]})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"How to Use"}),r.jsxs("ol",{className:"space-y-2 text-sm text-gray-600 dark:text-slate-400",children:[r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"1."}),"Install session hooks and the /flush command above"]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"2."}),"Use ",r.jsx("code",{className:"bg-white dark:bg-slate-800 px-1.5 py-0.5 rounded",children:"/flush"})," in Claude Code before ending a session"]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"font-medium text-indigo-600 dark:text-indigo-400",children:"3."}),"Your context is automatically restored when you start a new session"]})]})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config session # Show session status"}),r.jsx("p",{children:"coder-config session install-hooks # Install session hooks"}),r.jsx("p",{children:"coder-config session clear # Clear saved context"})]})]}),r.jsx(yt,{open:d,onOpenChange:f,children:r.jsxs(ht,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(ft,{children:[r.jsx(mt,{children:"Saved Context"}),r.jsx(tr,{children:"This context will be restored on your next Claude Code session"})]}),r.jsx("div",{className:"flex-1 overflow-auto py-4",children:r.jsx("pre",{className:"text-sm text-gray-700 dark:text-slate-300 whitespace-pre-wrap bg-gray-50 dark:bg-slate-900 p-4 rounded-lg",children:m||"No content"})}),r.jsx(St,{children:r.jsx(re,{variant:"ghost",onClick:()=>f(!1),children:"Close"})})]})})]})}const $W=[{id:"projects",label:"All Projects",icon:Bn,section:"Projects"},{id:"explorer",label:"Project Explorer",icon:Ki,section:"Projects"},{id:"workstreams",label:"Workstreams",icon:lS,section:"Projects"},{id:"registry",label:"MCP Registry",icon:Gn,section:"Tools"},{id:"plugins",label:"Plugins",icon:Do,section:"Tools"},{id:"memory",label:"Memory",icon:Ro,section:"Tools"},{id:"claude-settings",label:"Claude Code",icon:Jn,section:"Configuration",tool:"claude"},{id:"gemini-settings",label:"Gemini CLI",icon:Kt,section:"Configuration",tool:"gemini"},{id:"codex-settings",label:"Codex CLI",icon:Kt,section:"Configuration",isNew:!0,tool:"codex"},{id:"antigravity-settings",label:"Antigravity",icon:Nc,section:"Configuration",tool:"antigravity"},{id:"create-mcp",label:"Create MCP",icon:cs,section:"Developer"},{id:"loops",label:"Ralph Loops",icon:hc,section:"Developer",isNew:!0},{id:"sessions",label:"Sessions",icon:Ms,section:"System"},{id:"preferences",label:"Preferences",icon:cS,section:"System"},{id:"tutorial",label:"Tutorial",icon:ku,section:"Help"},{id:"docs",label:"Docs & Help",icon:To,section:"Help"}],b_=(e,t)=>{try{const s=localStorage.getItem(`claude-config-${e}`);return s?JSON.parse(s):t}catch{return t}},zW=(e,t)=>{try{localStorage.setItem(`claude-config-${e}`,JSON.stringify(t))}catch{}};function HW(){const{projects:e,activeProject:t,fetch:s,setActive:n}=Ex(),{appConfig:o,version:c,fetch:u,checkVersion:l}=Nw(),[d,f]=_.useState(()=>b_("currentView","explorer")),[m,h]=_.useState(!0),[x,w]=_.useState({dir:"",subprojects:[],hierarchy:[]}),[j,C]=_.useState([]),[v,y]=_.useState({mcpServers:{}}),[g,b]=_.useState([]),[k,E]=_.useState([]),[P,A]=_.useState(null),[N,M]=_.useState(null),[I,L]=_.useState(!1),[B,z]=_.useState({title:"",type:""}),[Y,H]=_.useState(""),[U,X]=_.useState(""),q=_.useRef({}),[O,R]=_.useState(null),[$,G]=_.useState(!1),[F,te]=_.useState(!1),[ce,fe]=_.useState(null),[J,W]=_.useState(!1),ae=_.useRef(null);_.useEffect(()=>{zW("currentView",d)},[d]);const ne=_.useCallback(async()=>{try{const[ve,_e,Oe,de,ye]=await Promise.all([ue.getProject(),ue.getConfigs(),ue.getRegistry(),ue.getRules(),ue.getCommands()]);w(ve),C(_e),y(Oe),b(de),E(ye),_e.length>0&&!P&&A(_e[_e.length-1])}catch(ve){K.error("Failed to load data: "+ve.message)}finally{h(!1)}},[P]),Z=_.useCallback(async(ve=!1)=>{try{const _e=await s(),Oe=_e==null?void 0:_e.find(de=>de.isActive);if(ve&&Oe){const de=await ue.getSubprojects(Oe.path);fe({dir:Oe.path,subprojects:de.subprojects||[]})}ve&&!Oe&&(b_("currentView",null)||f("projects"))}catch{console.log("Projects API not available")}},[s]),le=async ve=>{try{const _e=await n(ve);_e.success?(w({dir:_e.dir,hierarchy:_e.hierarchy,subprojects:_e.subprojects}),fe({dir:_e.dir,subprojects:_e.subprojects}),await ne(),K.success(`Switched to ${_e.project.name}`)):K.error(_e.error||"Failed to switch project")}catch(_e){K.error("Failed to switch project: "+_e.message)}},Ce=()=>{s()};_.useEffect(()=>{ne(),Z(!0),(async()=>{try{const[_e]=await Promise.all([l(),u()]);!ae.current&&(_e!=null&&_e.installedVersion)&&(ae.current=_e.installedVersion);const Oe=Nw.getState().appConfig;if(_e!=null&&_e.updateAvailable&&(_e==null?void 0:_e.updateMethod)==="npm")if(Oe!=null&&Oe.autoUpdate){K.info(`Auto-updating to v${_e.latestVersion}...`),G(!0);const de=await ue.performUpdate({updateMethod:_e.updateMethod,targetVersion:_e.latestVersion,channel:_e.channel});if(de.success){K.success(`Updated to v${de.newVersion}! Restarting server...`);try{await ue.restartServer()}catch{}let ye=0;const Re=setInterval(async()=>{ye++;try{await ue.checkVersion(),clearInterval(Re),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{ye>30&&(clearInterval(Re),K.info("Server restarting. Please refresh the page."),G(!1))}},500)}else K.error("Auto-update failed: "+de.error),G(!1),R(_e)}else R(_e)}catch{}})()},[]),_.useEffect(()=>{const _e=setInterval(async()=>{if(ae.current)try{const Oe=await ue.checkVersion();Oe!=null&&Oe.installedVersion&&Oe.installedVersion!==ae.current&&(console.log(`[stale-ui] Server updated to v${Oe.installedVersion}, refreshing...`),window.location.reload())}catch{}},3e4);return()=>clearInterval(_e)},[]);const Le=(ve,_e)=>{if(!ve||!_e)return!1;const Oe=Re=>Re.split(".").map(ze=>parseInt(ze,10)||0),de=Oe(ve),ye=Oe(_e);for(let Re=0;Re<Math.max(de.length,ye.length);Re++){if((de[Re]||0)>(ye[Re]||0))return!0;if((de[Re]||0)<(ye[Re]||0))return!1}return!1},Ge=async(ve,_e="npm",Oe)=>{G(!0);const de=await ue.performUpdate({updateMethod:_e,targetVersion:ve,channel:Oe});if(de.success){K.success(`Updated to v${de.newVersion}! Restarting server...`),R(null);try{await ue.restartServer()}catch{}let ye=0;const Re=setInterval(async()=>{ye++;try{await ue.checkVersion(),clearInterval(Re),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{ye>30&&(clearInterval(Re),K.info("Server restarting. Please refresh the page."),G(!1))}},500);return!0}else return K.error("Update failed: "+de.error),G(!1),!1},me=async()=>{W(!0);try{const ve=await ue.checkVersion(),_e=ve==null?void 0:ve.installedVersion,Oe=ve==null?void 0:ve.latestVersion;if(_e&&ae.current&&_e!==ae.current){K.info(`Refreshing to v${_e}...`),setTimeout(()=>window.location.reload(),500);return}Le(Oe,_e)&&(o!=null&&o.autoUpdate?(W(!1),K.info(`Auto-updating to v${Oe}...`),await Ge(Oe,(ve==null?void 0:ve.updateMethod)||"npm",ve==null?void 0:ve.channel)):(R({...ve,updateAvailable:!0}),K.info(`Update available: v${Oe}`)))}catch{K.error("Failed to check for updates")}finally{W(!1)}},be=async()=>{if(O!=null&&O.updateAvailable){G(!0);try{const ve=await ue.performUpdate({updateMethod:O.updateMethod,sourcePath:O.sourcePath,targetVersion:O.latestVersion,channel:O.channel});if(ve.success){K.success(`Updated to v${ve.newVersion}! Restarting server...`),R(null),setVersion(ve.newVersion);try{await ue.restartServer()}catch{}let _e=0;const Oe=setInterval(async()=>{_e++;try{await ue.checkVersion(),clearInterval(Oe),K.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{_e>30&&(clearInterval(Oe),K.info("Server restarting. Please refresh the page."),G(!1))}},500)}else K.error("Update failed: "+ve.error),G(!1)}catch(ve){K.error("Update failed: "+ve.message),G(!1)}}};_.useEffect(()=>{const ve=async()=>{try{const{hashes:Oe}=await ue.getFileHashes(),de=q.current,ye=Object.keys(Oe).some(ze=>de[ze]!==Oe[ze])||Object.keys(de).some(ze=>!Oe[ze]),Re=de.__subprojects__!==Oe.__subprojects__;if(ye&&Object.keys(de).length>0&&(await ne(),Re&&ce))try{const ze=await ue.getSubprojects(ce.dir);fe(Je=>({...Je,subprojects:ze.subprojects||[]}))}catch{}q.current=Oe}catch{}},_e=setInterval(ve,2e3);return ve(),()=>clearInterval(_e)},[ne,ce]);const Be=new Set;j.forEach(ve=>{var _e,Oe;(((_e=ve.config)==null?void 0:_e.include)||[]).forEach(de=>Be.add(de)),Object.keys(((Oe=ve.config)==null?void 0:Oe.mcpServers)||{}).forEach(de=>Be.add(de))});const Ke={mcps:Be.size,rules:g.length,commands:k.length},Qe=async()=>{try{const ve=await ue.applyConfig(x.dir);if(ve.tools){const _e=Object.entries(ve.tools).filter(([,Oe])=>Oe).map(([Oe])=>Oe==="claude"?"Claude Code":"Antigravity");_e.length>0?K.success(`Config applied to: ${_e.join(", ")}`):K.warning("No tools were updated")}else K.success("Configuration applied successfully!")}catch(ve){K.error("Failed to apply config: "+ve.message)}},je=async()=>{h(!0),await ne(),K.success("Data refreshed")};if(m)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(et,{className:"w-8 h-8 animate-spin text-primary"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading configuration..."})]})});const we=()=>{switch(d){case"explorer":return r.jsx(b8,{project:x,onRefresh:ne});case"registry":return r.jsx(BH,{registry:v,searchQuery:Y,setSearchQuery:H,onUpdate:ne});case"plugins":return r.jsx(fW,{});case"memory":return r.jsx($H,{project:x,onUpdate:ne});case"create-mcp":return r.jsx(gH,{project:x});case"claude-settings":return r.jsx(tH,{});case"gemini-settings":return r.jsx(rH,{});case"codex-settings":return r.jsx(mH,{});case"antigravity-settings":return r.jsx(aH,{});case"sessions":return r.jsx(BW,{});case"preferences":return r.jsx(eH,{onConfigChange:()=>u()});case"projects":return r.jsx(UH,{onProjectSwitch:ve=>{w({dir:ve.dir,hierarchy:ve.hierarchy,subprojects:ve.subprojects}),fe({dir:ve.dir,subprojects:ve.subprojects}),ne(),Z()}});case"workstreams":return r.jsx(mW,{onWorkstreamChange:ve=>{K.success(`Switched to workstream: ${ve.name}`)}});case"loops":return r.jsx(pW,{activeProject:t});case"docs":return r.jsx(uW,{});case"tutorial":return r.jsx(FW,{});default:return null}};return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"h-16 bg-card border-b border-border sticky top-0 z-50 shadow-sm",children:r.jsxs("div",{className:"h-full px-6 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg shadow-indigo-500/20",children:r.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 128 128",children:[r.jsx("circle",{cx:"64",cy:"64",r:"52",fill:"none",stroke:"white",strokeWidth:"10",strokeDasharray:"24 12"}),r.jsx("circle",{cx:"64",cy:"64",r:"28",fill:"white"}),r.jsx("circle",{cx:"64",cy:"64",r:"12",fill:"#7c3aed"})]})}),r.jsx("div",{children:r.jsxs("h1",{className:"text-xl font-bold text-foreground",children:["Coder ",r.jsx("span",{className:"text-primary",children:"Config"})]})}),O&&r.jsxs("button",{onClick:be,disabled:$,className:"ml-3 px-2.5 py-1 text-xs font-medium bg-green-100 text-green-700 hover:bg-green-200 rounded-full flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[$?r.jsx(et,{className:"w-3 h-3 animate-spin"}):r.jsx(xi,{className:"w-3 h-3"}),$?"Updating...":`Update to v${O.latestVersion}`]})]}),r.jsx(xN,{orientation:"vertical",className:"h-6"}),r.jsx(w8,{projects:e,activeProject:t,onSwitch:le,onAddClick:()=>te(!0),onManageClick:()=>f("projects")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(k8,{}),r.jsx(re,{variant:"ghost",size:"sm",onClick:je,children:r.jsx(Tr,{className:"w-4 h-4"})}),r.jsxs(re,{onClick:Qe,variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",title:"Config auto-applies on save. Click to manually re-apply.",children:[r.jsx(Nc,{className:"w-4 h-4"}),"Re-apply"]})]})]})}),r.jsxs("div",{className:"flex",children:[r.jsxs("aside",{className:"w-64 h-[calc(100vh-64px)] border-r border-border bg-card sticky top-16 flex flex-col",children:[r.jsx(Ys,{className:"flex-1 py-4",children:["Projects","Tools","Configuration","Developer","System","Help"].map(ve=>r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"px-4 mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:ve}),r.jsx("div",{className:"space-y-0.5",children:$W.filter(_e=>_e.section===ve).filter(_e=>{var Oe;return _e.id!=="loops"||((Oe=o==null?void 0:o.experimental)==null?void 0:Oe.ralphLoops)}).filter(_e=>!_e.tool||((o==null?void 0:o.enabledTools)||["claude"]).includes(_e.tool)).map(_e=>{const Oe=_e.icon,de=d===_e.id;return r.jsxs("button",{onClick:()=>f(_e.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-all duration-200 border-l-2 ${de?"bg-accent border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:[r.jsx(Oe,{className:"w-4 h-4"}),r.jsx("span",{className:"flex-1 text-left",children:_e.label}),_e.badge&&r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${de?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:Ke[_e.badge]}),_e.isNew&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-green-500/20 text-green-600 dark:text-green-400",children:"new"})]},_e.id)})})]},ve))}),r.jsx("div",{className:"px-4 py-3 border-t border-border",children:r.jsxs("button",{onClick:me,disabled:J,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",title:"Check for updates",children:[J?r.jsx(et,{className:"w-3 h-3 animate-spin"}):null,c?`v${c}`:""]})})]}),r.jsx("main",{style:["explorer","docs","tutorial"].includes(d)?{}:{zoom:.9},className:Ee("flex-1 overflow-auto",["explorer","docs","tutorial"].includes(d)?"h-[calc(100vh-64px)]":"p-6"),children:r.jsx(k_,{mode:"wait",children:r.jsx(Ra.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:["explorer","docs","tutorial"].includes(d)?"h-full":"",children:we()},d)})})]}),r.jsx(fN,{open:F,onOpenChange:te,onAdded:Ce}),r.jsx(_8,{onStartTutorial:()=>f("tutorial")})]})}function WW(){const[e,t]=_.useState(!1),[s,n]=_.useState(!1),[o,c]=_.useState(!1),u=_.useCallback(async()=>{n(!0);try{await ue.restartServer(),K.info("Server restarting... page will reload."),setTimeout(()=>{window.location.reload()},2e3)}catch(d){K.error("Failed to restart: "+d.message),n(!1)}},[]),l=_.useCallback(()=>{c(!0),t(!1),K.dismiss("update-available")},[]);return _.useEffect(()=>{let d;const f=async()=>{try{const m=await ue.getVersion();console.log("[Update Check]",m),m.needsRestart&&!o&&t(!0)}catch{}};return f(),d=setInterval(f,3e4),()=>clearInterval(d)},[o]),r.jsx(C8,{children:r.jsxs("div",{className:"min-h-screen bg-background",children:[e&&!s&&r.jsxs("div",{className:"fixed top-0 left-0 right-0 z-50 bg-blue-600 text-white px-4 py-2 flex items-center justify-center gap-2 shadow-lg cursor-pointer hover:bg-blue-700 transition-colors",onClick:u,children:[r.jsx(Tr,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Update available — click to restart"}),r.jsx("button",{onClick:d=>{d.stopPropagation(),l()},className:"absolute right-3 p-1 hover:bg-blue-500 rounded",children:r.jsx(hi,{className:"w-4 h-4"})})]}),s&&r.jsxs("div",{className:"fixed top-0 left-0 right-0 z-50 bg-amber-600 text-white px-4 py-2 flex items-center justify-center gap-2",children:[r.jsx(Tr,{className:"w-4 h-4 animate-spin"}),r.jsx("span",{className:"text-sm font-medium",children:"Restarting server..."})]}),r.jsx(HW,{}),r.jsx(DP,{position:"bottom-right",richColors:!0})]})})}aP.createRoot(document.getElementById("root")).render(r.jsx(WW,{}));